From 63c4d7988e29b54124cbf8a11cb3ff4bccf9f316 Mon Sep 17 00:00:00 2001 From: Jakub Morvay Date: Tue, 19 Sep 2017 22:57:23 +0200 Subject: [PATCH] Adjust tests for yangtools changes 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 --- .../confignetconfconnector/NetconfMappingTest.java | 8 ++++---- .../mdsal/connector/ops/NetconfMDSalMappingTest.java | 7 +++++-- .../sal/restconf/impl/test/ExpressionParserTest.java | 2 +- .../test/RestconfImplNotificationSubscribingTest.java | 4 ++-- .../sal/restconf/impl/test/RestconfImplTest.java | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/NetconfMappingTest.java b/netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/NetconfMappingTest.java index f4059a6438..deebb5d019 100644 --- a/netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/NetconfMappingTest.java +++ b/netconf/config-netconf-connector/src/test/java/org/opendaylight/netconf/confignetconfconnector/NetconfMappingTest.java @@ -866,10 +866,10 @@ public class NetconfMappingTest extends AbstractConfigTest { } private List getYangs() { - final List 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 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 yangDependencies = new ArrayList<>(); for (final String path : paths) { final InputStream is = Preconditions diff --git a/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/NetconfMDSalMappingTest.java b/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/NetconfMDSalMappingTest.java index d44bc8482e..8415d7a5dd 100644 --- a/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/NetconfMDSalMappingTest.java +++ b/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/NetconfMDSalMappingTest.java @@ -15,6 +15,7 @@ import static org.junit.Assert.fail; 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; @@ -825,12 +826,14 @@ public class NetconfMDSalMappingTest { } private List getYangSchemas() { - final List schemaPaths = Arrays.asList("/META-INF/yang/config.yang", + final List schemaPaths = Arrays.asList("/META-INF/yang/config@2013-04-05.yang", "/yang/mdsal-netconf-mapping-test.yang"); final List 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); } diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ExpressionParserTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ExpressionParserTest.java index 63666c78a9..434304da21 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ExpressionParserTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/ExpressionParserTest.java @@ -132,7 +132,7 @@ public class ExpressionParserTest { } } 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); diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplNotificationSubscribingTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplNotificationSubscribingTest.java index e34f9dbda1..3d66eb1157 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplNotificationSubscribingTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplNotificationSubscribingTest.java @@ -63,7 +63,7 @@ public class RestconfImplNotificationSubscribingTest { .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); } @@ -197,7 +197,7 @@ public class RestconfImplNotificationSubscribingTest { @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); diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java index f55a97ad7b..433684041f 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java @@ -102,7 +102,7 @@ public class RestconfImplTest { private void binaryKeyTest(final List al, final List 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 uriKeyValues = new HashMap<>(); uriKeyValues.put(keyDef, al.toArray()); -- 2.36.6