Bug 3899: Milestone: Increase test coverage for Yangtools 40/34540/3
authorJakub Toth <jatoth@cisco.com>
Fri, 12 Feb 2016 10:31:31 +0000 (11:31 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 15 Feb 2016 17:30:48 +0000 (17:30 +0000)
YangSourceFromFileTest

Change-Id: I6f0330bc6411c46e5dac9677a44952d648e0bd70
Signed-off-by: Jakub Toth <jatoth@cisco.com>
yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java [new file with mode: 0644]
yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang [new file with mode: 0644]

diff --git a/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java b/yang/yang-maven-plugin/src/test/java/org/opendaylight/yangtools/yang2sources/plugin/YangSourceFromFileTest.java
new file mode 100644 (file)
index 0000000..5286855
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang2sources.plugin;
+
+import java.io.File;
+import java.io.InputStream;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class YangSourceFromFileTest {
+
+    @Test
+    public void yangSourceFromFileTest() throws Exception {
+        final File source = new File(getClass().getResource("/yang-source-from-file.yang").getFile());
+        final YangSourceFromFile yangSource = new YangSourceFromFile(source);
+        final InputStream openStream = yangSource.openStream();
+        Assert.assertNotNull(openStream);
+        Assert.assertEquals(541, yangSource.size());
+    }
+
+}
diff --git a/yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang b/yang/yang-maven-plugin/src/test/resources/yang-source-from-file.yang
new file mode 100644 (file)
index 0000000..688c5b1
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+ module yang-source-from-file {
+
+   namespace "yang:source:from:file";
+   prefix "ysff";
+
+   revision 2016-02-12 {
+     description
+      "Initial revision.";
+   }
+
+   container cont{
+     leaf l{
+       type string;
+     }
+   }
+
+ }