Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame^] | 1 | /* |
| 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 Agrawal | c5f6327 | 2016-06-16 13:09:53 +0530 | [diff] [blame] | 17 | package org.onosproject.yangutils.plugin.manager; |
| 18 | |
| 19 | import java.io.File; |
| 20 | import java.io.IOException; |
| 21 | import org.apache.commons.io.FileUtils; |
| 22 | import org.apache.maven.project.MavenProject; |
| 23 | import org.junit.Test; |
| 24 | import org.sonatype.plexus.build.incremental.BuildContext; |
| 25 | import org.sonatype.plexus.build.incremental.DefaultBuildContext; |
| 26 | |
| 27 | import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.addToCompilationRoot; |
| 28 | |
| 29 | /** |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame^] | 30 | * Unit test case for YANG plugin utils. |
Gaurav Agrawal | c5f6327 | 2016-06-16 13:09:53 +0530 | [diff] [blame] | 31 | */ |
| 32 | public 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 | } |