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;
@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"));
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 =
}
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");
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());
}
}