// TODO Test yang files in transitive dependencies
@Test
- public void testYangRootNotExist() throws URISyntaxException {
- try {
- setUp("test-parent/YangRootNotExist/", false);
- } catch (VerificationException e) {
- assertVerificationException(e,
- "[ERROR] yang-to-sources: Unable to parse yang files from ");
- assertVerificationException(
- e,
- "Caused by: org.apache.maven.plugin.MojoExecutionException: yang-to-sources: Unable to parse yang files from ");
- return;
- }
-
- fail("Verification exception should have been thrown");
+ public void testYangRootNotExist() throws Exception {
+ Verifier v = setUp("test-parent/YangRootNotExist/", false);
+ v.verifyTextInLog("[WARNING] yang-to-sources: YANG source directory");
}
@Test
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
static Collection<File> listFiles(File root, File[] excludedFiles, Log log) throws FileNotFoundException {
if (!root.exists()) {
- throw new FileNotFoundException(root.toString());
+ if (log != null) {
+ log.warn(Util.message("YANG source directory %s not found. No code will be generated.", YangToSourcesProcessor.LOG_PREFIX, root.toString()));
+ }
+ return Collections.emptyList();
}
Collection<File> result = new ArrayList<>();
Collection<File> yangFiles = FileUtils.listFiles(root, new String[] { YANG_SUFFIX }, true);