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 b85ab2b278ec05fd33700f182d2fa6f644951987..a022c0e789e24848ed2a1992a4b6175a882737e9 100644 (file)
@@ -51,6 +51,7 @@ import org.opendaylight.yangtools.yang.model.api.InputSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class URIParametersParsing {
@@ -61,10 +62,10 @@ 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
@@ -99,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 =
@@ -109,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");
@@ -165,9 +166,9 @@ public class URIParametersParsing {
         container.withChild(augmentationBuilder.build());
 
         when(rpcDef.getInput()).thenReturn((InputSchemaNode) rpcInputSchemaNode);
+        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());
     }
 }