X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FURITest.java;h=4900e6a66f1ab9d9d3324c85e6ca5c98f103e5ba;hp=655aba267fb5574a94e352fcedd3e4727c923a73;hb=4f8998c5e33666331aa60be51522b8c21bf04e2f;hpb=6d73d16b194435ea1ea783a37d1b51fc1f558a1f diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java index 655aba267f..4900e6a66f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java @@ -14,6 +14,7 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.google.common.base.Optional; import com.google.common.collect.Iterables; import java.io.FileNotFoundException; import java.util.Set; @@ -21,11 +22,11 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.opendaylight.controller.sal.core.api.mount.MountInstance; -import org.opendaylight.controller.sal.core.api.mount.MountService; +import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; +import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; import org.opendaylight.controller.sal.restconf.impl.BrokerFacade; import org.opendaylight.controller.sal.restconf.impl.ControllerContext; -import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode; +import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext; import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException; import org.opendaylight.controller.sal.restconf.impl.RestconfImpl; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -50,7 +51,7 @@ public class URITest { @Test public void testToInstanceIdentifierList() throws FileNotFoundException { - InstanceIdWithSchemaNode instanceIdentifier = controllerContext + InstanceIdentifierContext instanceIdentifier = controllerContext .toInstanceIdentifier("simple-nodes:userWithoutClass/foo"); assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "userWithoutClass"); @@ -79,7 +80,7 @@ public class URITest { @Test public void testToInstanceIdentifierContainer() throws FileNotFoundException { - InstanceIdWithSchemaNode instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users"); + InstanceIdentifierContext instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users"); assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "users"); assertTrue(instanceIdentifier.getSchemaNode() instanceof ContainerSchemaNode); assertEquals(2, ((ContainerSchemaNode) instanceIdentifier.getSchemaNode()).getChildNodes().size()); @@ -87,7 +88,7 @@ public class URITest { @Test public void testToInstanceIdentifierChoice() throws FileNotFoundException { - InstanceIdWithSchemaNode instanceIdentifier = controllerContext + InstanceIdentifierContext instanceIdentifier = controllerContext .toInstanceIdentifier("simple-nodes:food/nonalcoholic"); assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "nonalcoholic"); } @@ -119,7 +120,7 @@ public class URITest { @Test public void testMountPointWithExternModul() throws FileNotFoundException { initMountService(true); - InstanceIdWithSchemaNode instanceIdentifier = controllerContext + InstanceIdentifierContext instanceIdentifier = controllerContext .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class/student/name"); assertEquals( "[(urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)class, (urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)student[{(urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)name=name}]]", @@ -129,7 +130,7 @@ public class URITest { @Test public void testMountPointWithoutExternModul() throws FileNotFoundException { initMountService(true); - InstanceIdWithSchemaNode instanceIdentifier = controllerContext + InstanceIdentifierContext instanceIdentifier = controllerContext .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/"); assertTrue(Iterables.isEmpty(instanceIdentifier.getInstanceIdentifier().getPathArguments())); } @@ -139,7 +140,7 @@ public class URITest { exception.expect(RestconfDocumentedException.class); controllerContext.setMountService(null); - InstanceIdWithSchemaNode instanceIdentifier = controllerContext + InstanceIdentifierContext instanceIdentifier = controllerContext .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class/student/name"); } @@ -148,12 +149,12 @@ public class URITest { initMountService(false); exception.expect(RestconfDocumentedException.class); - InstanceIdWithSchemaNode instanceIdentifier = controllerContext + InstanceIdentifierContext instanceIdentifier = controllerContext .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class"); } public void initMountService(final boolean withSchema) { - MountService mountService = mock(MountService.class); + DOMMountPointService mountService = mock(DOMMountPointService.class); controllerContext.setMountService(mountService); BrokerFacade brokerFacade = mock(BrokerFacade.class); RestconfImpl restconfImpl = RestconfImpl.getInstance(); @@ -162,12 +163,12 @@ public class URITest { Set modules2 = TestUtils.loadModulesFrom("/test-config-data/yang2"); SchemaContext schemaContext2 = TestUtils.loadSchemaContext(modules2); - MountInstance mountInstance = mock(MountInstance.class); + DOMMountPoint mountInstance = mock(DOMMountPoint.class); if (withSchema) { when(mountInstance.getSchemaContext()).thenReturn(schemaContext2); } else { when(mountInstance.getSchemaContext()).thenReturn(null); } - when(mountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance); + when(mountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(Optional.of(mountInstance)); } }