blob: 239e86fcdab589d3a660639967138ea53c4799f7 [file] [log] [blame]
Gaurav Agrawal338735b2016-04-18 18:53:11 +05301/*
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
17package org.onosproject.yangutils.translator.tojava.utils;
18
19import java.io.IOException;
20import org.junit.Test;
21import org.onosproject.yangutils.datamodel.YangNode;
22import org.onosproject.yangutils.parser.exceptions.ParserException;
23import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
24
25import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
26import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.clean;
27
28/**
29 * Unit tests for union translator.
30 */
31public final class UnionTranslatorTest {
32
33 private final YangUtilsParserManager manager = new YangUtilsParserManager();
34
35 /**
36 * Checks union translation should not result in any exception.
37 */
38 @Test
39 public void processUnionTranslator() throws IOException, ParserException {
40
41 clean("src/test/org/onosproject/yang");
42
43 YangNode node = manager.getDataModel("src/test/resources/UnionTranslator.yang");
44
45 YangPluginConfig yangPluginConfig = new YangPluginConfig();
46 yangPluginConfig.setCodeGenDir("target/UnionTestGenFile");
47
48 generateJavaCode(node, yangPluginConfig);
49
50 clean("target/UnionTestGenFile");
51 }
52
53 // TODO enhance the test cases, after having a framework of translator test.
54}