Peel bierman02 local RPC test invocations
[netconf.git] / restconf / restconf-nb-bierman02 / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / URIParametersParsing.java
index e11f174e357527adfb78e9c79055603742863d4e..a022c0e789e24848ed2a1992a4b6175a882737e9 100644 (file)
@@ -23,14 +23,14 @@ import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.netconf.sal.streams.listeners.ListenerAdapter;
 import org.opendaylight.netconf.sal.streams.listeners.Notificator;
 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
-import org.opendaylight.restconf.common.context.NormalizedNodeContext;
-import org.opendaylight.restconf.common.util.DataChangeScope;
+import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.CreateDataChangeEventSubscriptionInput1.Scope;
 import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Revision;
@@ -62,24 +62,24 @@ public class URIParametersParsing {
 
     @Before
     public void init() throws FileNotFoundException, ReactorException {
-        this.mockedBrokerFacade = mock(BrokerFacade.class);
-        this.controllerContext = TestRestconfUtils.newControllerContext(
+        mockedBrokerFacade = mock(BrokerFacade.class);
+        controllerContext = TestRestconfUtils.newControllerContext(
                 TestUtils.loadSchemaContext("/datastore-and-scope-specification"));
-        this.restconf = RestconfImpl.newInstance(mockedBrokerFacade, controllerContext);
+        restconf = RestconfImpl.newInstance(mockedBrokerFacade, controllerContext);
     }
 
     @Test
     public void resolveURIParametersConcreteValues() {
-        resolveURIParameters("OPERATIONAL", "SUBTREE", LogicalDatastoreType.OPERATIONAL, DataChangeScope.SUBTREE);
+        resolveURIParameters("OPERATIONAL", "SUBTREE", LogicalDatastoreType.OPERATIONAL, Scope.SUBTREE);
     }
 
     @Test
     public void resolveURIParametersDefaultValues() {
-        resolveURIParameters(null, null, LogicalDatastoreType.CONFIGURATION, DataChangeScope.BASE);
+        resolveURIParameters(null, null, LogicalDatastoreType.CONFIGURATION, Scope.BASE);
     }
 
     private void resolveURIParameters(final String datastore, final String scope,
-            final LogicalDatastoreType datastoreExpected, final DataChangeScope scopeExpected) {
+            final LogicalDatastoreType datastoreExpected, final Scope scopeExpected) {
 
         final InstanceIdentifierBuilder iiBuilder = YangInstanceIdentifier.builder();
         iiBuilder.node(QName.create("", "dummyStreamName"));
@@ -100,7 +100,7 @@ public class URIParametersParsing {
         final UriBuilder uriBuilder = UriBuilder.fromUri("www.whatever.com");
         when(mockedUriInfo.getAbsolutePathBuilder()).thenReturn(uriBuilder);
 
-        this.restconf.invokeRpc("sal-remote:create-data-change-event-subscription",
+        restconf.invokeRpc("sal-remote:create-data-change-event-subscription",
             prepareDomRpcNode(datastoreValue, scopeValue), mockedUriInfo);
 
         final ListenerAdapter listener =
@@ -110,7 +110,7 @@ public class URIParametersParsing {
     }
 
     private NormalizedNodeContext prepareDomRpcNode(final String datastore, final String scope) {
-        final EffectiveModelContext schema = this.controllerContext.getGlobalSchema();
+        final EffectiveModelContext schema = controllerContext.getGlobalSchema();
         final Module rpcSalRemoteModule = schema.findModule("sal-remote", Revision.of("2014-01-14")).get();
         final QName rpcQName =
                 QName.create(rpcSalRemoteModule.getQNameModule(), "create-data-change-event-subscription");
@@ -169,7 +169,6 @@ public class URIParametersParsing {
         when(rpcDef.getPath()).thenReturn(SchemaPath.create(true, rpcQName));
         when(rpcDef.getQName()).thenReturn(rpcQName);
 
-        return new NormalizedNodeContext(new InstanceIdentifierContext<>(null, rpcDef, null, schema),
-                container.build());
+        return new NormalizedNodeContext(InstanceIdentifierContext.ofLocalRpc(schema, rpcDef), container.build());
     }
 }