blob: e45b1d80227ceb31af22636cd079692262a7a9a7 [file] [log] [blame]
VinodKumarS-Huawei6266db32016-05-10 17:58:57 +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;
20
21import org.junit.Test;
22import org.onosproject.yangutils.datamodel.YangNode;
23import org.onosproject.yangutils.parser.exceptions.ParserException;
24import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
Gaurav Agrawalbfce9342016-06-15 13:58:01 +053025import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
VinodKumarS-Huawei6266db32016-05-10 17:58:57 +053026
27import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
28import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
29
30/**
31 * Unit tests for union translator.
32 */
33public final class NotificationTranslatorTest {
34
35 private final YangUtilsParserManager manager = new YangUtilsParserManager();
36
37 /**
38 * Checks union translation should not result in any exception.
39 */
40 @Test
41 public void processUnionTranslator()
42 throws IOException, ParserException {
43
44 String userDir = System.getProperty("user.dir");
45 YangNode node = manager.getDataModel("src/test/resources/NotificationTest.yang");
46
47 YangPluginConfig yangPluginConfig = new YangPluginConfig();
48 yangPluginConfig.setCodeGenDir(userDir + "/target/NotificationTest/");
49
Bharat saraswal715d3fc2016-05-17 19:59:16 +053050 generateJavaCode(node, yangPluginConfig);
VinodKumarS-Huawei6266db32016-05-10 17:58:57 +053051
52 deleteDirectory(userDir + "/target/NotificationTest/");
53 }
54
55 // TODO enhance the test cases, after having a framework of translator test.
56}