import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
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.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.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
@Before
public void init() throws FileNotFoundException, ReactorException {
- this.restconf = RestconfImpl.getInstance();
this.mockedBrokerFacade = mock(BrokerFacade.class);
- this.controllerContext = ControllerContext.getInstance();
- this.controllerContext.setSchemas(TestUtils.loadSchemaContext("/datastore-and-scope-specification"));
- this.restconf.setControllerContext(this.controllerContext);
- this.restconf.setBroker(this.mockedBrokerFacade);
+ this.controllerContext = TestRestconfUtils.newControllerContext(
+ TestUtils.loadSchemaContext("/datastore-and-scope-specification"));
+ this.restconf = RestconfImpl.newInstance(mockedBrokerFacade, controllerContext);
}
@Test
final String datastoreValue = datastore == null ? "CONFIGURATION" : datastore;
final String scopeValue = scope == null ? "BASE" : scope + "";
Notificator.createListener(iiBuilder.build(), "dummyStreamName/datastore=" + datastoreValue + "/scope="
- + scopeValue, NotificationOutputType.XML);
+ + scopeValue, NotificationOutputType.XML, controllerContext);
final UriInfo mockedUriInfo = mock(UriInfo.class);
@SuppressWarnings("unchecked")
}
assertNotNull("RPC ContainerSchemaNode was not found!", rpcInputSchemaNode);
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> container =
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> container =
Builders.containerBuilder(rpcInputSchemaNode);
final QName pathQName =