diff options
author | LaMont, William (wl2432) <wl2432@att.com> | 2020-06-26 17:24:51 -0400 |
---|---|---|
committer | LaMont, William (wl2432) <wl2432@att.com> | 2020-06-26 17:25:39 -0400 |
commit | 9666d712661e58fa4918f9c49d03fde6f4434e07 (patch) | |
tree | 575ea35b8ae09ec5a07acf5af212fe4fa91f94f3 /aai-resources/src/test/java | |
parent | 486d7f22a047b1465abc5a1365560ebf44c0e589 (diff) |
support for v20
Issue-ID: AAI-2965
Change-Id: I87737d2cfcf6b499af6083c2355042d66278e73c
Signed-off-by: LaMont, William (wl2432) <wl2432@att.com>
Diffstat (limited to 'aai-resources/src/test/java')
-rw-r--r-- | aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java | 23 |
1 files changed, 18 insertions, 5 deletions
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 748b032..84ac1a8 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 @@ -43,14 +43,17 @@ import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.annotation.DirtiesContext; +import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.*; import java.io.IOException; import java.util.*; import static org.junit.Assert.*; import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +// TODO: Change the following test to use spring boot public class LegacyMoxyConsumerTest extends AAISetup { protected static final MediaType APPLICATION_JSON = MediaType.valueOf("application/json"); @@ -594,7 +597,9 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(uriInfo.getPath()).thenReturn(uri); when(uriInfo.getPath(false)).thenReturn(uri); - MockHttpServletRequest mockReqGet = new MockHttpServletRequest("GET", uri); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + uri)); + Response response = legacyMoxyConsumer.getLegacy( "", null, @@ -605,21 +610,20 @@ public class LegacyMoxyConsumerTest extends AAISetup { "false", httpHeaders, uriInfo, - mockReqGet + mockRequest ); assertNotNull("Response from the legacy moxy consumer returned null", response); assertEquals("Expected to not have the data already in memory", Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); - MockHttpServletRequest mockReq = new MockHttpServletRequest("PUT", uri); response = legacyMoxyConsumer.update( payload, schemaVersions.getDefaultVersion().toString(), uri, httpHeaders, uriInfo, - mockReq + mockRequest ); assertNotNull("Response from the legacy moxy consumer returned null", response); @@ -641,7 +645,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { "false", httpHeaders, uriInfo, - mockReqGet + mockRequest ); assertNotNull("Response from the legacy moxy consumer returned null", response); @@ -838,6 +842,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { "cloud-infrastructure/pservers/pserver/%s/relationship-list", hostname); String getRelationshipUri = String.format( "cloud-infrastructure/pservers/pserver/%s", hostname); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + getRelationshipUri)); response = legacyMoxyConsumer.getRelationshipList( "1", "1", @@ -845,6 +851,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { getRelationshipUri, "false", httpHeaders, + mockRequest, uriInfo ); @@ -902,6 +909,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { String getRelationshipUri = String.format( "cloud-infrastructure/pservers/pserver/%s", hostname); queryParameters.add("format", "resource"); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + getRelationshipUri)); response = legacyMoxyConsumer.getRelationshipList( "1", "1", @@ -909,6 +918,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { getRelationshipUri, "false", httpHeaders, + mockRequest, uriInfo ); queryParameters.remove("format"); @@ -971,6 +981,8 @@ public class LegacyMoxyConsumerTest extends AAISetup { String getRelationshipUri = String.format( "cloud-infrastructure/pservers/pserver/%s", hostname); MockHttpServletRequest mockReq = new MockHttpServletRequest("GET_RELATIONSHIP", getRelationshipMockRequestUri); + HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class); + when(mockRequest.getRequestURL()).thenReturn(new StringBuffer("https://localhost:8447/aai/v15/" + getRelationshipUri)); Response response = legacyMoxyConsumer.getRelationshipList( "1", "1", @@ -978,6 +990,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { getRelationshipUri, "false", httpHeaders, + mockRequest, uriInfo ); |