blob: 891a280211f58b8ab4f48ee196b26435c06e2284 [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
Gaurav Agrawalc5f63272016-06-16 13:09:53 +053017package org.onosproject.yangutils.plugin.manager;
18
19import java.io.File;
20import java.io.IOException;
21import org.apache.commons.io.FileUtils;
22import org.apache.maven.project.MavenProject;
23import org.junit.Test;
24import org.sonatype.plexus.build.incremental.BuildContext;
25import org.sonatype.plexus.build.incremental.DefaultBuildContext;
26
27import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.addToCompilationRoot;
28
29/**
Bharat saraswalb1170bd2016-07-14 13:26:18 +053030 * Unit test case for YANG plugin utils.
Gaurav Agrawalc5f63272016-06-16 13:09:53 +053031 */
32public class YangPluginUtilsTest {
33
34 private static final String BASE_DIR = "target/UnitTestCase";
35
36 /**
37 * This test case checks whether the source is getting added.
38 */
39 @Test
40 public void testForAddSource() throws IOException {
41
42 MavenProject project = new MavenProject();
43 BuildContext context = new DefaultBuildContext();
44 File sourceDir = new File(BASE_DIR + File.separator + "yang");
45 sourceDir.mkdirs();
46 addToCompilationRoot(sourceDir.toString(), project, context);
47 FileUtils.deleteDirectory(sourceDir);
48 }
49}