Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yangutils.plugin.manager; |
| 18 | |
| 19 | import java.io.IOException; |
| 20 | |
| 21 | import org.apache.maven.plugin.MojoExecutionException; |
| 22 | import org.junit.Test; |
| 23 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
| 24 | import org.onosproject.yangutils.utils.io.impl.YangFileScanner; |
| 25 | import org.onosproject.yangutils.utils.io.impl.YangPluginConfig; |
| 26 | |
| 27 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory; |
| 28 | |
| 29 | /** |
| 30 | * Unit test case for augment translator. |
| 31 | */ |
| 32 | public class AugmentTranslatorTest { |
| 33 | |
| 34 | private final YangUtilManager utilManager = new YangUtilManager(); |
| 35 | |
| 36 | /** |
| 37 | * Checks augment translation should not result in any exception. |
| 38 | * |
| 39 | * @throws MojoExecutionException |
| 40 | */ |
| 41 | @Test |
| 42 | public void processAugmentTranslator() throws IOException, ParserException, MojoExecutionException { |
| 43 | |
| 44 | String searchDir = "src/test/resources/augmentTranslator"; |
| 45 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 46 | utilManager.parseYangFileInfoSet(); |
| 47 | utilManager.createYangNodeSet(); |
| 48 | utilManager.resolveDependenciesUsingLinker(); |
| 49 | |
| 50 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 51 | yangPluginConfig.setCodeGenDir("target/augmentTranslator/"); |
| 52 | yangPluginConfig.setManagerCodeGenDir("target/augmentTranslator/"); |
Bharat saraswal | d50c638 | 2016-07-14 21:57:13 +0530 | [diff] [blame] | 53 | utilManager.translateToJava(yangPluginConfig); |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 54 | |
| 55 | deleteDirectory("target/augmentTranslator/"); |
| 56 | } |
| 57 | |
| 58 | } |