diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-08-30 19:06:46 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-08-31 10:35:31 -0400 |
commit | b92b1f86492d1fb0e546ef5124116abdf2d07dc9 (patch) | |
tree | f57ba276175711fd1a180ee7978d5ab464220711 /mso-api-handlers/mso-api-handler-infra/src/test/java | |
parent | 138f17fce465cdabb928525983323319162f20d2 (diff) |
Update Logging
Add CXF interceptor for SOAP based logging
Clean up extra logging statements
Add UT to ensure MDC properly populated
Change package name on Jax-RS Filter to be more accurate
Issue-ID: SO-947
Change-Id: I3a2afc58de3bf370675658ce3d19cf899b90def7
Change-Id: I3a2afc58de3bf370675658ce3d19cf899b90def7
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java')
2 files changed, 8 insertions, 6 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 5b37d772c6..76f4bb08a2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -29,6 +29,7 @@ import com.github.tomakehurst.wiremock.http.Fault; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -1934,7 +1935,7 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void invalidRequestId() throws IOException { String illegalRequestId = "1234"; - headers.set("X-ECOMP-RequestID", illegalRequestId); + headers.set(ONAPLogConstants.Headers.REQUEST_ID, illegalRequestId); uri = servInstanceuri + "v5/serviceInstances"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 0ace9d5445..585eff23c4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertThat; - +import java.util.UUID; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.http.HttpStatus; @@ -107,22 +107,23 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ .errorInfo(errorLoggerInfo).build(); InfraActiveRequests iar = new InfraActiveRequests(); - iar.setRequestId("123"); + String uuid = UUID.randomUUID().toString(); + iar.setRequestId(uuid); iar.setOperationalEnvName("myOpEnv"); iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/123")) + stubFor(get(urlPathEqualTo("/infraActiveRequests/"+uuid)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/infraActiveRequests/")) - .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message: empty")) + .withRequestBody(containing("{\"requestId\":\""+uuid+ "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message:")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); try { - createEcompOpEn.execute("123", getCloudOrchestrationRequest()); + createEcompOpEn.execute(uuid, getCloudOrchestrationRequest()); }catch(ApiException e){ assertThat(e, sameBeanAs((ApiException) expectedException).ignoring("cause")); } |