blob: fc4c6b1cdc58b6d4bf7f455d45b59a4692705d2a [file] [log] [blame]
Bharat saraswalb1170bd2016-07-14 13:26:18 +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.plugin.manager;
18
19import java.io.IOException;
20
21import org.apache.maven.plugin.MojoExecutionException;
22import org.junit.Test;
Bharat saraswal2d90b0c2016-08-04 02:00:03 +053023import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
Bharat saraswalb1170bd2016-07-14 13:26:18 +053024import org.onosproject.yangutils.parser.exceptions.ParserException;
25import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
Bharat saraswalb1170bd2016-07-14 13:26:18 +053026
27import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
28
29/**
30 * Unit test case for augment translator.
31 */
32public 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/");
Bharat saraswald50c6382016-07-14 21:57:13 +053052 utilManager.translateToJava(yangPluginConfig);
Bharat saraswalb1170bd2016-07-14 13:26:18 +053053
Bharat saraswal2d90b0c2016-08-04 02:00:03 +053054 deleteDirectory("target/augmentTranslator1/");
Bharat saraswalb1170bd2016-07-14 13:26:18 +053055 }
Bharat saraswalb1170bd2016-07-14 13:26:18 +053056}