summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java6
-rw-r--r--adapters/mso-openstack-adapters/pom.xml5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java44
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java15
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java8
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml10
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java12
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java3
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java4
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java23
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java)74
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java (renamed from bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java60
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java)34
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java63
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java)0
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn211
-rw-r--r--common/pom.xml16
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java55
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java10
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java2
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java163
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java (renamed from common/src/main/java/org/onap/so/client/policy/LoggingFilter.java)14
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java15
-rw-r--r--common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java331
-rw-r--r--common/src/test/java/org/onap/so/client/grm/GRMClientTest.java118
-rw-r--r--common/src/test/resources/logback-test.xml189
-rw-r--r--common/src/test/resources/mso-bad.json20
-rw-r--r--common/src/test/resources/mso.json21
-rw-r--r--common/src/test/resources/mso.properties28
-rw-r--r--common/src/test/resources/mso2.json20
-rw-r--r--common/src/test/resources/mso2.properties22
-rw-r--r--cxf-logging/.gitignore2
-rw-r--r--cxf-logging/pom.xml66
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java (renamed from common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java)18
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java (renamed from common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java)20
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java53
-rw-r--r--cxf-logging/src/test/resources/logback-test.xml75
-rw-r--r--mso-api-handlers/mso-api-handler-common/pom.xml14
-rw-r--r--mso-catalog-db/pom.xml14
-rw-r--r--pom.xml5
55 files changed, 749 insertions, 1179 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java
index d52e714f70..1f4b872ab9 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -38,7 +40,9 @@ public class CreateTenantRequest extends TenantRequestCommon {
private Map<String,String> metadata = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
- public CreateTenantRequest() {}
+ public CreateTenantRequest() {
+ //empty constructor
+ }
public String getCloudSiteId() {
return cloudSiteId;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java
index a39b7164e2..b2d521b050 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -34,7 +36,9 @@ public class DeleteTenantRequest extends TenantRequestCommon {
private MsoRequest msoRequest = new MsoRequest();
- public DeleteTenantRequest() {}
+ public DeleteTenantRequest() {
+ //empty constructor
+ }
public String getCloudSiteId() {
return cloudSiteId;
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 01c1df304e..fb104fcab3 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -272,5 +272,10 @@
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>cxf-logging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 2b21381041..996e2c2712 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -86,13 +86,7 @@ public class CXFConfiguration {
private MsoVnfCloudifyAdapterImpl vnfCloudifyAdapterImpl;
@Autowired
private JettisonStyleMapperProvider jettisonStyleObjectMapper;
-
- @Autowired
- private SOAPLoggingInInterceptor soapInInterceptor;
-
- @Autowired
- private SOAPLoggingOutInterceptor soapOutInterceptor;
-
+
@Bean(name=Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
@@ -114,9 +108,9 @@ public class CXFConfiguration {
EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterImpl);
endpoint.publish("/NetworkAdapter");
endpoint.setWsdlLocation("NetworkAdapter.wsdl");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
@@ -125,9 +119,9 @@ public class CXFConfiguration {
EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterAsyncImpl);
endpoint.publish("/NetworkAdapterAsync");
endpoint.setWsdlLocation("NetworkAdapterAsync.wsdl");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
@@ -139,9 +133,9 @@ public class CXFConfiguration {
EndpointImpl endpoint = new EndpointImpl(springBus(), tenantAdapterImpl);
endpoint.publish("/TenantAdapter");
endpoint.setWsdlLocation("TenantAdapter.wsdl");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
@@ -155,9 +149,9 @@ public class CXFConfiguration {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterImpl);
endpoint.publish("/VnfAdapter");
endpoint.setWsdlLocation("VnfAdapter.wsdl");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
@@ -166,9 +160,9 @@ public class CXFConfiguration {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl);
endpoint.publish("/VnfAsyncAdapter");
endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
@@ -177,9 +171,9 @@ public class CXFConfiguration {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl);
endpoint.publish("/VnfCloudifyAdapterImpl");
endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
index 6b194ec664..41544c8104 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
@@ -142,14 +142,7 @@ public class TenantAdapterRest {
hrollback);
newTenantId = htenant.value;
tenantRollback = hrollback.value;
-// TenantAdapterCore TAImpl = new TenantAdapterCore();
-// newTenantId = TAImpl.createTenant (req.getCloudSiteId(),
-// req.getTenantName(),
-// req.getFailIfExists(),
-// req.getBackout(),
-// req.getMetadata(),
-// req.getMsoRequest(),
-// tenantRollback);
+
}
catch (TenantAlreadyExists tae) {
LOGGER.debug(EXCEPTION,tae);
@@ -276,9 +269,7 @@ public class TenantAdapterRest {
metadata
);
tenant = new MsoTenant(htenant.value, tenantName.value, metadata.value);
-// TenantAdapterCore TAImpl = new TenantAdapterCore();
-// MsoRequest msoReq = new MsoRequest();
-// tenant = TAImpl.queryTenant (cloudSiteId, tenantId, msoReq);
+
}
catch (TenantException te) {
LOGGER.debug(EXCEPTION,te);
@@ -321,7 +312,7 @@ public class TenantAdapterRest {
@ApiResponse(code = 500, message = "rollback tenant failed") })
public Response rollbackTenant(
@ApiParam(value = "rollback, command action", required = true)
- @QueryParam("rollback") String action, // WTF?
+ @QueryParam("rollback") String action,
@ApiParam(value = "RollbackTenantRequest", required = true)
RollbackTenantRequest req)
{
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
index 3e3c6754dc..08fcdc13fe 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
@@ -112,7 +112,7 @@ public class ValetClient {
String body = mapper.writeValueAsString(vcr);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
- LOGGER.debug("valet create req: " + uri.toString() + HEADERS + headers.toString() + BODY + body.toString());
+ LOGGER.debug("valet create req: " + uri.toString() + HEADERS + headers.toString() + BODY + body);
response = restTemplate.exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class);
gvr = this.getGVRFromResponse(response);
@@ -140,7 +140,7 @@ public class ValetClient {
String body = mapper.writeValueAsString(vur);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
- LOGGER.debug("valet update req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body.toString());
+ LOGGER.debug("valet update req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body);
response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class);
gvr = this.getGVRFromResponse(response);
@@ -167,7 +167,7 @@ public class ValetClient {
String body = mapper.writeValueAsString(vdr);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
- LOGGER.debug("valet delete req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body.toString());
+ LOGGER.debug("valet delete req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body);
response = restTemplate.exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class);
gvr = this.getGVRFromResponse(response);
@@ -221,7 +221,7 @@ public class ValetClient {
String body = mapper.writeValueAsString(vrr);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
- LOGGER.debug("valet rollback req: " + uri.toString() + HEADERS + headers.toString() + BODY + body.toString());
+ LOGGER.debug("valet rollback req: " + uri.toString() + HEADERS + headers.toString() + BODY + body);
response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class);
gvr = this.getGVRFromResponse(response);
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 934e2a544f..955a4d81fa 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -72,11 +72,6 @@
<optional>true</optional>
</dependency>
<dependency>
- <groupId>janino</groupId>
- <artifactId>janino</artifactId>
- <version>2.5.15</version>
- </dependency>
- <dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>
<version>2.2.3</version>
@@ -110,6 +105,11 @@
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.0.5</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>cxf-logging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
index 0404c10760..23a769bc21 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java
@@ -45,12 +45,6 @@ public class CXFConfiguration {
@Autowired
private MsoRequestsDbAdapter requestDbAdapterImpl;
- @Autowired
- private SOAPLoggingInInterceptor soapInInterceptor;
-
- @Autowired
- private SOAPLoggingOutInterceptor soapOutInterceptor;
-
@Bean
public ServletRegistrationBean cxfServlet() {
@@ -65,9 +59,9 @@ public class CXFConfiguration {
logFeature.setPrettyLogging(true);
logFeature.initialize(bus);
endpoint.getFeatures().add(logFeature);
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
index 159eb015de..4e00ced841 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
@@ -58,7 +58,7 @@ public class HealthCheckHandlerTest {
@Test
public void testHealthcheck() throws JSONException {
-
+ TestAppender.events.clear();
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
ResponseEntity<String> response = restTemplate.exchange(
@@ -87,6 +87,7 @@ public class HealthCheckHandlerTest {
assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
}
+ TestAppender.events.clear();
}
private String createURLWithPort(String uri) {
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 0337c2613e..7723ffa691 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -150,11 +150,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>janino</groupId>
- <artifactId>janino</artifactId>
- <version>2.5.15</version>
- </dependency>
- <dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-spring-legacy</artifactId>
<version>1.0.5</version>
@@ -164,5 +159,10 @@
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.0.5</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>cxf-logging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
index f6fd8d5f0d..766a48a3c4 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
@@ -64,15 +64,10 @@ public class CXFConfiguration {
@Autowired
private SNIROResponse sniroResponse;
-
- @Autowired
- private SOAPLoggingInInterceptor soapInInterceptor;
-
- @Autowired
- private SOAPLoggingOutInterceptor soapOutInterceptor;
@Autowired
private ObjectMapper mapper;
+
@Bean
public Server rsServer() {
endpoint = new JAXRSServerFactoryBean();
@@ -93,9 +88,9 @@ public class CXFConfiguration {
@Bean
public Endpoint sndcAdapter() {
EndpointImpl wsdlEndpoint = new EndpointImpl(bus, sdncAdapterPortImpl);
- wsdlEndpoint.getInInterceptors().add(soapInInterceptor);
- wsdlEndpoint.getOutInterceptors().add(soapOutInterceptor);
- wsdlEndpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ wsdlEndpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ wsdlEndpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ wsdlEndpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
wsdlEndpoint.publish("/SDNCAdapter");
return wsdlEndpoint;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java
index 5ed9763b71..515f1980d4 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,8 +28,7 @@ import org.onap.so.logger.MsoLogger;
public class RequestTunables {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,RequestTunables.class);
-
+
public static final String GENERATED_KEY = "Generated key: ";
//criteria
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 72a23282d9..4c85241f9a 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -65,7 +67,7 @@ public class SNIROResponse {
String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
- if (bpUrl == null || bpUrl.equals("")) {
+ if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
MsoLogger.ErrorCode.DataError, "Missing config param");
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 151ba2c3aa..77e2fa27d3 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -201,5 +201,10 @@
<artifactId>so-bpmn-tasks</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>cxf-logging</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index 7721588570..62be1330b1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -78,12 +78,6 @@ public class CXFConfiguration {
@Autowired
private VnfAdapterNotify vnfAdapterNotifyServiceImpl;
- @Autowired
- private SOAPLoggingInInterceptor soapInInterceptor;
-
- @Autowired
- private SOAPLoggingOutInterceptor soapOutInterceptor;
-
@Bean
public ServletRegistrationBean cxfServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/mso/*");
@@ -93,9 +87,9 @@ public class CXFConfiguration {
public Endpoint vnfAdapterCallback() {
EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl);
endpoint.publish("/VNFAdaptercallback");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
@@ -103,9 +97,9 @@ public class CXFConfiguration {
public Endpoint sndcAdapterCallback() {
EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl);
endpoint.publish("/SDNCAdapterCallbackService");
- endpoint.getInInterceptors().add(soapInInterceptor);
- endpoint.getOutInterceptors().add(soapOutInterceptor);
- endpoint.getOutFaultInterceptors().add(soapOutInterceptor);
+ endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
+ endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
+ endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
index 7cb649d66e..201e791a24 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -20,38 +20,25 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
import java.io.IOException;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
public class AaiConnectionTestImpl implements AaiConnection {
- public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp";
- public static final String ID_WITH_IP_V6 = "idWithIpV6";
public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
- public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp";
- public static final String DEFAULT_IP = "1.2.3.4";
- public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329";
+ public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
private Map<String, Pnf> created = new HashMap<>();
@Override
public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
- if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) {
- Pnf pnf = new Pnf();
- pnf.setIpaddressV4Oam(DEFAULT_IP);
- return Optional.of(pnf);
- } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) {
- Pnf pnf = new Pnf();
- pnf.setIpaddressV6Oam(DEFAULT_IP_V6);
- return Optional.of(pnf);
- } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) {
+ if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
return Optional.empty();
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index b514c38d47..2348af5dec 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,33 +18,27 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.pnf.delegate.bpmn;
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import org.assertj.core.api.Assertions;
import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions;
import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl;
-import org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
@RunWith(SpringRunner.class)
@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml")
public class CreateAndActivatePnfResourceTest {
@@ -65,47 +59,25 @@ public class CreateAndActivatePnfResourceTest {
@Test
@Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
- public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception {
+ public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
aaiConnection.reset();
BpmnAwareTests.init(processEngineRule.getProcessEngine());
Map<String, Object> variables = new HashMap<>();
variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
- variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP);
- // when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", variables);
- // then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckAiiForCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "DoesAaiContainInfoAboutIp",
- "AaiEntryAlreadyUpToDate"
- );
- }
-
- @Test
- @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
- public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception {
- // given
- aaiConnection.reset();
- BpmnAwareTests.init(processEngineRule.getProcessEngine());
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
- variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP);
+ variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
- assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+ BpmnAwareAssertions.assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
dmaapClientTestImpl.sendMessage();
// then
- assertThat(instance).isEnded().hasPassedInOrder(
+ BpmnAwareAssertions.assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
+ "CheckInputs",
"CheckAiiForCorrelationId",
"DoesAaiContainInfoAboutPnf",
- "DoesAaiContainInfoAboutIp",
"AaiEntryExists",
"InformDmaapClient",
"WaitForDmaapPnfReadyNotification",
@@ -115,22 +87,23 @@ public class CreateAndActivatePnfResourceTest {
@Test
@Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
- public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception {
+ public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
aaiConnection.reset();
BpmnAwareTests.init(processEngineRule.getProcessEngine());
Map<String, Object> variables = new HashMap<>();
variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
- variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY);
+ variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
- assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+ BpmnAwareAssertions.assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
dmaapClientTestImpl.sendMessage();
// then
- assertThat(instance).isEnded().hasPassedInOrder(
+ BpmnAwareAssertions.assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
+ "CheckInputs",
"CheckAiiForCorrelationId",
"DoesAaiContainInfoAboutPnf",
"CreateAndActivatePnf_CreateAaiEntry",
@@ -139,11 +112,6 @@ public class CreateAndActivatePnfResourceTest {
"WaitForDmaapPnfReadyNotification",
"AaiEntryUpdated"
);
- assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY);
- }
-
- private List<HistoricVariableInstance> getVariables(ProcessInstance instance) {
- return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery()
- .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list();
+ Assertions.assertThat(aaiConnection.getCreated()).containsOnlyKeys(AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index f2a4205ebd..09fb2d4cd7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
+
import java.util.Objects;
public class DmaapClientTestImpl implements DmaapClient {
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 9bc9cc59a6..ad51b3f69e 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -317,5 +317,11 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter-test</artifactId>
+ <version>2.3.0</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
index 63db293a2e..12ddf8465e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
@@ -67,7 +67,6 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf());
- execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp());
} catch (IOException e) {
LOGGER.error("IOException",e);
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index e4866f5334..e4866f5334 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
new file mode 100644
index 0000000000..201e791a24
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+public class AaiConnectionTestImpl implements AaiConnection {
+
+ public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
+ public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
+
+ private Map<String, Pnf> created = new HashMap<>();
+
+ @Override
+ public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
+ return Optional.of(new Pnf());
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ @Override
+ public void createEntry(String correlationId, Pnf entry) throws IOException {
+ created.put(correlationId, entry);
+ }
+
+ public Map<String, Pnf> getCreated() {
+ return created;
+ }
+
+ public void reset() {
+ created.clear();
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
index 7df6757817..7df6757817 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
index 4282b0f2bb..4282b0f2bb 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
index 627e57bfb8..3eb3bd8796 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
@@ -27,10 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
@@ -41,9 +38,6 @@ import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.core.WorkflowException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
@RunWith(Enclosed.class)
public class CheckAaiForCorrelationIdDelegateTest {
@@ -81,36 +75,14 @@ public class CheckAaiForCorrelationIdDelegateTest {
}
@Test
- public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception {
- shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP);
- }
-
- @Test
- public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception {
- shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6);
- }
-
- private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception {
- // given
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(id);
- // when
- delegate.execute(execution);
- // then
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true);
- }
-
- @Test
public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
// when
delegate.execute(execution);
// then
verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false);
}
}
@@ -128,7 +100,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey");
// when, then
assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
index 465dc085fc..465dc085fc 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
new file mode 100644
index 0000000000..f2a4205ebd
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
+import java.util.Objects;
+
+public class DmaapClientTestImpl implements DmaapClient {
+
+ private String correlationId;
+ private Runnable informConsumer;
+
+ @Override
+ public void registerForUpdate(String correlationId, Runnable informConsumer) {
+ this.correlationId = correlationId;
+ this.informConsumer = informConsumer;
+ }
+
+ @Override
+ public Runnable unregister(String correlationId) {
+ if (Objects.equals(this.correlationId, correlationId)) {
+ this.correlationId = null;
+ Runnable informConsumer = this.informConsumer;
+ this.informConsumer = null;
+ return informConsumer;
+ }
+ return null;
+ }
+
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public Runnable getInformConsumer() {
+ return informConsumer;
+ }
+
+ public void sendMessage() {
+ informConsumer.run();
+ }
+
+ public boolean haveRegisteredConsumer() {
+ return correlationId != null;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
index ddf33a1d77..ddf33a1d77 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
index aab289fd90..aab289fd90 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 08ac9b6948..08ac9b6948 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
index 8f2bf67b71..89d66bfdb6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2">
<bpmn:collaboration id="Collaboration_1d0w8lf">
<bpmn:participant id="Participant_1egg397" name="SO&#10;Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" />
<bpmn:participant id="Participant_0atuyq0" name="AAI" />
@@ -23,56 +23,50 @@
<bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
<bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" />
<bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" />
- <bpmn:sequenceFlow id="SequenceFlow_1ls8pua" name="No" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryExists">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutIp}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="DoesAaiContainInfoAboutIp">
+ <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="AaiEntryExists">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1h6yz62" name="Yes" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryAlreadyUpToDate">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutIp}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
- <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception">
- <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming>
- <bpmn:errorEventDefinition errorRef="Error_1" />
- </bpmn:endEvent>
- <bpmn:endEvent id="AaiEntryAlreadyUpToDate" name="AAI entry already up-to-date">
- <bpmn:incoming>SequenceFlow_1h6yz62</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:startEvent id="CreateAndActivatePnf_StartEvent">
- <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing>
- </bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" />
- <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}">
- <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
+ <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}">
+ <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?">
- <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
- </bpmn:exclusiveGateway>
+ <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${cancelDmaapSubscription}">
+ <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}">
+ <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists">
+ <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
+ </bpmn:intermediateThrowEvent>
<bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${createAaiEntryWithPnfIdDelegate}">
<bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutIp" name="Does AAI contain info about IPv4 or IPv6?">
- <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1h6yz62</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1ls8pua</bpmn:outgoing>
+ <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?">
+ <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists, lacking IP">
- <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1ls8pua</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
- </bpmn:intermediateThrowEvent>
- <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}">
- <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing>
+ <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}">
+ <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:startEvent id="CreateAndActivatePnf_StartEvent">
+ <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception">
+ <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_1" />
+ </bpmn:endEvent>
+ <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
+ <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
+ </bpmn:endEvent>
<bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
<bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
@@ -83,21 +77,13 @@
<bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration>
</bpmn:timerEventDefinition>
</bpmn:boundaryEvent>
- <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${cancelDmaapSubscription}">
- <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}">
- <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing>
- </bpmn:serviceTask>
+ <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
- <bpmn:text><![CDATA[Inputs:
+ <bpmn:text>Inputs:
 - timeoutForPnfEntryNotification - String
- correlationId - String
-]]></bpmn:text>
+</bpmn:text>
</bpmn:textAnnotation>
- <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
</bpmn:process>
<bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
<bpmn:message id="Message_13h1tlo" name="WorkflowMessage" />
@@ -109,19 +95,13 @@
<bpmndi:BPMNShape id="ExclusiveGateway_1cttgdo_di" bpmnElement="DoesAaiContainInfoAboutPnf" isMarkerVisible="true">
<dc:Bounds x="390" y="182" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="372" y="283" width="85" height="20" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_0yamdfm_di" bpmnElement="DoesAaiContainInfoAboutIp" isMarkerVisible="true">
- <dc:Bounds x="682" y="41" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="663" y="5" width="87" height="30" />
+ <dc:Bounds x="372" y="283" width="85" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
<dc:Bounds x="1312" y="189" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1286" y="230" width="89" height="10" />
+ <dc:Bounds x="1287" y="230" width="88" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent">
@@ -137,51 +117,38 @@
<dc:Bounds x="511" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt">
- <di:waypoint xsi:type="dc:Point" x="319" y="207" />
- <di:waypoint xsi:type="dc:Point" x="390" y="207" />
+ <di:waypoint x="319" y="207" />
+ <di:waypoint x="390" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="309.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak">
- <di:waypoint xsi:type="dc:Point" x="415" y="207" />
- <di:waypoint xsi:type="dc:Point" x="415" y="66" />
- <di:waypoint xsi:type="dc:Point" x="682" y="66" />
+ <di:waypoint x="415" y="207" />
+ <di:waypoint x="415" y="66" />
+ <di:waypoint x="707" y="66" />
+ <di:waypoint x="707" y="189" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="430" y="180.1206896551724" width="19" height="10" />
+ <dc:Bounds x="430" y="180" width="19" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe">
- <di:waypoint xsi:type="dc:Point" x="440" y="207" />
- <di:waypoint xsi:type="dc:Point" x="511" y="207" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="447.32911392405055" y="210" width="15" height="10" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1h6yz62_di" bpmnElement="SequenceFlow_1h6yz62">
- <di:waypoint xsi:type="dc:Point" x="732" y="66" />
- <di:waypoint xsi:type="dc:Point" x="1312" y="66" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="742.7435064935065" y="51" width="19" height="10" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1ls8pua_di" bpmnElement="SequenceFlow_1ls8pua">
- <di:waypoint xsi:type="dc:Point" x="707" y="91" />
- <di:waypoint xsi:type="dc:Point" x="707" y="189" />
+ <di:waypoint x="440" y="207" />
+ <di:waypoint x="511" y="207" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="717" y="116.1917808219178" width="15" height="10" />
+ <dc:Bounds x="448" y="210" width="14" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf">
- <di:waypoint xsi:type="dc:Point" x="611" y="207" />
- <di:waypoint xsi:type="dc:Point" x="689" y="207" />
+ <di:waypoint x="611" y="207" />
+ <di:waypoint x="689" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="605" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1">
- <di:waypoint xsi:type="dc:Point" x="-18" y="207" />
- <di:waypoint xsi:type="dc:Point" x="48" y="207" />
+ <di:waypoint x="-18" y="207" />
+ <di:waypoint x="48" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-30" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -190,22 +157,22 @@
<dc:Bounds x="123" y="523" width="502" height="60" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88">
- <di:waypoint xsi:type="dc:Point" x="561" y="247" />
- <di:waypoint xsi:type="dc:Point" x="561" y="523" />
+ <di:waypoint x="561" y="247" />
+ <di:waypoint x="561" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="531" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a">
- <di:waypoint xsi:type="dc:Point" x="250" y="247" />
- <di:waypoint xsi:type="dc:Point" x="250" y="523" />
+ <di:waypoint x="250" y="247" />
+ <di:waypoint x="250" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="220" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t">
- <di:waypoint xsi:type="dc:Point" x="289" y="523" />
- <di:waypoint xsi:type="dc:Point" x="289" y="247" />
+ <di:waypoint x="289" y="523" />
+ <di:waypoint x="289" y="247" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -216,76 +183,70 @@
<bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException">
<dc:Bounds x="1312" y="345" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1305" y="382" width="70" height="20" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_00cy7r0_di" bpmnElement="AaiEntryAlreadyUpToDate">
- <dc:Bounds x="1312" y="48" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1288" y="89" width="85" height="20" />
+ <dc:Bounds x="1305" y="382" width="70" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0fjcdy4_di" bpmnElement="AaiEntryExists">
<dc:Bounds x="689" y="189" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="670" y="235" width="80" height="20" />
+ <dc:Bounds x="672" y="235" width="77" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8">
<dc:Bounds x="-37" y="70" width="243" height="54" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz">
- <di:waypoint xsi:type="dc:Point" x="-36" y="189" />
- <di:waypoint xsi:type="dc:Point" x="-36" y="124" />
+ <di:waypoint x="-36" y="189" />
+ <di:waypoint x="-36" y="124" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
- <di:waypoint xsi:type="dc:Point" x="1026" y="523" />
- <di:waypoint xsi:type="dc:Point" x="1026" y="247" />
+ <di:waypoint x="1060" y="523" />
+ <di:waypoint x="1060" y="247" />
<bpmndi:BPMNLabel>
<dc:Bounds x="996" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025">
- <di:waypoint xsi:type="dc:Point" x="725" y="207" />
- <di:waypoint xsi:type="dc:Point" x="803" y="207" />
+ <di:waypoint x="725" y="207" />
+ <di:waypoint x="803" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="719" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout">
- <dc:Bounds x="1040" y="229" width="36" height="36" />
+ <dc:Bounds x="1074" y="229" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1071" y="260" width="40" height="10" />
+ <dc:Bounds x="1117" y="240" width="40" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
- <di:waypoint xsi:type="dc:Point" x="1058" y="265" />
- <di:waypoint xsi:type="dc:Point" x="1058" y="363" />
- <di:waypoint xsi:type="dc:Point" x="1145" y="363" />
+ <di:waypoint x="1092" y="265" />
+ <di:waypoint x="1092" y="363" />
+ <di:waypoint x="1145" y="363" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1028" y="309" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification">
- <dc:Bounds x="974" y="167" width="100" height="80" />
+ <dc:Bounds x="1008" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
- <di:waypoint xsi:type="dc:Point" x="1074" y="207" />
- <di:waypoint xsi:type="dc:Point" x="1312" y="207" />
+ <di:waypoint x="1108" y="207" />
+ <di:waypoint x="1312" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1148" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e">
- <di:waypoint xsi:type="dc:Point" x="903" y="207" />
- <di:waypoint xsi:type="dc:Point" x="974" y="207" />
+ <di:waypoint x="903" y="207" />
+ <di:waypoint x="1008" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="893.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9">
- <di:waypoint xsi:type="dc:Point" x="853" y="247" />
- <di:waypoint xsi:type="dc:Point" x="853" y="523" />
+ <di:waypoint x="853" y="247" />
+ <di:waypoint x="853" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="823" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -294,15 +255,15 @@
<dc:Bounds x="803" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe">
- <di:waypoint xsi:type="dc:Point" x="1245" y="363" />
- <di:waypoint xsi:type="dc:Point" x="1312" y="363" />
+ <di:waypoint x="1245" y="363" />
+ <di:waypoint x="1312" y="363" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1233.5" y="343" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr">
- <di:waypoint xsi:type="dc:Point" x="1195" y="403" />
- <di:waypoint xsi:type="dc:Point" x="1195" y="523" />
+ <di:waypoint x="1195" y="403" />
+ <di:waypoint x="1195" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1165" y="458" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -311,8 +272,8 @@
<dc:Bounds x="1145" y="323" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0967g8p_di" bpmnElement="SequenceFlow_0967g8p">
- <di:waypoint xsi:type="dc:Point" x="148" y="207" />
- <di:waypoint xsi:type="dc:Point" x="219" y="207" />
+ <di:waypoint x="148" y="207" />
+ <di:waypoint x="219" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="183.5" y="187" width="0" height="10" />
</bpmndi:BPMNLabel>
diff --git a/common/pom.xml b/common/pom.xml
index 490f2c782e..d3f460e563 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -102,16 +102,7 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-bindings-soap</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>${cxf.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>com.shazam</groupId>
@@ -148,11 +139,6 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>janino</groupId>
- <artifactId>janino</artifactId>
- <version>2.5.15</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index cb8e1f0a91..007c666ac2 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -36,7 +36,6 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
-
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation.Builder;
@@ -46,29 +45,28 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.client.policy.CommonObjectMapperProvider;
-import org.onap.so.client.policy.LoggingFilter;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.logging.jaxrs.filter.JaxRsClientLogging;
+import org.onap.so.logging.jaxrs.filter.PayloadLoggingFilter;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
-import org.slf4j.MDC;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
-
import net.jodah.failsafe.Failsafe;
import net.jodah.failsafe.RetryPolicy;
public abstract class RestClient {
- public static final String ECOMP_COMPONENT_NAME = "MSO";
+ private static final String APPLICATION_MERGE_PATCH_JSON = "application/merge-patch+json";
+
+ public static final String ECOMP_COMPONENT_NAME = "MSO";
private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
private WebTarget webTarget;
protected final Map<String, String> headerMap;
- protected final MsoLogger msoLogger;
+ protected final Logger logger = LoggerFactory.getLogger(RestClient.class);
protected URL host;
protected Optional<URI> path;
protected String accept;
@@ -79,11 +77,6 @@ public abstract class RestClient {
protected RestClient(RestProperties props, Optional<URI> path) {
- msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class);
- this.requestId = MDC.get(MsoLogger.REQUEST_ID);
- if (requestId == null) {
- requestId = "";
- }
headerMap = new HashMap<>();
try {
host = props.getEndpoint();
@@ -99,24 +92,14 @@ public abstract class RestClient {
this(props, path);
this.accept = accept;
this.contentType = contentType;
- this.requestId = MDC.get(MsoLogger.REQUEST_ID);
- if (requestId == null) {
- requestId = "";
- }
this.props = props;
}
protected RestClient(URL host, String contentType) {
headerMap = new HashMap<>();
-
- msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class);
this.path = Optional.empty();
this.host = host;
this.contentType = contentType;
- this.requestId = MDC.get(MsoLogger.REQUEST_ID);
- if (requestId == null) {
- requestId = "";
- }
this.props = new DefaultProperties(host);
}
@@ -143,15 +126,13 @@ public abstract class RestClient {
if (webTarget == null) {
initializeClient(getClient());
- }
- Builder builder = webTarget.request();
- initializeHeaderMap(headerMap);
-
- headerMap.put("X-ECOMP-RequestID", requestId);
- for (Entry<String, String> entry : headerMap.entrySet()) {
- builder.header(entry.getKey(), entry.getValue());
- }
- return builder;
+ }
+ Builder builder = webTarget.request();
+ initializeHeaderMap(headerMap);
+ for (Entry<String, String> entry : headerMap.entrySet()) {
+ builder.header(entry.getKey(), entry.getValue());
+ }
+ return builder;
}
protected WebTarget getWebTarget() {
@@ -179,7 +160,7 @@ public abstract class RestClient {
String authHeaderValue = "Basic " + Base64.getEncoder().encodeToString(decryptedAuth);
headerMap.put("Authorization", authHeaderValue);
} catch (GeneralSecurityException e) {
- msoLogger.error(e.getMessage(), e);
+ logger.error(e.getMessage(), e);
}
}
@@ -192,7 +173,7 @@ public abstract class RestClient {
}
protected String getMergeContentType() {
- return "application/merge-patch+json";
+ return APPLICATION_MERGE_PATCH_JSON;
}
protected Client getClient() {
@@ -203,11 +184,11 @@ public abstract class RestClient {
protected void initializeClient(Client client) {
if (this.enableLogging()) {
- client.register(new LoggingFilter(this.getMaxPayloadSize()));
+ client.register(new PayloadLoggingFilter(this.getMaxPayloadSize()));
}
CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
client.register(new JacksonJsonProvider(provider.getMapper()));
-
+
jaxRsClientLogging = new JaxRsClientLogging();
jaxRsClientLogging.setTargetService(getTargetEntity());
client.register(jaxRsClientLogging);
diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index 8eaeee97ee..cb2839ae1f 100644
--- a/common/src/main/java/org/onap/so/client/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -32,7 +32,8 @@ import javax.ws.rs.client.ClientBuilder;
public abstract class RestClientSSL extends RestClient {
- public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
+ private static final String TRUE = "true";
+ public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
@@ -51,19 +52,18 @@ public abstract class RestClientSSL extends RestClient {
Client client = null;
try {
String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
- if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase("true")) {
+ if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) {
KeyStore ks = getKeyStore();
if(ks != null) {
client = ClientBuilder.newBuilder().keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build();
- this.msoLogger.debug("RestClientSSL not using default SSL context - setting keystore here.");
+ logger.debug("RestClientSSL not using default SSL context - setting keystore here.");
return client;
}
}
//Use default SSL context
client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build();
- this.msoLogger.debug("RestClientSSL using default SSL context!");
+ logger.info("RestClientSSL using default SSL context!");
} catch (NoSuchAlgorithmException e) {
- //this.logger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e);
throw new RuntimeException(e);
}
return client;
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
index 2329a5acb9..9d72fdf85b 100644
--- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
@@ -72,7 +72,7 @@ public class AdapterRestClient extends RestClient {
encodedString = "Basic " + encodedString;
return encodedString;
} catch (GeneralSecurityException e) {
- this.msoLogger.debug(e.getMessage());
+ logger.error(e.getMessage(),e);
return null;
}
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
index 2cb375bed8..49dc71e773 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
@@ -22,104 +22,126 @@ package org.onap.so.logging.jaxrs.filter;
import org.apache.commons.io.IOUtils;
-import org.onap.so.logger.MsoLogger;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.utils.TargetEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
+import org.slf4j.MarkerFactory;
import org.springframework.stereotype.Component;
-
+import javax.annotation.Priority;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.client.ClientResponseContext;
import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Providers;
import java.io.*;
-
-import java.time.Instant;
-import java.time.ZoneId;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.Locale;
+import java.util.Map;
import java.util.UUID;
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Component
+@Priority(0)
public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFilter {
-
- private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsClientLogging.class);
+
+ @Context
+ private Providers providers;
- private TargetEntity targetEntity;
+ private static final String TRACE = "trace-#";
+ private static final String SO = "SO";
+ private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class);
- public void setTargetService(TargetEntity targetEntity){
- this.targetEntity = targetEntity;
+ public void setTargetService(TargetEntity targetEntity){
+ MDC.put("TargetEntity", targetEntity.toString());
}
- @Override
- public void filter(ClientRequestContext clientRequest) {
+ @Override
+ public void filter(ClientRequestContext clientRequest) {
try{
- MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
-
-
- Instant instant = Instant.now();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
- .withLocale( Locale.US )
- .withZone( ZoneId.systemDefault() );
-
- String requestId = MDC.get(MsoLogger.REQUEST_ID);
- if(requestId == null || requestId.isEmpty()){
- requestId = UUID.randomUUID().toString();
- logger.warnSimple(clientRequest.getUri().getPath(),"Could not Find Request ID Generating New One");
- }
-
- MDC.put(MsoLogger.METRIC_BEGIN_TIME, formatter.format(instant));
- MDC.put(MsoLogger.METRIC_START_TIME, String.valueOf(System.currentTimeMillis()));
- MDC.put(MsoLogger.REQUEST_ID,requestId);
- MDC.put(MsoLogger.TARGETSERVICENAME, clientRequest.getUri().toString());
+ setupMDC(clientRequest);
+ setupHeaders(clientRequest);
+ logger.info(ONAPLogConstants.Markers.INVOKE, "Invoke");
} catch (Exception e) {
- logger.warnSimple("Error in incoming JAX-RS Inteceptor", e);
- }
- }
+ logger.warn("Error in incoming JAX-RS Inteceptor", e);
+ }
+ }
+
+ private void setupHeaders(ClientRequestContext clientRequest) {
+ MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
+ headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest));
+ headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO);
+ }
+
+ private void setupMDC(ClientRequestContext clientRequest) {
+ MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString());
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ setInvocationId();
+ MDC.put("TargetEntity",MDC.get("TargetEntity"));
+ }
+ private String extractRequestID(ClientRequestContext clientRequest) {
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ if(requestId == null || requestId.isEmpty() || requestId.equals(TRACE)){
+ requestId = UUID.randomUUID().toString();
+ logger.warn("Could not Find Request ID Generating New One: {}",clientRequest.getUri().getPath());
+ }
+ return requestId;
+ }
+
+ private void setInvocationId() {
+ String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
+ if(invocationId == null || invocationId.isEmpty())
+ invocationId =UUID.randomUUID().toString();
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
+ }
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
try {
- Instant instant = Instant.now();
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
- .withLocale( Locale.US )
- .withZone( ZoneId.systemDefault() );
- String startTime= MDC.get(MsoLogger.METRIC_START_TIME);
-
- long elapsedTime = System.currentTimeMillis()-Long.parseLong(startTime);
- String statusCode;
- if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
- statusCode=MsoLogger.COMPLETE;
- }else{
- statusCode=MsoLogger.StatusCode.ERROR.toString();
- }
- MultivaluedMap<String, String> headers = responseContext.getHeaders();
-
- String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
- if(partnerName == null || partnerName.isEmpty())
- partnerName="UNKNOWN";
- MDC.put(MsoLogger.RESPONSEDESC,getStringFromInputStream(responseContext));
- MDC.put(MsoLogger.STATUSCODE, statusCode);
- MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
- MDC.put(MsoLogger.METRIC_TIMER, String.valueOf(elapsedTime));
- MDC.put(MsoLogger.METRIC_END_TIME,formatter.format(instant));
- MDC.put(MsoLogger.PARTNERNAME,partnerName);
- MDC.put(MsoLogger.TARGETENTITY, targetEntity.toString());
- logger.recordMetricEvent();
- } catch ( Exception e) {
- logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e);
- }
- }
+ String statusCode;
+ if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
+ statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString();
+ }else{
+ statusCode=ONAPLogConstants.ResponseStatus.ERROR.toString();
+ }
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,getStringFromInputStream(responseContext));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
+ logger.info(MarkerFactory.getMarker("INVOKE_RETURN"), "InvokeReturn");
+ clearClientMDCs();
+ } catch ( Exception e) {
+ logger.warn("Error in outgoing JAX-RS Inteceptor", e);
+ }
+ }
+
+ private void clearClientMDCs() {
+ MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
+ MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
+ MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
+ MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
+ MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
+ }
private static String getStringFromInputStream(ClientResponseContext clientResponseContext) {
- InputStream is = clientResponseContext.getEntityStream();
- ByteArrayOutputStream boas = new ByteArrayOutputStream();
+ InputStream is = clientResponseContext.getEntityStream();
+ ByteArrayOutputStream boas = new ByteArrayOutputStream();
try {
IOUtils.copy(is,boas);
@@ -128,8 +150,9 @@ public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFil
return boas.toString();
} catch (IOException e) {
- logger.warnSimple("Failed to read response body", e);
+ logger.warn("Failed to read response body", e);
}
return "Unable to read input stream";
}
+
}
diff --git a/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
index 83cf08f77f..29264f4e42 100644
--- a/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.policy;
+package org.onap.so.logging.jaxrs.filter;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
@@ -40,22 +40,24 @@ import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Provider
-@Priority(0)
-public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
+@Priority(1)
+public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
- private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingFilter.class);
+ private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class);
private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
private final int maxEntitySize;
- public LoggingFilter() {
+ public PayloadLoggingFilter() {
maxEntitySize = 1024 * 1024;
}
- public LoggingFilter(int maxPayloadSize) {
+ public PayloadLoggingFilter(int maxPayloadSize) {
this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
index ad76e56a56..84dae957ba 100644
--- a/common/src/main/java/org/onap/so/utils/TargetEntity.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java
@@ -20,13 +20,22 @@
package org.onap.so.utils;
+import java.util.EnumSet;
public enum TargetEntity {
OPENSTACK_ADAPTER, BPMN, GRM ,AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, NARAD;
- private static final String PREFIX = "MSO";
+ private static final String PREFIX = "SO";
+
+ public static EnumSet<TargetEntity> getSOInternalComponents() {
+ return EnumSet.of(OPENSTACK_ADAPTER, BPMN,CATALOG_DB,REQUEST_DB,VNF_ADAPTER,SDNC_ADAPTER);
+ }
+
@Override
public String toString(){
- return TargetEntity.PREFIX + "." + this.name();
+ if(getSOInternalComponents().contains(this))
+ return TargetEntity.PREFIX + "." + this.name();
+ else
+ return this.name();
}
-}
+} \ No newline at end of file
diff --git a/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java
deleted file mode 100644
index 29ac91c864..0000000000
--- a/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapter_utils.tests;
-
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.logger.MsoLogger.ErrorCode;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.MDC;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-
-/**
- * This class implements all test methods of the MsoLogger features.
- *
- *
- */
-public class MsoLoggerTest {
-
- static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, MsoLoggerTest.class);
-
- /**
- * This method is called before any test occurs. It creates a fake tree from
- * scratch
- */
- @BeforeClass
- public static final void prepare() {
-
- }
-
- @Before
- public final void cleanErrorLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
- + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
- asdcConfigFileWriter.print("");
- asdcConfigFileWriter.flush();
- asdcConfigFileWriter.close();
- }
-
- @Before
- public final void cleanMetricLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
- + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
- asdcConfigFileWriter.print("");
- asdcConfigFileWriter.flush();
- asdcConfigFileWriter.close();
- }
-
- @Before
- public final void cleanAuditLogFile() throws FileNotFoundException {
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
- + "/MSO/Test/auditjbo.server.name_IS_UNDEFINED.log";
- PrintWriter asdcConfigFileWriter = new PrintWriter(logFile);
- asdcConfigFileWriter.print("");
- asdcConfigFileWriter.flush();
- asdcConfigFileWriter.close();
- }
-
- /**
- * This method implements a test of getSeverifyLevel method.
- */
- @Test
- public final void testGetSeverityLevel() {
-
- try {
- String levelInfo = (String) invokePriveMethod("getSeverityLevel", "INFO");
- Assert.assertEquals(levelInfo, "0");
-
- String levelWarn = (String) invokePriveMethod("getSeverityLevel", "WARN");
- Assert.assertEquals(levelWarn, "1");
-
- String levelERROR = (String) invokePriveMethod("getSeverityLevel", "ERROR");
- Assert.assertEquals(levelERROR, "2");
-
- String levelDEBUG = (String) invokePriveMethod("getSeverityLevel", "DEBUG");
- Assert.assertEquals(levelDEBUG, "0");
-
- String levelFATAL = (String) invokePriveMethod("getSeverityLevel", "FATAL");
- Assert.assertEquals(levelFATAL, "3");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * This method implements a test of getFinalServiceName method.
- */
- @Test
- public final void testGetFinalServiceName() {
- try {
- String serviceName1 = (String) invokePriveMethod("getFinalServiceName", "testServiceName1");
- Assert.assertEquals(serviceName1, "testServiceName1");
-
- MsoLogger.setServiceName("testServiceName2");
- String serviceName2 = (String) invokePriveMethod("getFinalServiceName", "testServiceName1");
- Assert.assertEquals(serviceName2, "testServiceName1");
-
- String msgNull = null;
- String serviceName3 = (String) invokePriveMethod("getFinalServiceName", msgNull);
- Assert.assertEquals(serviceName3, "testServiceName2");
-
- MsoLogger.resetServiceName();
- String serviceName4 = (String) invokePriveMethod("getFinalServiceName", msgNull);
- Assert.assertEquals(serviceName4, "invoke0");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public final void testPrepareMsg() {
- try {
- String msgNull = null;
- MDC.clear();
- invokePrepareMsg("INFO", null, null);
-
- Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("trace-#")
- && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("trace-#")
- && MDC.get(MsoLogger.SERVICE_NAME).equals("invoke0") && MDC.get(MsoLogger.TIMER) == null
- && MDC.get(MsoLogger.ALERT_SEVERITY).equals("0"));
-
- MsoLogger.setLoggerParameters("testRemoteIp", "testUser");
- MsoLogger.setLogContext("testReqId", "testSvcId");
- invokePrepareMsg("ERROR", "testServiceName3", null);
- Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId")
- && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId")
- && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName3") && MDC.get(MsoLogger.TIMER) == null
- && MDC.get(MsoLogger.ALERT_SEVERITY).equals("2"));
-
- MsoLogger.setServiceName("testServiceName2");
- invokePrepareMsg("WARN", msgNull, msgNull);
- Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId")
- && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId")
- && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName2") && MDC.get(MsoLogger.TIMER) == null
- && MDC.get(MsoLogger.ALERT_SEVERITY).equals("1"));
-
- MDC.clear();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("reqId2");
- msoRequest.setServiceInstanceId("servId2");
- MsoLogger.setLogContext(msoRequest);
- invokePrepareMsg("FATAL", null, "123");
- Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("reqId2")
- && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("servId2")
- && MDC.get(MsoLogger.TIMER).equals("123") && MDC.get(MsoLogger.ALERT_SEVERITY).equals("3"));
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * This method implements a test of log methods
- */
- @Test
- @Ignore
- public final void testLogMethods() {
- try {
- MDC.clear();
- MsoLogger.setLogContext("reqId2", "servId2");
- MsoLogger.setServiceName("MSO.testServiceName");
- msoLogger.info(MessageEnum.LOGGER_UPDATE_SUC, "testLogger", "INFO", "DEBUG", "target entity",
- "target service");
- msoLogger.warn(MessageEnum.GENERAL_WARNING, "warning test", "", "", MsoLogger.ErrorCode.UnknownError,
- "warning test");
- msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "target entity", "target service",
- MsoLogger.ErrorCode.UnknownError, "error test");
-
- // Fetch from the error log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
- + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[] {});
- int size = stringArray.length;
-
- Assert.assertTrue(stringArray[size - 3]
- .contains("|reqId2|main|MSO.testServiceName||target entity|target service|INFO|null||")
- && stringArray[size - 3].contains(
- "||MSO-GENERAL-5408I Successfully update Logger: testLogger from level INFO to level DEBUG"));
- Assert.assertTrue(stringArray[size - 2]
- .contains("|reqId2|main|MSO.testServiceName||||WARN|UnknownError|warning test|")
- && stringArray[size - 2].contains("|MSO-GENERAL-5401W WARNING: warning test"));
- Assert.assertTrue(stringArray[size - 1].contains(
- "|reqId2|main|MSO.testServiceName||target entity|target service|ERROR|UnknownError|error test|")
- && stringArray[size - 1].contains("|MSO-GENERAL-9401E Exception encountered"));
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * This method implements a test of recordMetricEvent method.
- *
- * @throws IOException
- */
- @Test
- @Ignore
- public final void testRecordMetricEvent() throws IOException {
- MDC.clear();
- MsoLogger.setLogContext("reqId", "servId");
- msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful",
- "VNF", "createVNF", null);
- MDC.put(MsoLogger.REMOTE_HOST, "127.0.0.1");
- MDC.put(MsoLogger.PARTNERNAME, "testUser");
- msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable,
- "Exception", "SDNC", "removeSDNC", "testVNF");
-
- // Fetch from the metric log
- URL url = this.getClass().getClassLoader().getResource("logback-test.xml");
- String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes"))
- + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log";
-
- Path filePath = new File(logFile).toPath();
- Charset charset = Charset.defaultCharset();
- List<String> stringList = Files.readAllLines(filePath, charset);
- String[] stringArray = stringList.toArray(new String[] {});
- msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.UnknownError, "test error msg");
-
- Assert.assertTrue(stringArray[0]
- .contains("|reqId|servId|main||testRecordMetricEvent||VNF|createVNF|COMPLETE|0|Successful|"));
- // count the occurance of symbol "|"
- Assert.assertTrue((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 28);
- Assert.assertTrue(stringArray[1]
- .contains("|reqId|servId|main||testRecordMetricEvent|testUser|SDNC|removeSDNC|ERROR|501|Exception|")
- && stringArray[1].contains("|127.0.0.1||||testVNF|||||"));
- Assert.assertTrue((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 28);
- }
-
- /**
- * This method implements a test of testRecordAuditEvent method.
- */
-
- // User reflection to invoke to avoid change the publicity of the method
- private static String invokePrepareMsg(String arg1, String arg2, String arg3) {
- Method method;
- try {
- method = MsoLogger.class.getDeclaredMethod("prepareMsg", String.class, String.class, String.class);
- method.setAccessible(true);
- return (String) method.invoke(msoLogger, arg1, arg2, arg3);
- } catch (NoSuchMethodException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
- }
-
- // User reflection to invoke to avoid change the publicity of the method
- private static Object invokePriveMethod(String methodName, String arg) {
- Method method;
- try {
- method = MsoLogger.class.getDeclaredMethod(methodName, String.class);
- method.setAccessible(true);
- return method.invoke(msoLogger, arg);
- } catch (NoSuchMethodException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index 3cce6a626b..7b783762fa 100644
--- a/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
+++ b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java
@@ -24,9 +24,11 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
+import static org.junit.Assert.fail;
import java.io.File;
import java.nio.file.Files;
import java.util.ArrayList;
@@ -43,6 +45,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.grm.beans.OperationalInfo;
import org.onap.so.client.grm.beans.Property;
import org.onap.so.client.grm.beans.ServiceEndPoint;
@@ -54,8 +57,7 @@ import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.logger.MsoLogger.Catalog;
+
import org.onap.so.utils.TestAppender;
public class GRMClientTest {
@@ -66,6 +68,8 @@ public class GRMClientTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ private static final String uuidRegex = "(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-5][0-9a-f]{3}-?[089ab][0-9a-f]{3}-?[0-9a-f]{12}$";
+
@BeforeClass
public static void setUp() throws Exception {
System.setProperty("mso.config.path", "src/test/resources");
@@ -81,25 +85,45 @@ public class GRMClientTest {
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", MediaType.APPLICATION_JSON)
- .withHeader("X-FromAppId", "GRM")
.withBody(endpoints)));
- MDC.put(MsoLogger.SERVICE_NAME, "my-value");
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, "/test");
GRMClient client = new GRMClient();
ServiceEndPointList sel = client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST");
List<ServiceEndPoint> list = sel.getServiceEndPointList();
assertEquals(3, list.size());
- ILoggingEvent logEvent = TestAppender.events.get(0);
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.METRIC_BEGIN_TIME));
- assertNotNull(mdc.get(MsoLogger.METRIC_END_TIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.METRIC_TIMER));
- assertEquals("200",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("GRM",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("expect value to not be overwritten by jax rs client interceptor", "my-value",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+
+ boolean foundInvoke = false;
+ boolean foundInvokeReturn = false;
+ for(ILoggingEvent logEvent : TestAppender.events)
+ if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") &&
+ logEvent.getMarker().getName().equals("INVOKE")
+ ){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("GRM",mdc.get("TargetEntity"));
+ assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ foundInvoke=true;
+ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") &&
+ logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("INVOKE_RETURN")){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
+ assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ foundInvokeReturn=true;
+ }
+
+ if(!foundInvoke)
+ fail("INVOKE Marker not found");
+
+ if(!foundInvokeReturn)
+ fail("INVOKE RETURN Marker not found");
+
+ verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning"))
+ .withHeader(ONAPLogConstants.Headers.INVOCATION_ID.toString(), matching(uuidRegex))
+ .withHeader(ONAPLogConstants.Headers.REQUEST_ID.toString(), matching(uuidRegex))
+ .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO")));
+ TestAppender.events.clear();
}
@Test
@@ -116,68 +140,6 @@ public class GRMClientTest {
client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST");
}
- @Ignore
- @Test
- public void testAdd() throws Exception {
-
- wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", MediaType.APPLICATION_JSON)
- .withBody("test")));
- wireMockRule.addMockServiceRequestListener((request, response) -> {
- System.out.println("URL Requested => " + request.getAbsoluteUrl());
- System.out.println("Request Body => " + request.getBodyAsString());
- System.out.println("Request Headers => " + request.getHeaders().toString());
- System.out.println("Response Status => " + response.getStatus());
- System.out.println("Response Body => " + response.getBodyAsString());
- });
-
- Version ver = new Version();
- ver.setMajor(1);
- ver.setMinor(0);
- ver.setPatch("0");
-
- ServiceEndPoint sep = new ServiceEndPoint();
- sep.setName("TEST.ECOMP_PSL.Inventory");
- sep.setVersion(ver);
- sep.setHostAddress("127.0.0.1");
- sep.setListenPort("8080");
- sep.setLatitude("37.7022");
- sep.setLongitude("121.9358");
- sep.setContextPath("/");
- sep.setRouteOffer("TEST");
-
- OperationalInfo operInfo = new OperationalInfo();
- operInfo.setCreatedBy("edge");
- operInfo.setUpdatedBy("edge");
-
- sep.setOperationalInfo(operInfo);
-
- Property prop1 = new Property();
- prop1.setName("Environment");
- prop1.setValue("TEST");
-
- Property prop2 = new Property();
- prop2.setName("cpfrun_cluster_name");
- prop2.setValue("testcase_cluster_no_cluster");
-
- List<Property> props = new ArrayList<Property>();
- props.add(prop1);
- props.add(prop2);
-
- sep.setProperties(props);
-
- ServiceEndPointRequest request = new ServiceEndPointRequest();
- request.setEnv("DEV");
- request.setServiceEndPoint(sep);
-
- System.out.println("Request in JSON: " + mapper.writeValueAsString(request));
-
- GRMClient client = new GRMClient();
- client.addServiceEndPoint(request);
- }
-
@Test
public void testAddFail() throws Exception {
wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add"))
diff --git a/common/src/test/resources/logback-test.xml b/common/src/test/resources/logback-test.xml
index c4248bf985..772eeabeb6 100644
--- a/common/src/test/resources/logback-test.xml
+++ b/common/src/test/resources/logback-test.xml
@@ -1,8 +1,8 @@
<!--
============LICENSE_START=======================================================
- ECOMP MSO
+ ONAP SO
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,159 +18,58 @@
============LICENSE_END=========================================================
-->
-<configuration scan="false" debug="true">
- <!--<jmxConfigurator /> -->
- <!-- directory path for all other type logs -->
+<configuration>
+ <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
+ <property name="p_lvl" value="%level"/>
+ <property name="p_log" value="%logger"/>
+ <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
+ <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_thr" value="%thread"/>
+ <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
- <property name="logDir" value="./target" />
-
- <!-- directory path for debugging type logs -->
- <property name="debugDir" value="./target" />
-
- <!-- specify the component name
- <ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
- <property name="componentName" value="MSO"></property>
- <property name="subComponentName" value="Test"></property>
- <!-- log file names -->
- <property name="errorLogName" value="error" />
- <property name="metricsLogName" value="metrics" />
- <property name="auditLogName" value="audit" />
- <property name="debugLogName" value="debug" />
- <property name="errorPattern" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
- <property name="debugPattern" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}|%X{RequestId}|%msg%n" />
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${pattern}</pattern>
+ </encoder>
+ </appender>
- <property name="auditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" />
- <property name="metricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" />
+ <appender name="test"
+ class="org.onap.so.utils.TestAppender" />
- <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
- <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
+ <logger name="com.att.ecomp.audit" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <appender name="test" class="org.onap.so.utils.TestAppender"/>
- <!-- ============================================================================ -->
- <!-- EELF Appenders -->
- <!-- ============================================================================ -->
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <!-- The EELFAppender is used to record events to the general application
- log -->
-
- <!-- EELF Audit Appender. This appender is used to record audit engine
- related logging events. The audit logger and appender are specializations
- of the EELF application root logger and appender. This can be used to segregate
- Policy engine events from other components, or it can be eliminated to record
- these events as part of the application root log. -->
-
- <appender name="EELFAudit"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${auditLogName}${jboss.server.name}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/${auditLogName}${jboss.server.name}.log.%d</fileNamePattern>
- <!--<maxHistory>30</maxHistory>-->
- </rollingPolicy>
- <encoder>
- <pattern>${auditPattern}</pattern>
- </encoder>
- </appender>
- <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="EELFAudit" />
- </appender>
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
-<appender name="EELFMetrics"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${metricsLogName}${jboss.server.name}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/${metricsLogName}${jboss.server.name}.log.%d</fileNamePattern>
- <!--<maxHistory>30</maxHistory>-->
- </rollingPolicy>
- <encoder>
- <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
- %msg%n"</pattern> -->
- <pattern>${metricPattern}</pattern>
- </encoder>
- </appender>
-
-
- <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="EELFMetrics"/>
- </appender>
-
- <appender name="EELFError"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${logDirectory}/${errorLogName}${jboss.server.name}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${logDirectory}/${errorLogName}${jboss.server.name}.log.%d</fileNamePattern>
- <!--<maxHistory>30</maxHistory>-->
- </rollingPolicy>
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
- <encoder>
- <pattern>${errorPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="EELFError"/>
- </appender>
-
- <appender name="EELFDebug"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${debugLogDirectory}/${debugLogName}${jboss.server.name}.log</file>
- <rollingPolicy
- class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${debugLogDirectory}/${debugLogName}${jboss.server.name}.log.%d</fileNamePattern>
- <!--<maxHistory>30</maxHistory>-->
- </rollingPolicy>
- <encoder>
- <pattern>${debugPattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
- <queueSize>500</queueSize>
- <discardingThreshold>0</discardingThreshold>
- <appender-ref ref="EELFDebug" />
- <includeCallerData>true</includeCallerData>
- </appender>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
- %logger{1024} - %msg%n
- </pattern>
- </encoder>
- </appender>
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </logger>
+
+ <logger name="org.flywaydb" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <!-- ============================================================================ -->
- <!-- EELF loggers -->
- <!-- ============================================================================ -->
- <logger name="com.att.eelf.audit" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="asyncEELFAudit" />
- </logger>
-
- <logger name="METRIC" level="${so.log.level:-DEBUG}" additivity="true">
- <appender-ref ref="asyncEELFMetrics" />
- <appender-ref ref="test" />
- </logger>
+ <logger name="ch.vorburger" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
- <logger name="com.att.eelf.error" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="asyncEELFError" />
- </logger>
-
- <root level="${so.log.level:-DEBUG}">
- <appender-ref ref="asyncEELFDebug" />
- <appender-ref ref="STDOUT" />
- </root>
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </root>
</configuration> \ No newline at end of file
diff --git a/common/src/test/resources/mso-bad.json b/common/src/test/resources/mso-bad.json
deleted file mode 100644
index 1aaea50042..0000000000
--- a/common/src/test/resources/mso-bad.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "asdc-connections": {
- "asdc-controller1": {
- "asdcUser": "user1",
- "asdcConsumerGroup": "consumer1",
- "asdcConsumerId": "consumer1",
- "asdcEnvironmentName": "PROD",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- },
- "asdc-controller2": {
- "asdcUser": "user2",
- "asdcConsumerGroup": "consumer2",
- "asdcConsumerId": "consumer2",
- "asdcEnvironmentName": "E2E",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- }
- }
-} \ No newline at end of file
diff --git a/common/src/test/resources/mso.json b/common/src/test/resources/mso.json
deleted file mode 100644
index e8ee4a9185..0000000000
--- a/common/src/test/resources/mso.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "asdc-connections":{
- "asdc-controller1":{
- "asdcUser": "user1",
- "asdcConsumerGroup": "consumer1",
- "asdcConsumerId": "consumer1",
- "asdcEnvironmentName": "PROD",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- },
- "asdc-controller2":{
- "asdcUser": "user2",
- "asdcConsumerGroup": "consumer2",
- "asdcConsumerId": "consumer2",
- "asdcEnvironmentName": "E2E",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- }
- },
- "mso.properties.reload.time.minutes":2
-}
diff --git a/common/src/test/resources/mso.properties b/common/src/test/resources/mso.properties
deleted file mode 100644
index bb0e4ebf0d..0000000000
--- a/common/src/test/resources/mso.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ECOMP MSO
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-###
-
-mso.properties.reload.time.minutes=2
-ecomp.mso.cloud.1.cloudId=MT
-ecomp.mso.cloud.1.keystoneUrl=http://localhost:5000/v2.0
-ecomp.mso.cloud.1.msoId=John
-ecomp.mso.cloud.1.publicNetId=FD205490A48D48475607C36B9AD902BF
-ecomp.mso.cloud.1.test=1234
-ecomp.mso.cloud.1.boolean=true
-ecomp.mso.cloud.1.enum=enum1
diff --git a/common/src/test/resources/mso2.json b/common/src/test/resources/mso2.json
deleted file mode 100644
index bac30c495c..0000000000
--- a/common/src/test/resources/mso2.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "asdc-connections": {
- "asdc-controller1": {
- "asdcUser": "user1B",
- "asdcConsumerGroup": "consumer1",
- "asdcConsumerId": "consumer1",
- "asdcEnvironmentName": "PROD",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- },
- "asdc-controller2": {
- "asdcUser": "user2B",
- "asdcConsumerGroup": "consumer2",
- "asdcConsumerId": "consumer2",
- "asdcEnvironmentName": "E2E",
- "asdcAddress": "localhost:8443",
- "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199"
- }
- }
-} \ No newline at end of file
diff --git a/common/src/test/resources/mso2.properties b/common/src/test/resources/mso2.properties
deleted file mode 100644
index 423346e953..0000000000
--- a/common/src/test/resources/mso2.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ECOMP MSO
-# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=========================================================
-###
-
-mso.properties.reload.time.minutes=1
-ecomp.mso.cloud.1.cloudId=MT2
diff --git a/cxf-logging/.gitignore b/cxf-logging/.gitignore
new file mode 100644
index 0000000000..c2a96233ca
--- /dev/null
+++ b/cxf-logging/.gitignore
@@ -0,0 +1,2 @@
+/tattletale-jar/
+/bin/
diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml
new file mode 100644
index 0000000000..378d169175
--- /dev/null
+++ b/cxf-logging/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <name>CXFLogging</name>
+ <description>Common CXF Logging Classes</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-ext</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <artifactId>cxf-logging</artifactId>
+</project>
diff --git a/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index 9aed537668..52d26fb09a 100644
--- a/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -1,38 +1,26 @@
package org.onap.so.logging.cxf.interceptor;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
-import javax.xml.namespace.QName;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
-import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.OperationInfo;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
-import org.onap.so.logging.jaxrs.filter.MDCSetup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-@Component
+
public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{
protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingInInterceptor.class);
-
- @Autowired
- MDCSetup mdcSetup;
-
+
public SOAPLoggingInInterceptor() {
super(Phase.READ);
}
@@ -40,7 +28,7 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{
@Override
public void handleMessage(SoapMessage message) throws Fault {
try {
-
+ SOAPMDCSetup mdcSetup = new SOAPMDCSetup();
Map<String, List<String>> headers = (Map<String,List<String>>) message.get(Message.PROTOCOL_HEADERS);
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
diff --git a/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
index c50e505cd8..1ddf268ea8 100644
--- a/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
@@ -1,39 +1,25 @@
package org.onap.so.logging.cxf.interceptor;
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.namespace.QName;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
-import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.transport.http.AbstractHTTPDestination;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.exceptions.MSOException;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
-import org.onap.so.logging.jaxrs.filter.MDCSetup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-@Component
+
+
public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor{
private static final String _500 = "500";
protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingOutInterceptor.class);
- @Autowired
- MDCSetup mdcSetup;
+
public SOAPLoggingOutInterceptor() {
super(Phase.WRITE);
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
new file mode 100644
index 0000000000..6991949dd0
--- /dev/null
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
@@ -0,0 +1,53 @@
+package org.onap.so.logging.cxf.interceptor;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+
+
+public class SOAPMDCSetup {
+
+ protected static Logger logger = LoggerFactory.getLogger(SOAPMDCSetup.class);
+
+ private static final String INSTANCE_UUID = UUID.randomUUID().toString();
+
+ public void setInstanceUUID(){
+ MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
+ }
+
+ public void setServerFQDN(){
+ String serverFQDN = "";
+ InetAddress addr= null;
+ try {
+ addr = InetAddress.getLocalHost();
+ serverFQDN = addr.toString();
+ } catch (UnknownHostException e) {
+ logger.warn("Cannot Resolve Host Name");
+ serverFQDN = "";
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
+ }
+
+ public void setClientIPAddress(HttpServletRequest httpServletRequest){
+ String remoteIpAddress = "";
+ if (httpServletRequest != null) {
+ remoteIpAddress = httpServletRequest.getRemoteAddr();
+ }
+ MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
+ }
+
+ public void setEntryTimeStamp() {
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ }
+
+
+} \ No newline at end of file
diff --git a/cxf-logging/src/test/resources/logback-test.xml b/cxf-logging/src/test/resources/logback-test.xml
new file mode 100644
index 0000000000..772eeabeb6
--- /dev/null
+++ b/cxf-logging/src/test/resources/logback-test.xml
@@ -0,0 +1,75 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP SO
+ ================================================================================
+ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<configuration>
+ <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
+ <property name="p_lvl" value="%level"/>
+ <property name="p_log" value="%logger"/>
+ <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
+ <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+ <property name="p_thr" value="%thread"/>
+ <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
+
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="test"
+ class="org.onap.so.utils.TestAppender" />
+
+ <logger name="com.att.ecomp.audit" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </logger>
+
+ <logger name="org.flywaydb" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+
+ <logger name="ch.vorburger" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </root>
+
+
+</configuration> \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml
index 0743a2d2c5..b1963f1f4c 100644
--- a/mso-api-handlers/mso-api-handler-common/pom.xml
+++ b/mso-api-handlers/mso-api-handler-common/pom.xml
@@ -130,20 +130,6 @@
<groupId>org.onap.so</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-client</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-bindings-soap</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- </exclusion>
- </exclusions>
</dependency>
</dependencies>
diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml
index cd4f25eadd..7f86cbad1a 100644
--- a/mso-catalog-db/pom.xml
+++ b/mso-catalog-db/pom.xml
@@ -52,20 +52,6 @@
<groupId>org.onap.so</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-client</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-bindings-soap</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/pom.xml b/pom.xml
index d2ddd6c386..59f0d5e8fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,6 +29,7 @@
<module>asdc-controller</module>
<module>bpmn</module>
<module>cloudify-client</module>
+ <module>cxf-logging</module>
<module>packages</module>
</modules>
<properties>
@@ -427,7 +428,7 @@
<version>2.20</version>
<configuration>
<systemPropertyVariables>
- <so.log.level>${so.log.level}</so.log.level>
+ <so.log.level>DEBUG</so.log.level>
</systemPropertyVariables>
<rerunFailingTestsCount>2</rerunFailingTestsCount>
</configuration>
@@ -439,7 +440,7 @@
<configuration>
<skip>true</skip>
<systemPropertyVariables>
- <so.log.level>${so.log.level}</so.log.level>
+ <so.log.level>DEBUG</so.log.level>
</systemPropertyVariables>
<rerunFailingTestsCount>2</rerunFailingTestsCount>
</configuration>