aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common/src/test/java
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-11-20 20:56:44 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-11-20 20:56:44 -0500
commitba40eeb0df65eba18fa150c8736f6cc084508d4b (patch)
treeb8f0b906a8677a22a931391ea9db2416fccfccb2 /mso-api-handlers/mso-api-handler-common/src/test/java
parentdf2db9f4a7c3fccc5f617792a057d8dbc6bf9d34 (diff)
vnf and vf module replace requests to make
Added cloudConfiguration when not sent in replace request Added robot test for vfModule request with no cloud config Started adding unit tests for ServiceInstances Added unit tests for BpmnRequestBuilder changes Added ServiceInstances tests to test replace without CloudConfig Removed unused wiremock stubbings from test Added check for replaceInstanceRetainAssignments action Added action to common package to fix failing robot tests Removed new test, updated existing vfModule replace Added jackson annotations to RequestError object Fixed failing unit tests apih common Issue-ID: SO-2523 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I9470a0a9c7e356ef98ceb7269e066e79e0afb074
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/test/java')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java54
2 files changed, 0 insertions, 55 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
index 421136d402..1aa6c3c5d9 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
@@ -77,7 +77,6 @@ public class RequestIdFilterTest {
serviceException.setMessageId("SVC0002");
serviceException.setText(
"RequestId: 32807a28-1a14-4b88-b7b3-2950918aa769 already exists in the RequestDB InfraActiveRequests table");
- serviceException.setVariables(Collections.emptyList());
requestError.setServiceException(serviceException);
return requestError;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java
index 2922aaa896..1a846da65a 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapperTest.java
@@ -73,26 +73,6 @@ public class ApiExceptionMapperTest {
@InjectMocks
ApiExceptionMapper mapper = new ApiExceptionMapper();
-
- @Before
- public void setUp() {
- when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE));
- }
-
- @Test
- public void testObjectMapperError() throws JsonProcessingException {
- ObjectMapper mockedMapper = Mockito.mock(ObjectMapper.class);
- Mockito.when(mockedMapper.writeValueAsString(anyObject())).thenThrow(JsonProcessingException.class);
- ValidateException validateException = new ValidateException.Builder("Test", 0, null).build();
- ApiExceptionMapper mockedException = Mockito.spy(mapper);
- Mockito.doReturn(mockedMapper).when(mockedException).createObjectMapper();
- Response resp = mockedException.toResponse((ApiException) validateException);
-
- /// assertEquals(resp.getStatus(), HttpStatus.SC_BAD_REQUEST);
- assertThat(resp.getEntity().toString(),
- startsWith("Exception in buildServiceErrorResponse writing exceptionType to string"));
- }
-
@Test
public void testValidateResponse() {
ValidateException validateException =
@@ -138,38 +118,4 @@ public class ApiExceptionMapperTest {
assertEquals(resp.getStatus(), HttpStatus.SC_BAD_GATEWAY);
}
-
- @Test
- public void verifyXMLPath() throws JAXBException {
- when(headers.getAcceptableMediaTypes()).thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE));
- BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
- ErrorNumbers.SVC_BAD_PARAMETER).build();
- ApiExceptionMapper mapperSpy = Mockito.spy(mapper);
- doReturn(marshaller).when(mapperSpy).getMarshaller();
- Response resp = mapperSpy.toResponse((ApiException) bpmnException);
- verify(marshaller, times(1)).marshal(any(Object.class), any(Writer.class));
- }
-
- @Test
- public void verifyMediaType() {
- ApiExceptionMapper mapperSpy = Mockito.spy(mapper);
- BPMNFailureException bpmnException = new BPMNFailureException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,
- ErrorNumbers.SVC_BAD_PARAMETER).build();
- when(headers.getAcceptableMediaTypes())
- .thenReturn(Arrays.asList(MediaType.APPLICATION_XML_TYPE.withCharset("UTF-8")));
- mapperSpy.toResponse(bpmnException);
- verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),
- ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_XML_TYPE));
- when(headers.getAcceptableMediaTypes())
- .thenReturn(Arrays.asList(MediaType.APPLICATION_JSON_TYPE.withCharset("UTF-8")));
- mapperSpy = Mockito.spy(mapper);
- mapperSpy.toResponse(bpmnException);
- verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),
- ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_JSON_TYPE));
- when(headers.getAcceptableMediaTypes()).thenReturn(null);
- mapperSpy = Mockito.spy(mapper);
- mapperSpy.toResponse(bpmnException);
- verify(mapperSpy, times(1)).buildServiceErrorResponse(any(String.class), any(String.class),
- ArgumentMatchers.isNull(), eq(MediaType.APPLICATION_JSON_TYPE));
- }
}