Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +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.translator.tojava.utils; |
| 18 | |
| 19 | import java.io.IOException; |
| 20 | import org.junit.Test; |
| 21 | import org.onosproject.yangutils.datamodel.YangNode; |
| 22 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
| 23 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
| 24 | |
| 25 | import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode; |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame^] | 26 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory; |
Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Unit tests for choice-case translator. |
| 30 | */ |
| 31 | public final class ChoiceCaseTranslatorTest { |
| 32 | |
| 33 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); |
| 34 | |
| 35 | /** |
| 36 | * Checks choice-case translation should not result in any exception. |
| 37 | */ |
| 38 | @Test |
| 39 | public void processChoiceCaseTranslator() throws IOException, ParserException { |
| 40 | |
| 41 | String userDir = System.getProperty("user.dir"); |
| 42 | YangNode node = manager.getDataModel("src/test/resources/ChoiceCaseTranslator.yang"); |
| 43 | |
| 44 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 45 | yangPluginConfig.setCodeGenDir(userDir + "/target/ChoiceCaseTestGenFile/"); |
| 46 | |
| 47 | generateJavaCode(node, yangPluginConfig); |
| 48 | |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame^] | 49 | deleteDirectory(userDir + "/target/ChoiceCaseTestGenFile/"); |
Vidyashree Rama | 1396065 | 2016-04-26 15:06:06 +0530 | [diff] [blame] | 50 | } |
| 51 | // TODO enhance the test cases, after having a framework of translator test. |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame^] | 52 | } |