Adjust tests for yangtools changes 02/63302/2
authorJakub Morvay <jmorvay@cisco.com>
Tue, 19 Sep 2017 20:57:23 +0000 (22:57 +0200)
committerJakub Morvay <jmorvay@cisco.com>
Wed, 20 Sep 2017 09:56:50 +0000 (11:56 +0200)
yang-maven-plugin now adds revision to the packaged yang file name.
This is introduced in https://git.opendaylight.org/gerrit/#/c/62706/.
Adjust NetconfMappingTest and NetconfMDSalMappingTest to that.

https://git.opendaylight.org/gerrit/#/c/62731/ enforces revisions to be
in valid yyyy-MM-dd format. Adjust Restconf tests to this change.

Change-Id: I00372ee98b15d3194c8a8567a041f24f161d7276
Signed-off-by: Jakub Morvay <jmorvay@cisco.com>
netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/NetconfMappingTest.java
netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/NetconfMDSalMappingTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ExpressionParserTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplNotificationSubscribingTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java

index f4059a6438fa4434623ee3a180262021e4f08163..deebb5d0192601a2691c676bd7418c89c9e43e03 100644 (file)
@@ -866,10 +866,10 @@ public class NetconfMappingTest extends AbstractConfigTest {
     }
 
     private List<InputStream> getYangs() {
     }
 
     private List<InputStream> getYangs() {
-        final List<String> paths = Arrays.asList("/META-INF/yang/config.yang", "/META-INF/yang/rpc-context.yang",
-                "/META-INF/yang/config-test.yang", "/META-INF/yang/config-test-impl.yang",
-                "/META-INF/yang/test-types.yang", "/META-INF/yang/test-groups.yang",
-                "/META-INF/yang/ietf-inet-types@2013-07-15.yang");
+        final List<String> paths = Arrays.asList("/META-INF/yang/config@2013-04-05.yang",
+                "/META-INF/yang/rpc-context@2013-06-17.yang", "/META-INF/yang/config-test@2013-06-13.yang",
+                "/META-INF/yang/config-test-impl@2013-04-03.yang", "/META-INF/yang/test-types@2013-11-27.yang",
+                "/META-INF/yang/test-groups@2014-12-08.yang", "/META-INF/yang/ietf-inet-types@2013-07-15.yang");
         final Collection<InputStream> yangDependencies = new ArrayList<>();
         for (final String path : paths) {
             final InputStream is = Preconditions
         final Collection<InputStream> yangDependencies = new ArrayList<>();
         for (final String path : paths) {
             final InputStream is = Preconditions
index d44bc8482eea020d7e41e88253957f349754aaa7..8415d7a5ddf33d43767d64a2e1928fa529aff116 100644 (file)
@@ -15,6 +15,7 @@ import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doAnswer;
 
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doAnswer;
 
+import com.google.common.base.Preconditions;
 import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.Futures;
 import java.io.InputStream;
 import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.Futures;
 import java.io.InputStream;
@@ -825,12 +826,14 @@ public class NetconfMDSalMappingTest {
     }
 
     private List<InputStream> getYangSchemas() {
     }
 
     private List<InputStream> getYangSchemas() {
-        final List<String> schemaPaths = Arrays.asList("/META-INF/yang/config.yang",
+        final List<String> schemaPaths = Arrays.asList("/META-INF/yang/config@2013-04-05.yang",
                 "/yang/mdsal-netconf-mapping-test.yang");
         final List<InputStream> schemas = new ArrayList<>();
 
         for (final String schemaPath : schemaPaths) {
                 "/yang/mdsal-netconf-mapping-test.yang");
         final List<InputStream> schemas = new ArrayList<>();
 
         for (final String schemaPath : schemaPaths) {
-            final InputStream resourceAsStream = getClass().getResourceAsStream(schemaPath);
+            final InputStream resourceAsStream =
+                    Preconditions.checkNotNull(
+                            getClass().getResourceAsStream(schemaPath), "Resource " + schemaPath + " not found.");
             schemas.add(resourceAsStream);
         }
 
             schemas.add(resourceAsStream);
         }
 
index 63666c78a90231aac2f193342aeda00066a47511..434304da2193c08464e2fd71830fa841e28afa2b 100644 (file)
@@ -132,7 +132,7 @@ public class ExpressionParserTest {
             }
         }
         final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
             }
         }
         final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
-        final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-14-12", "localName"));
+        final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-12-14", "localName"));
         Mockito.when(path.getLastPathArgument()).thenReturn(pathValue);
         final ListenerAdapter listener = Notificator.createListener(path, "streamName", NotificationOutputType.JSON);
         listener.setQueryParams(Instant.now(), Optional.empty(), Optional.ofNullable(filter), false);
         Mockito.when(path.getLastPathArgument()).thenReturn(pathValue);
         final ListenerAdapter listener = Notificator.createListener(path, "streamName", NotificationOutputType.JSON);
         listener.setQueryParams(Instant.now(), Optional.empty(), Optional.ofNullable(filter), false);
index e34f9dbda1afe09e2aaf105625b9e28a604a23b4..3d66eb11572a72a95bba4c9893a397c74bbaa06c 100644 (file)
@@ -63,7 +63,7 @@ public class RestconfImplNotificationSubscribingTest {
                 .setGlobalSchema(YangParserTestUtils.parseYangSources(TestRestconfUtils.loadFiles("/notifications")));
 
         final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
                 .setGlobalSchema(YangParserTestUtils.parseYangSources(TestRestconfUtils.loadFiles("/notifications")));
 
         final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
-        final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-14-12", "localName"));
+        final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-12-14", "localName"));
         Mockito.when(path.getLastPathArgument()).thenReturn(pathValue);
         Notificator.createListener(path, this.identifier, NotificationOutputType.XML);
     }
         Mockito.when(path.getLastPathArgument()).thenReturn(pathValue);
         Notificator.createListener(path, this.identifier, NotificationOutputType.XML);
     }
@@ -197,7 +197,7 @@ public class RestconfImplNotificationSubscribingTest {
     @Test
     public void onNotifiTest() throws Exception {
         final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
     @Test
     public void onNotifiTest() throws Exception {
         final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
-        final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-14-12", "localName"));
+        final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-12-14", "localName"));
         Mockito.when(path.getLastPathArgument()).thenReturn(pathValue);
         final ListenerAdapter listener = Notificator.createListener(path, this.identifier, NotificationOutputType.XML);
 
         Mockito.when(path.getLastPathArgument()).thenReturn(pathValue);
         final ListenerAdapter listener = Notificator.createListener(path, this.identifier, NotificationOutputType.XML);
 
index f55a97ad7bb88ef07ee445f87af5217d6281d1e9..433684041f49d37173444d16b30c95d68e5f2231 100644 (file)
@@ -102,7 +102,7 @@ public class RestconfImplTest {
 
     private void binaryKeyTest(final List<Byte> al, final List<Byte> al2) {
 
 
     private void binaryKeyTest(final List<Byte> al, final List<Byte> al2) {
 
-        final QName keyDef = QName.create("test:key:binary", "2017-14-08", "b1");
+        final QName keyDef = QName.create("test:key:binary", "2017-08-14", "b1");
 
         final Map<QName, Object> uriKeyValues = new HashMap<>();
         uriKeyValues.put(keyDef, al.toArray());
 
         final Map<QName, Object> uriKeyValues = new HashMap<>();
         uriKeyValues.put(keyDef, al.toArray());