blob: 8be657b8b33c13fe4141436cbf80c056951bb951 [file] [log] [blame]
Gaurav Agrawal56527662016-04-20 15:49:17 +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;
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053020
Gaurav Agrawal56527662016-04-20 15:49:17 +053021import org.junit.Test;
22import org.onosproject.yangutils.datamodel.YangNode;
23import org.onosproject.yangutils.parser.exceptions.ParserException;
24import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
25
26import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053027import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
Gaurav Agrawal56527662016-04-20 15:49:17 +053028
29/**
30 * Unit tests for rpc translator.
31 */
32public final class RpcTranslatorTest {
33
34 private final YangUtilsParserManager manager = new YangUtilsParserManager();
35
36 /**
37 * Checks rpc translation should not result in any exception.
38 */
39 @Test
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053040 public void processRpcTranslator()
41 throws IOException, ParserException {
Gaurav Agrawal56527662016-04-20 15:49:17 +053042
43 String userDir = System.getProperty("user.dir");
44 YangNode node = manager.getDataModel("src/test/resources/RpcTranslator.yang");
45
46 YangPluginConfig yangPluginConfig = new YangPluginConfig();
47 yangPluginConfig.setCodeGenDir(userDir + "/target/RpcTestGenFile/");
48
Bharat saraswalab4c6ba2016-05-17 14:19:38 +053049 generateJavaCode(node, yangPluginConfig, "RpcTranslator");
Gaurav Agrawal56527662016-04-20 15:49:17 +053050
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053051 deleteDirectory(userDir + "/target/RpcTestGenFile/");
Gaurav Agrawal56527662016-04-20 15:49:17 +053052 }
53 // TODO enhance the test cases, after having a framework of translator test.
54}