Bug 6995 - Change event notification subscription usability PART1
[netconf.git] / restconf / sal-rest-connector / src / test / java / org / opendaylight / restconf / rest / services / impl / RestconfStreamsServiceTest.java
index 4ee869a2f590587bc06fbb6a45658dce6b40087a..ef5464eae1a0c248535307482873c776f888750c 100644 (file)
@@ -37,11 +37,12 @@ import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
 import org.opendaylight.netconf.sal.streams.listeners.Notificator;
-import org.opendaylight.restconf.Draft16;
+import org.opendaylight.restconf.Draft17;
 import org.opendaylight.restconf.handlers.SchemaContextHandler;
 import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
 import org.opendaylight.restconf.utils.mapping.RestconfMappingNodeConstants;
 import org.opendaylight.restconf.utils.mapping.RestconfMappingStreamConstants;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -82,9 +83,12 @@ public class RestconfStreamsServiceTest {
         Notificator.removeAllListeners();
 
         // put test streams
-        Notificator.createListener(EMPTY, RestconfStreamsServiceTest.expectedStreams.get(0));
-        Notificator.createListener(EMPTY, RestconfStreamsServiceTest.expectedStreams.get(1));
-        Notificator.createListener(EMPTY, RestconfStreamsServiceTest.expectedStreams.get(2));
+        Notificator.createListener(EMPTY, RestconfStreamsServiceTest.expectedStreams.get(0),
+                NotificationOutputType.XML);
+        Notificator.createListener(EMPTY, RestconfStreamsServiceTest.expectedStreams.get(1),
+                NotificationOutputType.XML);
+        Notificator.createListener(EMPTY, RestconfStreamsServiceTest.expectedStreams.get(2),
+                NotificationOutputType.XML);
     }
 
     @AfterClass
@@ -108,8 +112,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsTest() throws Exception {
         // prepare conditions - get correct Restconf module
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("ietf-restconf"));
 
         // make test
@@ -142,8 +146,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsMissingRestconfModuleNegativeTest() {
         // prepare conditions - get null Restconf module
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision())).thenReturn(null);
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision())).thenReturn(null);
 
         // make test
         this.thrown.expect(NullPointerException.class);
@@ -159,8 +163,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsMissingListStreamNegativeTest() {
         // prepare conditions - get Restconf module with missing list stream
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-missing-list-stream"));
 
         // make test and verify
@@ -186,8 +190,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsMissingContainerStreamsNegativeTest() {
         // prepare conditions - get Restconf module with missing container streams
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-missing-container-streams"));
 
         // make test and verify
@@ -212,8 +216,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsIllegalListStreamNegativeTest() {
         // prepare conditions - get Restconf module with illegal list stream
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-illegal-list-stream"));
 
         // make test
@@ -229,8 +233,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsIllegalContainerStreamsNegativeTest() {
         // prepare conditions - get Restconf module with illegal container streams
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-illegal-container-streams"));
 
         // make test
@@ -246,8 +250,8 @@ public class RestconfStreamsServiceTest {
     public void getAvailableStreamsIllegalLeafDescriptionNegativeTest() {
         // prepare conditions - get Restconf module with illegal leaf description in list stream
         when(this.contextHandler.get()).thenReturn(this.mockSchemaContext);
-        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft16.RestconfModule.IETF_RESTCONF_QNAME
-                .getNamespace(), Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
+        when(this.mockSchemaContext.findModuleByNamespaceAndRevision(Draft17.RestconfModule.IETF_RESTCONF_QNAME
+                .getNamespace(), Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision()))
                 .thenReturn(getTestingRestconfModule("restconf-module-with-illegal-leaf-description"));
 
         // make test
@@ -262,7 +266,7 @@ public class RestconfStreamsServiceTest {
      * @return Restconf module
      */
     private Module getTestingRestconfModule(final String s) {
-        return this.schemaContext.findModuleByName(s, Draft16.RestconfModule.IETF_RESTCONF_QNAME.getRevision());
+        return this.schemaContext.findModuleByName(s, Draft17.RestconfModule.IETF_RESTCONF_QNAME.getRevision());
     }
 
     /**