X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Fsal-rest-docgen%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fdoc%2Fimpl%2FMountPointSwaggerTest.java;h=2ee9a9025587f00e09b9fb6fb67eab40eaae6dc8;hb=2295d50e7212d80a9bc752f655fa66790ad45022;hp=06f5c819e83c6b197105e49b5de030f8a8c9b973;hpb=a6f1b61b47399cecb32769e501fbaa83e4546ef9;p=netconf.git diff --git a/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java b/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java index 06f5c819e8..2ee9a90255 100644 --- a/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java +++ b/restconf/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java @@ -11,6 +11,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import com.google.common.base.Optional; import java.net.URISyntaxException; import java.util.Arrays; @@ -36,11 +37,11 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class MountPointSwaggerTest { private static final String HTTP_URL = "http://localhost/path"; - private static final YangInstanceIdentifier instanceId = YangInstanceIdentifier.builder() - .node(QName.create("nodes")) - .node(QName.create("node")) - .nodeWithKey(QName.create("node"), QName.create("id"), "123").build(); - private static final String INSTANCE_URL = "nodes/node/123/"; + private static final YangInstanceIdentifier INSTANCE_ID = YangInstanceIdentifier.builder() + .node(QName.create("", "nodes")) + .node(QName.create("", "node")) + .nodeWithKey(QName.create("", "node"), QName.create("", "id"), "123").build(); + private static final String INSTANCE_URL = "/nodes/node/123/"; private MountPointSwagger swagger; private DocGenTestHelper helper; private SchemaContext schemaContext; @@ -65,14 +66,14 @@ public class MountPointSwaggerTest { final UriInfo mockInfo = setUpSwaggerForDocGeneration(); assertEquals(0, this.swagger.getInstanceIdentifiers().size()); - this.swagger.onMountPointCreated(instanceId); // add this ID into the list of + this.swagger.onMountPointCreated(INSTANCE_ID); // add this ID into the list of // mount points assertEquals(1, this.swagger.getInstanceIdentifiers().size()); assertEquals((Long) 1L, this.swagger.getInstanceIdentifiers().entrySet().iterator().next() .getValue()); assertEquals(INSTANCE_URL, this.swagger.getInstanceIdentifiers().entrySet().iterator().next() .getKey()); - this.swagger.onMountPointRemoved(instanceId); // remove ID from list of mount + this.swagger.onMountPointRemoved(INSTANCE_ID); // remove ID from list of mount // points assertEquals(0, this.swagger.getInstanceIdentifiers().size()); } @@ -80,7 +81,7 @@ public class MountPointSwaggerTest { @Test public void testGetResourceListGoodId() throws Exception { final UriInfo mockInfo = setUpSwaggerForDocGeneration(); - this.swagger.onMountPointCreated(instanceId); // add this ID into the list of + this.swagger.onMountPointCreated(INSTANCE_ID); // add this ID into the list of // mount points final ResourceList resourceList = this.swagger.getResourceList(mockInfo, 1L); @@ -96,8 +97,9 @@ public class MountPointSwaggerTest { @Test public void testGetDataStoreApi() throws Exception { final UriInfo mockInfo = setUpSwaggerForDocGeneration(); - this.swagger.onMountPointCreated(instanceId); // add this ID into the list of + this.swagger.onMountPointCreated(INSTANCE_ID); // add this ID into the list of // mount points + final ApiDeclaration mountPointApi = this.swagger.getMountPointApi(mockInfo, 1L, "Datastores", "-"); assertNotNull("failed to find Datastore API", mountPointApi); final List apis = mountPointApi.getApis(); @@ -114,9 +116,9 @@ public class MountPointSwaggerTest { .getNotes()); } final Set expectedApis = new TreeSet<>(Arrays.asList(new String[] { - "/config/" + INSTANCE_URL + "yang-ext:mount/", - "/operational/" + INSTANCE_URL + "yang-ext:mount/", - "/operations/" + INSTANCE_URL + "yang-ext:mount/", })); + "/config" + INSTANCE_URL + "yang-ext:mount", + "/operational" + INSTANCE_URL + "yang-ext:mount", + "/operations" + INSTANCE_URL + "yang-ext:mount",})); assertEquals(expectedApis, actualApis); } @@ -132,7 +134,7 @@ public class MountPointSwaggerTest { when(mountPoint.getSchemaContext()).thenReturn(context); final DOMMountPointService service = mock(DOMMountPointService.class); - when(service.getMountPoint(instanceId)).thenReturn(Optional.of(mountPoint)); + when(service.getMountPoint(INSTANCE_ID)).thenReturn(Optional.of(mountPoint)); this.swagger.setMountService(service); this.swagger.setGlobalSchema(schemaService);