diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-06-26 14:25:42 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-06-27 09:59:23 +0200 |
commit | 7734d5ca985fb0f47347d644a53b76b46da4cf41 (patch) | |
tree | 4c70aa069e593adf65e450279daf5fd59a35ef66 /aai-resources/src/test/java/org/onap | |
parent | 7e81b2d2cec80eaadc71de3a27ebca9b0865f43b (diff) |
Implement gremlin-based pagination in resources
- update Janusgraph to 0.5.0 + tinkerpop to 3.4.13
- leverage new pagination from aai-common that paginates in the graph, rather than the java code
- introduce new `includeTotalCount` parameter that allows disabling the total count for the page
- remove meaningless javadoc comments
Issue-ID: AAI-3901
Change-Id: Ifca45e524b54f4978b5269361184813f4cfe5461
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-resources/src/test/java/org/onap')
4 files changed, 32 insertions, 32 deletions
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java index e64ecc0..4c2a9f0 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessConsumerTest.java @@ -178,8 +178,8 @@ public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction { when(uriInfo.getPath()).thenReturn(uri); when(uriInfo.getPath(false)).thenReturn(uri); - Response response = legacyMoxyConsumer.getLegacy("", "-1", "-1", schemaVersions.getDefaultVersion().toString(), - uri, "all", "false", httpHeaders, uriInfo, new MockHttpServletRequest("GET", "http://www.test.com")); + Response response = legacyMoxyConsumer.getLegacy(schemaVersions.getDefaultVersion().toString(), uri, -1, -1, false, + "all", "false", httpHeaders, uriInfo, new MockHttpServletRequest("GET", "http://www.test.com")); assertNotNull(response, "Response from the legacy moxy consumer returned null"); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), @@ -199,7 +199,7 @@ public class BulkProcessConsumerTest extends BulkProcessorTestAbstraction { "Expected to return status created from the response"); queryParameters.add("depth", "10000"); - response = legacyMoxyConsumer.getLegacy("", "-1", "-1", schemaVersions.getDefaultVersion().toString(), uri, + response = legacyMoxyConsumer.getLegacy(schemaVersions.getDefaultVersion().toString(), uri, -1, -1, false, "all", "false", httpHeaders, uriInfo, new MockHttpServletRequest("GET", "http://www.test.com")); assertNotNull(response, "Response from the legacy moxy consumer returned null"); diff --git a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java index 1524f69..e54c8e5 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java @@ -155,8 +155,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(uriInfo.getPath(false)).thenReturn(uri); MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, - uri, "all", "false", httpHeaders, uriInfo, mockReqGet); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, + false, "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); @@ -173,7 +173,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { queryParameters.add("depth", "10000"); - response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, uri, + response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, false, "10000", "false", httpHeaders, uriInfo, mockReqGet); code = response.getStatus(); @@ -203,7 +203,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); - response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, uri, + response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, false, "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); @@ -222,8 +222,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(uriInfo.getPath(false)).thenReturn(uri); MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", "1", "10", defaultSchemaVersion, - uri, "all", "false", httpHeaders, uriInfo, mockReqGet); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, 1, 10, true, + "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); } @@ -330,7 +330,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), code); logger.info("Response Code: " + code + "\tEntity: " + response.getEntity()); mockReq = new MockHttpServletRequest("GET", uri); - response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, uri, + response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, false, "all", "false", httpHeaders, uriInfo, mockReq); assertNotNull(response, "Response from the legacy moxy consumer returned null"); @@ -372,7 +372,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), code); mockReq = new MockHttpServletRequest("GET", uri); - response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, uri, + response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, false, "all", "false", httpHeaders, uriInfo, mockReq); assertNotNull(response, "Response from the legacy moxy consumer returned null"); @@ -408,8 +408,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(uriInfo.getPath(false)).thenReturn(uri); MockHttpServletRequest mockReq = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, - uri, "all", "false", httpHeaders, uriInfo, mockReq); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, + false, "all", "false", httpHeaders, uriInfo, mockReq); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); mockReq = new MockHttpServletRequest("PUT", uri); @@ -449,8 +449,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); when(mockRequest.getRequestURL()).thenReturn(new StringBuffer(String.format("https://localhost:8447/aai/%s/", defaultSchemaVersion) + uri)); - Response response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, - uri, "all", "false", httpHeaders, uriInfo, mockRequest); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, + false, "all", "false", httpHeaders, uriInfo, mockRequest); assertNotNull(response, "Response from the legacy moxy consumer returned null"); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), @@ -470,7 +470,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { "Expected to return status created from the response"); queryParameters.add("depth", "10000"); - response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, uri, + response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, false, "all", "false", httpHeaders, uriInfo, mockRequest); assertNotNull(response, "Response from the legacy moxy consumer returned null"); @@ -585,8 +585,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap); MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, - uri, "all", "false", httpHeaders, uriInfo, mockReqGet); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, + false, "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus()); } @@ -605,8 +605,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(httpHeaders.getRequestHeaders()).thenReturn(headersMultiMap); MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, - uri, "all", "false", httpHeaders, uriInfo, mockReqGet); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, uri, -1, -1, + false, "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); } @@ -649,8 +649,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); when(mockRequest.getRequestURL()) .thenReturn(new StringBuffer(String.format("https://localhost:8447/aai/%s/", defaultSchemaVersion) + getRelationshipUri)); - response = legacyMoxyConsumer.getRelationshipList("1", "1", defaultSchemaVersion, - getRelationshipUri, "false", httpHeaders, mockRequest, uriInfo); + response = legacyMoxyConsumer.getRelationshipList(defaultSchemaVersion, + getRelationshipUri, 1,1, false, "false", httpHeaders, mockRequest, uriInfo); code = response.getStatus(); if (!VALID_HTTP_STATUS_CODES.contains(code)) { @@ -702,8 +702,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); when(mockRequest.getRequestURL()) .thenReturn(new StringBuffer(String.format("https://localhost:8447/aai/%s/", defaultSchemaVersion) + getRelationshipUri)); - response = legacyMoxyConsumer.getRelationshipList("1", "1", defaultSchemaVersion, - getRelationshipUri, "false", httpHeaders, mockRequest, uriInfo); + response = legacyMoxyConsumer.getRelationshipList(defaultSchemaVersion, + getRelationshipUri, 1, 1, false, "false", httpHeaders, mockRequest, uriInfo); queryParameters.remove("format"); code = response.getStatus(); @@ -767,8 +767,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(mockRequest.getRequestURL()) .thenReturn(new StringBuffer(String.format("https://localhost:8447/aai/%s/", defaultSchemaVersion) + getRelationshipUri)); Response response = - legacyMoxyConsumer.getRelationshipList("1", "1", defaultSchemaVersion, - getRelationshipUri, "false", httpHeaders, mockRequest, uriInfo); + legacyMoxyConsumer.getRelationshipList(defaultSchemaVersion, + getRelationshipUri, 1, 1, false, "false", httpHeaders, mockRequest, uriInfo); int code = response.getStatus(); if (!VALID_HTTP_STATUS_CODES.contains(code)) { @@ -1139,8 +1139,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { private Response getMockResponse(String mockUri) throws IOException, JSONException { MockHttpServletRequest mockReq = new MockHttpServletRequest("GET", mockUri); - Response response = legacyMoxyConsumer.getLegacy("", null, null, defaultSchemaVersion, - mockUri, "10000", "false", httpHeaders, uriInfo, mockReq); + Response response = legacyMoxyConsumer.getLegacy(defaultSchemaVersion, mockUri, -1, -1, + false, "10000", "false", httpHeaders, uriInfo, mockReq); String responseEntity = response.getEntity().toString(); int code = response.getStatus(); if (!VALID_HTTP_STATUS_CODES.contains(code)) { diff --git a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java index b04ba21..2e6d49e 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java @@ -139,8 +139,8 @@ public class URLFromVertexIdConsumerTest extends AAISetup { when(uriInfo.getPath(false)).thenReturn(uri); MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", "-1", "-1", schemaVersions.getDefaultVersion().toString(), - uri, "all", "false", httpHeaders, uriInfo, mockReqGet); + Response response = legacyMoxyConsumer.getLegacy(schemaVersions.getDefaultVersion().toString(), uri, -1, -1, false, + "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", uri); diff --git a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java index 0f56348..ce9a423 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java @@ -139,8 +139,8 @@ public class VertexIdConsumerTest extends AAISetup { when(uriInfo.getPath(false)).thenReturn(uri); MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); - Response response = legacyMoxyConsumer.getLegacy("", "-1", "-1", schemaVersions.getDefaultVersion().toString(), - uri, "all", "false", httpHeaders, uriInfo, mockReqGet); + Response response = legacyMoxyConsumer.getLegacy(schemaVersions.getDefaultVersion().toString(), uri, -1, -1, + false, "all", "false", httpHeaders, uriInfo, mockReqGet); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", uri); |