aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java46
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java119
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/application.yaml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application-local.yaml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application.yaml1
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml6
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml100
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/application.yaml7
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml140
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java41
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java12
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java (renamed from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java)4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java)4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java)5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java37
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java37
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java (renamed from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java)4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java (renamed from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java)4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java28
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Relationships.java110
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java77
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java137
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java15
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml358
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml4
-rw-r--r--pom.xml1
43 files changed, 863 insertions, 593 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 5c0110b680..49758a1240 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Intel Corp. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -20,6 +22,9 @@
package org.onap.so.openstack.utils;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.woorea.openstack.heat.model.CreateStackParam;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
@@ -27,10 +32,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
-
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilderException;
-
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
import org.onap.so.adapters.vdu.VduArtifact;
@@ -59,10 +62,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.CreateStackParam;
-
@Component
public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
@@ -194,30 +193,35 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, null);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
- Response response = multicloudClient.post(multicloudRequest);
+ if (multicloudClient == null) {
+ MsoOpenstackException me = new MsoOpenstackException(0, "", "Multicloud client could not be initialized");
+ me.addContext(CREATE_STACK);
+ throw me;
+ }
- StackInfo createInfo = new StackInfo();
- createInfo.setName(stackName);
+ Response response = multicloudClient.post(multicloudRequest);
MulticloudCreateResponse multicloudResponseBody = null;
if (response.hasEntity()) {
- multicloudResponseBody = getCreateBody((java.io.InputStream)response.getEntity());
+ multicloudResponseBody = getCreateBody((java.io.InputStream) response.getEntity());
}
if (response.getStatus() == Response.Status.CREATED.getStatusCode() && response.hasEntity()) {
- createInfo.setCanonicalName(stackName + "/" + multicloudResponseBody.getWorkloadId());
- if (logger.isDebugEnabled()) {
- logger.debug("Multicloud Create Response Body: " + multicloudResponseBody);
+ String canonicalName = stackName + "/";
+ if (multicloudResponseBody != null) {
+ canonicalName = canonicalName + multicloudResponseBody.getWorkloadId();
}
- return getStackStatus(cloudSiteId, tenantId, createInfo.getCanonicalName(), pollForCompletion, timeoutMinutes, backout);
- } else {
- StringBuilder stackErrorStatusReason = new StringBuilder(response.getStatusInfo().getReasonPhrase());
- if (null != multicloudResponseBody) {
- stackErrorStatusReason.append(multicloudResponseBody.toString());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Multicloud Create Response Body: {}", multicloudResponseBody);
}
- MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
- me.addContext(CREATE_STACK);
- throw me;
+ return getStackStatus(cloudSiteId, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout);
+ }
+ StringBuilder stackErrorStatusReason = new StringBuilder(response.getStatusInfo().getReasonPhrase());
+ if (null != multicloudResponseBody) {
+ stackErrorStatusReason.append(multicloudResponseBody.toString());
}
+ MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
+ me.addContext(CREATE_STACK);
+ throw me;
}
@Override
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
new file mode 100644
index 0000000000..fcb651e4dd
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Samsung 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.openstack.utils;
+
+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.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Optional;
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.BaseTest;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class MsoMulticloudUtilsTest extends BaseTest {
+
+ @Autowired
+ private MsoMulticloudUtils multicloudUtils;
+
+ @InjectMocks
+ private MsoMulticloudUtils multicloudUtilsMock;
+
+ @Mock
+ private CloudConfig cloudConfigMock;
+
+ private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": "
+ + "\"TEST-workload\", \"template_response\": {\"stack\": {\"id\": \"TEST-stack\", \"links\": []}}}";
+
+ @Test
+ public void createStackSuccess() throws MsoException, IOException {
+ stubFor(post(urlPathEqualTo("/v2.0"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(CREATE_STACK_RESPONSE)
+ .withStatus(HttpStatus.SC_CREATED)));
+ StackInfo result = multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ "TEST-heat", new HashMap<>(), false, 200, "TEST-env",
+ new HashMap<>(), new HashMap<>());
+ assertNotNull(result);
+ assertEquals("TEST-stack", result.getName());
+ }
+
+ @Test
+ public void createStackMulticloudClientIsNull() {
+ try {
+ multicloudUtilsMock.cloudConfig = cloudConfigMock;
+ CloudSite cloudSite = new CloudSite();
+ cloudSite.setIdentityService(new CloudIdentity());
+ when(cloudConfigMock.getCloudSite("MTN13")).
+ thenReturn(Optional.of(cloudSite));
+ multicloudUtilsMock.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ "TEST-heat", new HashMap<>(), false, 200, "TEST-env",
+ new HashMap<>(), new HashMap<>());
+ } catch (MsoException e) {
+ assertEquals("0 : Multicloud client could not be initialized", e.toString());
+ return;
+ }
+ fail("MsoOpenstackException expected!");
+ }
+
+ @Test
+ public void createStackBadRequest() {
+ try {
+ stubFor(post(urlPathEqualTo("/v2.0"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_BAD_REQUEST)));
+ multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ "TEST-heat", new HashMap<>(), false, 200, "TEST-env",
+ new HashMap<>(), new HashMap<>());
+ } catch (MsoException e) {
+ assertEquals("0 : Bad Request", e.toString());
+ return;
+ }
+ fail("MsoOpenstackException expected!");
+ }
+
+ @Test
+ public void createStackEmptyResponseEntity() throws MsoException {
+ stubFor(post(urlPathEqualTo("/v2.0"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(HttpStatus.SC_CREATED)));
+ StackInfo result = multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ "TEST-heat", new HashMap<>(), false, 200, "TEST-env",
+ new HashMap<>(), new HashMap<>());
+ assertNotNull(result);
+ assertEquals("TEST-stack/", result.getName());
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 931dee2d5c..390c775cb2 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -144,6 +144,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
index 83101c1599..d46a8ee49d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
@@ -16,7 +16,7 @@ mso:
spring:
datasource:
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
index ef9b113e70..771aa80081 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
@@ -64,7 +64,7 @@ mso:
# H2
spring:
datasource:
- jdbc-url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;
+ url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;
username: sa
password: sa
driver-class-name: org.h2.Driver
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
index e682060c74..4e8d389998 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
@@ -18,7 +18,6 @@ mso:
retryMultiplier: 60000
spring:
datasource:
- type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 4a4d09a0a9..a4761adf62 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -59,6 +59,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
<optional>true</optional>
</dependency>
<dependency>
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
index b2b16274aa..5d3a837180 100644
--- a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
+++ b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
@@ -1,51 +1,51 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server:
- port: 8090
- tomcat:
- max-threads: 50
-ssl-enable: false
-mso:
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: localSite
- infra-requests:
- archived:
- period: 180
-spring:
- datasource:
- jdbc-url: jdbc:mariadb://localhost:3306/requestdb
- username: catalog
- password: catalog123
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
- jpa:
- generate-ddl: false
- show-sql: false
- hibernate:
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable-lazy-load-no-trans: true
- database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- security:
- usercredentials:
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
-
-flyway:
- baseline-on-migrate: false
- url: jdbc:mariadb://localhost:3306/requestdb
- user: catalog
- password: catalog123
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+
+server:
+ port: 8090
+ tomcat:
+ max-threads: 50
+ssl-enable: false
+mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
+ logPath: logs
+ site-name: localSite
+ infra-requests:
+ archived:
+ period: 180
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3306/requestdb
+ username: catalog
+ password: catalog123
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ initialization-mode: never
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: validate
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+ security:
+ usercredentials:
+ -
+ username: bpel
+ password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
+ role: BPEL-Client
+ -
+ username: mso_admin
+ password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
+ role: ACTUATOR
+
+
+flyway:
+ baseline-on-migrate: false
+ url: jdbc:mariadb://localhost:3306/requestdb
+ user: catalog
+ password: catalog123
\ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml
index 0da782bf00..9429592670 100644
--- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml
@@ -18,15 +18,10 @@ mso:
# H2
spring:
datasource:
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
- dbcp2:
- initial-size: 5
- max-total: 20
- validation-query: select 1
- test-on-borrow: true
jpa:
show-sql: false
hibernate:
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
index 19bff50ea3..db9885285e 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
+++ b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
@@ -1,70 +1,70 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-security:
- basic:
- enabled: false
-server:
- port: 8080
- tomcat:
- max-threads: 50
-ssl-enable: false
-mso:
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: localSite
- infra-requests:
- archived:
- period: 0
-spring:
- datasource:
- jdbc-url: jdbc:mariadb://localhost:3307/requestdb
- username: root
- password: password
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
- jpa:
- generate-ddl: false
- show-sql: false
- hibernate:
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable-lazy-load-no-trans: true
- database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- security:
- usercredentials:
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-mariaDB4j:
- dataDir:
- port: 3307
- databaseName: requestdb
-
-management:
- endpoints:
- web:
- base-path: /manage
- server:
- servlet:
- context-path: /manage
- metrics:
- se-global-registry: false
- export:
- prometheus:
- enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use.
-
-
-flyway:
- baseline-on-migrate: false
- jdbc-url: jdbc:mariadb://localhost:3307/requestdb
- user: root
- password: password
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+security:
+ basic:
+ enabled: false
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+ssl-enable: false
+mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
+ logPath: logs
+ site-name: localSite
+ infra-requests:
+ archived:
+ period: 0
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/requestdb
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ initialization-mode: never
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: validate
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+ security:
+ usercredentials:
+ -
+ username: bpel
+ password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
+ role: BPEL-Client
+ -
+ username: mso_admin
+ password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
+ role: ACTUATOR
+mariaDB4j:
+ dataDir:
+ port: 3307
+ databaseName: requestdb
+
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ context-path: /manage
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
+
+
+flyway:
+ baseline-on-migrate: false
+ url: jdbc:mariadb://localhost:3307/requestdb
+ user: root
+ password: password
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index d13fff4801..10b8ba7c16 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1060,7 +1060,17 @@ public class ToscaResourceInstaller {
}
- if(networkResourceCustomization==null || !networkUUIDsMatch){
+ if (networkResourceCustomization!=null && !networkUUIDsMatch){
+
+ NetworkResource networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate,
+ aicMax, aicMin);
+
+ networkResourceCustomization.setNetworkResource(networkResource);
+
+ networkCustomizationRepo.saveAndFlush(networkResourceCustomization);
+
+ }
+ else if(networkResourceCustomization==null){
networkResourceCustomization = createNetworkResourceCustomization(networkNodeTemplate,
toscaResourceStructure);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java
index c50a6db178..886025cb51 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java
@@ -20,27 +20,30 @@
package org.onap.so.client.dmaapproperties;
-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.urlEqualTo;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import java.io.File;
import java.io.IOException;
-import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.BaseTest;
import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.BaseTest;
+import org.onap.so.client.dmaapproperties.GlobalDmaapPublisher;
import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
public class DmaapPropertiesClientTest extends BaseTest{
@@ -75,10 +78,24 @@ public class DmaapPropertiesClientTest extends BaseTest{
@Test
public void testDmaapPublishRequest() throws JsonProcessingException, MapperException {
- stubFor(post(urlEqualTo("/events/com.att.mso.asyncStatusUpdate?timeout=60000"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
-
- dmaapPropertiesClient.dmaapPublishRequest(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope,
- requestType, timestamp, requestState, statusMessage, percentProgress, false);
+ DmaapPropertiesClient client = Mockito.spy(DmaapPropertiesClient.class);
+ GlobalDmaapPublisher mockedClientDmaapPublisher = Mockito.mock(GlobalDmaapPublisher.class);
+ AVPNDmaapBean mockedDmaapBean = Mockito.mock(AVPNDmaapBean.class);
+ String request = "test";
+
+ doReturn(mockedDmaapBean).when(client).buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope,
+ requestType, timestamp, requestState, statusMessage, percentProgress, false);
+
+ AVPNDmaapBean actualDmaapBean = client.buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime, finishTime, requestScope,
+ requestType, timestamp, requestState, statusMessage, percentProgress, false);
+ mockedClientDmaapPublisher.send(request);
+
+ doNothing().when(mockedClientDmaapPublisher).send(anyString());
+
+ verify(client, times(1)).buildRequestJson(requestId, clientSource, correlator, serviceInstanceId, startTime,
+ finishTime, requestScope, requestType, timestamp, requestState, statusMessage, percentProgress, false);
+ verify(mockedClientDmaapPublisher, times(1)).send(request);
+
+ assertNotNull(actualDmaapBean);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
index fc69f812be..088b01873c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
@@ -21,23 +21,27 @@
package org.onap.so.client.dmaapproperties;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.so.BaseTest;
import org.springframework.beans.factory.annotation.Autowired;
public class GlobalDmaapPublisherTest extends BaseTest{
+ @BeforeClass
+ public static void setUp() throws Exception {
+ System.setProperty("mso.global.dmaap.host", "http://test:1234");
+ }
+
@Autowired
private GlobalDmaapPublisher globalDmaapPublisher;
-
-
+
@Test
public void testGetters() {
assertEquals("81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54", globalDmaapPublisher.getAuth());
assertEquals("07a7159d3bf51a0e53be7a8f89699be7", globalDmaapPublisher.getKey());
assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
- assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get());
+ assertEquals("http://test:1234", globalDmaapPublisher.getHost().get());
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 5d0d05df92..fceb1812ba 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -175,6 +175,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
<optional>true</optional>
</dependency>
<dependency>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
index 829fc12474..d3d2c60a37 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
@@ -8,7 +8,7 @@ mso:
spring:
datasource:
driver-class-name: org.mariadb.jdbc.Driver
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
http:
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index db6cbe06ae..13fe61f704 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -46,14 +46,14 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
private Map<String, Object> variables;
@Autowired
- private AaiConnectionTestImpl aaiConnection;
+ private PnfManagementTestImpl pnfManagementTest;
@Autowired
private DmaapClientTestImpl dmaapClientTestImpl;
@Before
public void setup() {
- aaiConnection.reset();
+ pnfManagementTest.reset();
variables = new HashMap<>();
variables.put("serviceInstanceId", SERVICE_INSTANCE_ID);
variables.put(PNF_UUID, VALID_UUID);
@@ -62,7 +62,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@Test
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
- variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY);
+ variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -81,14 +81,14 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
"CreateRelationId",
"AaiEntryUpdated"
);
- Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
- containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITH_ENTRY));
+ Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
+ containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
}
@Test
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
- variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
+ variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -108,8 +108,8 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
"CreateRelationId",
"AaiEntryUpdated"
);
- Assertions.assertThat(aaiConnection.getCreated()).containsOnlyKeys(AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
- Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
- containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITHOUT_ENTRY));
+ Assertions.assertThat(pnfManagementTest.getCreated()).containsOnlyKeys(PnfManagementTestImpl.ID_WITHOUT_ENTRY);
+ Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
+ containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
}
}
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/PnfManagementTestImpl.java
index 4e0bf02685..84c983619b 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/PnfManagementTestImpl.java
@@ -25,13 +25,13 @@ 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;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@Component
@Primary
-public class AaiConnectionTestImpl implements AaiConnection {
+public class PnfManagementTestImpl implements PnfManagement {
public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml
index 09ffc0eb5c..56a92cbd01 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml
+++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml
@@ -157,7 +157,7 @@ sniro:
headers.latestVersion: 2
spring:
datasource:
- jdbc-url: jdbc:mariadb://localhost:3307/camundabpmn
+ url: jdbc:mariadb://localhost:3307/camundabpmn
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
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 8d353f134d..a8fb21540a 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
@@ -28,7 +28,7 @@ import java.io.IOException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,11 +46,11 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class);
- private AaiConnection aaiConnection;
+ private PnfManagement pnfManagement;
@Autowired
- public void setAaiConnection(AaiConnection aaiConnection) {
- this.aaiConnection = aaiConnection;
+ public void setPnfManagement(PnfManagement pnfManagement) {
+ this.pnfManagement = pnfManagement;
}
@Override
@@ -60,7 +60,7 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
}
try {
- boolean isEntry = aaiConnection.getEntryFor(correlationId).isPresent();
+ boolean isEntry = pnfManagement.getEntryFor(correlationId).isPresent();
logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
} catch (IOException e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
index 2268d22bd2..c31041fbf7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
@@ -28,7 +28,7 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,11 +45,11 @@ import org.springframework.stereotype.Component;
public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAaiDelegate.class);
- private AaiConnection aaiConnection;
+ private PnfManagement pnfManagement;
@Autowired
- public void setAaiConnection(AaiConnection aaiConnection) {
- this.aaiConnection = aaiConnection;
+ public void setPnfManagement(PnfManagement pnfManagement) {
+ this.pnfManagement = pnfManagement;
}
@Override
@@ -59,7 +59,7 @@ public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
Pnf pnf = new Pnf();
pnf.setPnfId(pnfUuid);
pnf.setPnfName(correlationId);
- aaiConnection.createEntry(correlationId, pnf);
+ pnfManagement.createEntry(correlationId, pnf);
logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
index 21d43964f8..7b6706f820 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,11 +34,11 @@ public class CreateRelation implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(CreateRelation.class);
- private AaiConnection aaiConnectionImpl;
+ private PnfManagement pnfManagementImpl;
@Autowired
- public CreateRelation(AaiConnection aaiConnectionImpl) {
- this.aaiConnectionImpl = aaiConnectionImpl;
+ public CreateRelation(PnfManagement pnfManagementImpl) {
+ this.pnfManagementImpl = pnfManagementImpl;
}
@Override
@@ -46,7 +46,7 @@ public class CreateRelation implements JavaDelegate {
String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId");
String pnfName = (String) delegateExecution.getVariable("correlationId");
try {
- aaiConnectionImpl.createRelation(serviceInstanceId, pnfName);
+ pnfManagementImpl.createRelation(serviceInstanceId, pnfName);
} catch (Exception e) {
new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
"An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
diff --git a/bpmn/so-bpmn-infrastructure-common/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 a975339e58..1b185f7c03 100644
--- a/bpmn/so-bpmn-infrastructure-common/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
@@ -31,7 +31,6 @@ import com.google.common.base.Strings;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -40,13 +39,12 @@ import org.springframework.stereotype.Component;
public class PnfCheckInputs implements JavaDelegate {
public static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$";
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class);
- private String defaultTimeout;
+ private String pnfEntryNotificationTimeout;
@Autowired
- public PnfCheckInputs(@Value("${aai.pnfEntryNotificationTimeout}") String defaultTimeout) {
- this.defaultTimeout = defaultTimeout;
+ public PnfCheckInputs(@Value("${aai.pnfEntryNotificationTimeout}") String pnfEntryNotificationTimeout) {
+ this.pnfEntryNotificationTimeout = pnfEntryNotificationTimeout;
}
@Override
@@ -75,15 +73,11 @@ public class PnfCheckInputs implements JavaDelegate {
}
private void validateTimeout(DelegateExecution execution) {
- String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION);
- if (Strings.isNullOrEmpty(timeout)) {
- LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default");
- if (defaultTimeout == null) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
- "default timeoutForPnfEntryNotification value not defined");
- }
- execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout);
+ if (Strings.isNullOrEmpty(pnfEntryNotificationTimeout)) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
+ "timeoutForPnfEntryNotification value not defined");
}
+ execution.setVariable(TIMEOUT_FOR_NOTIFICATION, pnfEntryNotificationTimeout);
}
private void validateServiceInstanceId(DelegateExecution execution) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
index eaabb2bfbb..b66bb5f61b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.pnf.implementation;
+package org.onap.so.bpmn.infrastructure.pnf.management;
import java.io.IOException;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
-public interface AaiConnection {
+public interface PnfManagement {
Optional<Pnf> getEntryFor(String correlationId) throws IOException;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
index 1bf2a290cb..3d8da2a106 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
@@ -18,11 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.pnf.aai;
+package org.onap.so.bpmn.infrastructure.pnf.management;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIRestClientImpl;
@@ -31,7 +30,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.springframework.stereotype.Component;
@Component
-public class AaiConnectionImpl implements AaiConnection {
+public class PnfManagementImpl implements PnfManagement {
@Override
public Optional<Pnf> getEntryFor(String correlationId) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 48c78632dd..477dc34dbd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -127,7 +129,7 @@ public class ServicePluginFactory {
return newRequest;
}
- List<Resource> addResourceList = new ArrayList<Resource>();
+ List<Resource> addResourceList = new ArrayList<>();
addResourceList.addAll(serviceDecomposition.getServiceResources());
serviceDecomposition.setVnfResources(null);
@@ -237,7 +239,7 @@ public class ServicePluginFactory {
String url = getInventoryOSSEndPoint();
url += "/oss/inventory?location=" + UriUtils.encode(locationAddress,"UTF-8");
String responseContent = sendRequest(url, "GET", "");
- List<Object> accessTPs = new ArrayList<Object>();
+ List<Object> accessTPs = new ArrayList<>();
if (null != responseContent) {
accessTPs = getJsonObject(responseContent, List.class);
}
@@ -246,8 +248,8 @@ public class ServicePluginFactory {
@SuppressWarnings("unchecked")
private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
- Map<String, Object> resourceParametersObject = new HashMap<String, Object>();
- Map<String, Object> resourceRequestInputs = new HashMap<String, Object>();
+ Map<String, Object> resourceParametersObject = new HashMap<>();
+ Map<String, Object> resourceRequestInputs = new HashMap<>();
resourceRequestInputs.put("requestInputs", resourceInputs);
resourceParametersObject.put("parameters", resourceRequestInputs);
@@ -428,7 +430,6 @@ public class ServicePluginFactory {
// this method check if pInterface is remote
private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
- Map<String, String> keys = uri.getURIKeys();
String uriString = uri.build().toString();
if (uriString != null) {
@@ -555,14 +556,14 @@ public class ServicePluginFactory {
}
private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
- Map<String, String> locationSrc = new HashMap<String, String>();
+ Map<String, String> locationSrc = new HashMap<>();
locationSrc.put("location", srcLocation);
- Map<String, String> locationDst = new HashMap<String, String>();
+ Map<String, String> locationDst = new HashMap<>();
locationDst.put("location", dstLocation);
- List<Map<String, String>> locations = new ArrayList<Map<String, String>>();
+ List<Map<String, String>> locations = new ArrayList<>();
locations.add(locationSrc);
locations.add(locationDst);
- List<Object> returnList = new ArrayList<Object>();
+ List<Object> returnList = new ArrayList<>();
String reqContent = getJsonString(locations);
String url = getThirdSPEndPoint();
String responseContent = sendRequest(url, "POST", reqContent);
@@ -604,7 +605,7 @@ public class ServicePluginFactory {
Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
- Map<String, Object> oofQueryObject = new HashMap<String, Object>();
+ Map<String, Object> oofQueryObject = new HashMap<>();
List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id"));
oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id"));
@@ -620,7 +621,7 @@ public class ServicePluginFactory {
String url = getOOFCalcEndPoint();
String responseContent = sendRequest(url, "POST", oofRequestReq);
- List<Object> returnList = new ArrayList<Object>();
+ List<Object> returnList = new ArrayList<>();
if (null != responseContent) {
returnList = getJsonObject(responseContent, List.class);
}
@@ -635,7 +636,7 @@ public class ServicePluginFactory {
}
private Map<String, Object> getReturnRoute(List<Object> returnList){
- Map<String, Object> returnRoute = new HashMap<String,Object>();
+ Map<String, Object> returnRoute = new HashMap<>();
for(Object returnVpn :returnList){
Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn;
String accessTopoId = (String)returnVpnInfo.get("access-topology-id");
@@ -664,11 +665,11 @@ public class ServicePluginFactory {
private Map<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid,
String serviceParameters) {
List<String> resourceList = jsonUtil.StringArrayToList(execution,
- (String) JsonUtils.getJsonValue(serviceParameters, "resources"));
+ JsonUtils.getJsonValue(serviceParameters, "resources"));
// Get the right location str for resource. default is an empty array.
String resourceInputsFromUui = "";
for (String resource : resourceList) {
- String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
+ String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
if (resourceCustomizationUuid.equals(resCusUuid)) {
String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
@@ -738,14 +739,6 @@ public class ServicePluginFactory {
method = httpDelete;
}
- // now have no auth
- // String userCredentials =
- // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
- // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
- // String authorization = "Basic " +
- // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- // method.setHeader("Authorization", authorization);
-
httpResponse = client.execute(method);
String responseContent = null;
if (null != httpResponse && httpResponse.getEntity() != null) {
diff --git a/bpmn/so-bpmn-infrastructure-common/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 eeda355f80..4b47ed6407 100644
--- a/bpmn/so-bpmn-infrastructure-common/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
@@ -25,8 +25,8 @@ import static org.mockito.ArgumentMatchers.eq;
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;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.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;
@@ -53,7 +53,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
@Before
public void setUp() {
delegate = new CheckAaiForCorrelationIdDelegate();
- delegate.setAaiConnection(new AaiConnectionTestImpl());
+ delegate.setPnfManagement(new PnfManagementTestImpl());
}
@Test
@@ -101,7 +101,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
@Before
public void setUp() {
delegate = new CheckAaiForCorrelationIdDelegate();
- delegate.setAaiConnection(new AaiConnectionThrowingException());
+ delegate.setPnfManagement(new PnfManagementThrowingException());
}
@Test
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
index c487125ea6..9c5f8f3fc4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
@@ -40,15 +40,15 @@ public class CreatePnfEntryInAaiDelegateTest {
// given
String pnfUuid = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
CreatePnfEntryInAaiDelegate delegate = new CreatePnfEntryInAaiDelegate();
- AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl();
- delegate.setAaiConnection(aaiConnection);
+ PnfManagementTestImpl pnfManagementTest = new PnfManagementTestImpl();
+ delegate.setPnfManagement(pnfManagementTest);
DelegateExecution execution = mock(DelegateExecution.class);
given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId");
given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid);
// when
delegate.execute(execution);
// then
- Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId");
+ Pnf createdEntry = pnfManagementTest.getCreated().get("testCorrelationId");
assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid);
assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
assertThat(createdEntry.isInMaint()).isNull();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
index 2dd3e23828..2a78337e34 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
@@ -29,8 +29,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
import org.junit.Test;
-import org.onap.so.bpmn.infrastructure.pnf.aai.AaiConnectionImpl;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
public class CreateRelationTest {
@@ -49,17 +48,17 @@ public class CreateRelationTest {
@Test
public void createRelationSuccessful() throws IOException {
// given
- AaiConnection aaiConnectionMock = mock(AaiConnectionImpl.class);
- CreateRelation testedObject = new CreateRelation(aaiConnectionMock);
+ PnfManagement pnfManagementMock = mock(PnfManagement.class);
+ CreateRelation testedObject = new CreateRelation(pnfManagementMock);
// when
testedObject.execute(executionFake);
// then
- verify(aaiConnectionMock).createRelation(SERVICE_INSTANCE_ID, PNF_NAME);
+ verify(pnfManagementMock).createRelation(SERVICE_INSTANCE_ID, PNF_NAME);
}
@Test
public void shouldThrowBpmnErrorWhenExceptionOccurred() {
- CreateRelation testedObject = new CreateRelation(new AaiConnectionThrowingException());
+ CreateRelation testedObject = new CreateRelation(new PnfManagementThrowingException());
executionFake.setVariable("testProcessKey", "testProcessKeyValue");
assertThatThrownBy(() -> testedObject.execute(executionFake)).isInstanceOf(BpmnError.class);
diff --git a/bpmn/so-bpmn-infrastructure-common/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 1637b1a97f..80693d7ce6 100644
--- a/bpmn/so-bpmn-infrastructure-common/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
@@ -20,14 +20,13 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
import java.util.UUID;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -36,7 +35,7 @@ import org.junit.Test;
public class PnfCheckInputsTest {
- private static final String DEFAULT_TIMEOUT = "P1D";
+ private static final String PNF_ENTRY_NOTIFICATION_TIMEOUT = "P1D";
private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
private static final String RESERVED_UUID = new UUID(0, 0).toString();
private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169";
@@ -51,50 +50,49 @@ public class PnfCheckInputsTest {
@Test
public void shouldThrowException_whenCorrelationIdNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
- public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() {
+ public void shouldThrowException_whenPnfEntryNotificationTimeoutIsNull() {
PnfCheckInputs testedObject = new PnfCheckInputs(null);
- DelegateExecution execution = delegateExecutionBuilder.setTimeoutForNotification("").build();
+ DelegateExecution execution = delegateExecutionBuilder.build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
- public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
- DelegateExecution execution = delegateExecutionBuilder.setTimeoutForNotification(null).build();
- testedObject.execute(execution);
- assertThat(execution.getVariable(TIMEOUT_FOR_NOTIFICATION)).isEqualTo(DEFAULT_TIMEOUT);
+ public void shouldThrowException_whenPnfEntryNotificationTimeoutIsEmpty() {
+ PnfCheckInputs testedObject = new PnfCheckInputs(StringUtils.EMPTY);
+ DelegateExecution execution = delegateExecutionBuilder.build();
+ assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenPnfUuidIsNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(null).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenPnfUuidIsEmptyString() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
- DelegateExecution execution = delegateExecutionBuilder.setPnfUuid("").build();
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
+ DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(StringUtils.EMPTY).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenPnfUuidIsReservedUuid() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(RESERVED_UUID).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenServiceInstanceIdIsNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setServiceInstanceId(null).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@@ -103,7 +101,6 @@ public class PnfCheckInputsTest {
private String correlationId = DEFAULT_CORRELATION_ID;
private String pnfUuid = VALID_UUID;
private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID;
- private String timeoutForNotification;
public DelegateExecutionBuilder setCorrelationId(String correlationId) {
this.correlationId = correlationId;
@@ -120,18 +117,12 @@ public class PnfCheckInputsTest {
return this;
}
- public DelegateExecutionBuilder setTimeoutForNotification(String timeoutForNotification) {
- this.timeoutForNotification = timeoutForNotification;
- return this;
- }
-
public DelegateExecution build() {
DelegateExecution execution = new DelegateExecutionFake();
execution.setVariable("testProcessKey", "testProcessKeyValue");
execution.setVariable(CORRELATION_ID, this.correlationId);
execution.setVariable(PNF_UUID, this.pnfUuid);
execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId);
- execution.setVariable(TIMEOUT_FOR_NOTIFICATION, this.timeoutForNotification);
return execution;
}
}
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/PnfManagementTestImpl.java
index 76b62a9cea..1377c8295f 100644
--- 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/PnfManagementTestImpl.java
@@ -21,7 +21,7 @@
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 org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import java.io.IOException;
import java.util.HashMap;
@@ -29,7 +29,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-public class AaiConnectionTestImpl implements AaiConnection {
+public class PnfManagementTestImpl implements PnfManagement {
public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
diff --git a/bpmn/so-bpmn-infrastructure-common/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/PnfManagementThrowingException.java
index 300d1e4c9b..43315d3803 100644
--- a/bpmn/so-bpmn-infrastructure-common/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/PnfManagementThrowingException.java
@@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import java.io.IOException;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
-public class AaiConnectionThrowingException implements AaiConnection {
+public class PnfManagementThrowingException implements PnfManagement {
@Override
public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
index a2651195ee..30d1b040e2 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -27,20 +27,17 @@ import java.util.Optional;
import javax.ws.rs.core.Response;
import org.onap.so.client.ResponseExceptionMapper;
-import org.onap.so.client.RestClientSSL;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
+import org.onap.so.client.graphinventory.GraphInventoryRestClient;
import org.onap.so.client.policy.CommonObjectMapperProvider;
import org.onap.so.utils.TargetEntity;
-public class AAIRestClient extends RestClientSSL {
+public class AAIRestClient extends GraphInventoryRestClient {
private final AAIProperties aaiProperties;
- private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider();
- private final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
-
protected AAIRestClient(AAIProperties props, URI uri) {
- super(props, Optional.of(uri));
+ super(props, uri);
this.aaiProperties = props;
}
@@ -67,27 +64,8 @@ public class AAIRestClient extends RestClientSSL {
return Optional.of(new AAIClientResponseExceptionMapper());
}
- @Override
- protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
- return standardProvider;
- }
-
- @Override
- public Response patch(Object obj) {
- return super.patch(convertToPatchFormat(obj));
- }
-
- @Override
- public <T> T patch(Object obj, Class<T> resultClass) {
- return super.patch(convertToPatchFormat(obj), resultClass);
- }
-
protected GraphInventoryPatchConverter getPatchConverter() {
return this.patchConverter;
}
-
- protected String convertToPatchFormat(Object obj) {
- return getPatchConverter().convertPatchFormat(obj);
- }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
index 9b3f98baa4..5ce81ce879 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
@@ -26,7 +26,7 @@ import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AAIResultWrapper extends GraphInventoryResultWrapper implements Serializable {
+public class AAIResultWrapper extends GraphInventoryResultWrapper<Relationships> implements Serializable {
private static final long serialVersionUID = 5895841925807816737L;
private final static transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class);
@@ -38,4 +38,9 @@ public class AAIResultWrapper extends GraphInventoryResultWrapper implements Ser
public AAIResultWrapper(Object aaiObject) {
super(aaiObject, logger);
}
+
+ @Override
+ protected Relationships createRelationships(String json) {
+ return new Relationships(json);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java
index e907bc97d7..61a2f4b8fa 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java
@@ -20,117 +20,55 @@
package org.onap.so.client.aai.entities;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Predicate;
import javax.ws.rs.core.UriBuilder;
-import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
-import org.onap.so.jsonpath.JsonPathUtil;
+import org.onap.so.client.graphinventory.entities.GraphInventoryRelationships;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.CaseFormat;
+public class Relationships extends GraphInventoryRelationships<AAIResultWrapper, AAIResourceUri, AAIObjectType>{
-public class Relationships {
-
- private final ObjectMapper mapper;
- private Map<String, Object> map;
- private final String jsonBody;
public Relationships(String json) {
- this.jsonBody = json;
- this.mapper = new AAICommonObjectMapperProvider().getMapper();
- try {
- this.map = mapper.readValue(json, new TypeReference<Map<String, Object>>() {});
- } catch (IOException e) {
- this.map = new HashMap<>();
- }
- }
-
- public List<AAIResultWrapper> getByType(GraphInventoryObjectName type) {
-
- return this.getAll(Optional.of(type));
- }
-
- public List<AAIResultWrapper> getAll() {
-
- return this.getAll(Optional.empty());
- }
-
-
- public List<String> getRelatedLinks() {
- return this.getRelatedLinks(Optional.empty());
- }
-
- public List<String> getRelatedLinks(GraphInventoryObjectName type) {
- return this.getRelatedLinks(Optional.of(type));
+ super(json);
}
+ @Deprecated
+ /**
+ * Use getRelatedUris instead
+ * @return
+ */
public List<AAIResourceUri> getRelatedAAIUris() {
- return this.getRelatedAAIUris(x -> true);
+ return this.getRelatedUris();
}
+ @Deprecated
+ /**
+ * Use getRelatedUris instead
+ * @return
+ */
public List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type) {
- return this.getRelatedAAIUris(x -> type.typeName().equals(x));
- }
- protected List<AAIResourceUri> getRelatedAAIUris(Predicate<String> p) {
- List<AAIResourceUri> result = new ArrayList<>();
- if (map.containsKey("relationship")) {
- List<Map<String, Object>> relationships = (List<Map<String, Object>>)map.get("relationship");
- for (Map<String, Object> relationship : relationships) {
- final String relatedTo = (String)relationship.get("related-to");
- if (p.test(relatedTo)) {
- AAIObjectType type;
- type = AAIObjectType.fromTypeName(relatedTo);
- final String relatedLink = (String)relationship.get("related-link");
-
- result.add(AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build()));
- }
- }
- }
- return result;
+ return this.getRelatedUris(type);
}
-
- protected List<AAIResultWrapper> getAll(final Optional<GraphInventoryObjectName> type) {
- List<AAIResourceUri> relatedLinks;
- if (type.isPresent()) {
- relatedLinks = this.getRelatedAAIUris(type.get());
- } else {
- relatedLinks = this.getRelatedAAIUris();
- }
- ArrayList<AAIResultWrapper> result = new ArrayList<>();
- for (AAIResourceUri link : relatedLinks) {
- result.add(this.get(link));
- }
- return result;
- }
-
protected AAIResultWrapper get(AAIResourceUri uri) {
return new AAIResourcesClient().get(uri);
}
-
- protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) {
- String matcher = "";
- if (type.isPresent()) {
- matcher = "[?(@.related-to=='" + type.get() + "')]";
- }
- return JsonPathUtil.getInstance().locateResultList(this.jsonBody, String.format("$.relationship%s.related-link", matcher));
+
+ @Override
+ protected AAIResourceUri createUri(AAIObjectType type, String relatedLink) {
+
+ return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build());
}
-
- public String getJson() {
- return this.jsonBody;
+
+ @Override
+ protected AAIObjectType fromTypeName(String name) {
+ return AAIObjectType.fromTypeName(name);
}
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
new file mode 100644
index 0000000000..10c06634dc
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
@@ -0,0 +1,77 @@
+/*-
+ * ============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.client.graphinventory;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.ws.rs.core.Response;
+
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.so.client.RestClientSSL;
+import org.onap.so.client.RestProperties;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.utils.TargetEntity;
+
+public abstract class GraphInventoryRestClient extends RestClientSSL {
+
+ protected static final GraphInventoryCommonObjectMapperProvider standardProvider = new GraphInventoryCommonObjectMapperProvider();
+
+ protected final GraphInventoryPatchConverter patchConverter = new GraphInventoryPatchConverter();
+
+ protected GraphInventoryRestClient(RestProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ }
+
+ @Override
+ public abstract TargetEntity getTargetEntity();
+
+ @Override
+ protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+
+ @Override
+ protected abstract Optional<ResponseExceptionMapper> addResponseExceptionMapper();
+
+ @Override
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return standardProvider;
+ }
+
+ @Override
+ public Response patch(Object obj) {
+ return super.patch(convertToPatchFormat(obj));
+ }
+
+ @Override
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ return super.patch(convertToPatchFormat(obj), resultClass);
+ }
+
+ protected GraphInventoryPatchConverter getPatchConverter() {
+ return this.patchConverter;
+ }
+
+ protected String convertToPatchFormat(Object obj) {
+ return getPatchConverter().convertPatchFormat(obj);
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
new file mode 100644
index 0000000000..759fad7e54
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
@@ -0,0 +1,137 @@
+/*-
+ * ============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.client.graphinventory.entities;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.Predicate;
+
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.jsonpath.JsonPathUtil;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper, Uri extends GraphInventoryResourceUri, Type extends GraphInventoryObjectType> {
+
+ protected final ObjectMapper mapper;
+ protected Map<String, Object> map;
+ protected final String jsonBody;
+
+ public GraphInventoryRelationships(String json) {
+ this.jsonBody = json;
+ this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper();
+ try {
+ this.map = mapper.readValue(json, new TypeReference<Map<String, Object>>() {});
+ } catch (IOException e) {
+ this.map = new HashMap<>();
+ }
+ }
+
+ public List<Wrapper> getByType(GraphInventoryObjectName type) {
+
+ return this.getAll(Optional.of(type));
+ }
+
+ public List<Wrapper> getAll() {
+
+ return this.getAll(Optional.empty());
+ }
+
+
+ public List<String> getRelatedLinks() {
+ return this.getRelatedLinks(Optional.empty());
+ }
+
+ public List<String> getRelatedLinks(GraphInventoryObjectName type) {
+ return this.getRelatedLinks(Optional.of(type));
+ }
+
+ public List<Uri> getRelatedUris() {
+ return this.getRelatedUris(x -> true);
+ }
+
+ public List<Uri> getRelatedUris(GraphInventoryObjectName type) {
+ return this.getRelatedUris(x -> type.typeName().equals(x));
+ }
+ protected List<Uri> getRelatedUris(Predicate<String> p) {
+ List<Uri> result = new ArrayList<>();
+ if (map.containsKey("relationship")) {
+ List<Map<String, Object>> relationships = (List<Map<String, Object>>)map.get("relationship");
+ for (Map<String, Object> relationship : relationships) {
+ final String relatedTo = (String)relationship.get("related-to");
+ if (p.test(relatedTo)) {
+ Type type;
+ type = fromTypeName(relatedTo);
+ final String relatedLink = (String)relationship.get("related-link");
+
+ result.add(createUri(type, relatedLink));
+ }
+ }
+ }
+ return result;
+ }
+
+
+
+ protected List<Wrapper> getAll(final Optional<GraphInventoryObjectName> type) {
+ List<Uri> relatedLinks;
+ if (type.isPresent()) {
+ relatedLinks = this.getRelatedUris(type.get());
+ } else {
+ relatedLinks = this.getRelatedUris();
+ }
+ ArrayList<Wrapper> result = new ArrayList<>();
+ for (Uri link : relatedLinks) {
+ result.add(this.get(link));
+ }
+ return result;
+ }
+
+ protected abstract Wrapper get(Uri uri);
+
+ protected abstract Uri createUri(Type type, String relatedLink);
+
+ protected abstract Type fromTypeName(String name);
+
+ protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) {
+ String matcher = "";
+ if (type.isPresent()) {
+ matcher = "[?(@.related-to=='" + type.get() + "')]";
+ }
+ return JsonPathUtil.getInstance().locateResultList(this.jsonBody, String.format("$.relationship%s.related-link", matcher));
+ }
+
+ public String getJson() {
+ return this.jsonBody;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
index 2f71358f04..c5651c0d26 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
@@ -28,17 +28,15 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.onap.so.client.aai.AAICommonObjectMapperProvider;
-import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.jsonpath.JsonPathUtil;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class GraphInventoryResultWrapper implements Serializable {
+public abstract class GraphInventoryResultWrapper<R extends GraphInventoryRelationships<?, ?, ?>> implements Serializable {
private static final long serialVersionUID = 5895841925807816727L;
protected final String jsonBody;
@@ -47,12 +45,12 @@ public class GraphInventoryResultWrapper implements Serializable {
protected GraphInventoryResultWrapper(String json, Logger logger) {
this.jsonBody = json;
- this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper();
this.logger = logger;
}
protected GraphInventoryResultWrapper(Object aaiObject, Logger logger) {
- this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ this.mapper = new GraphInventoryCommonObjectMapperProvider().getMapper();
this.jsonBody = mapObjectToString(aaiObject);
this.logger = logger;
}
@@ -65,18 +63,19 @@ public class GraphInventoryResultWrapper implements Serializable {
return "{}";
}
}
- public Optional<Relationships> getRelationships() {
+ public Optional<R> getRelationships() {
final String path = "$.relationship-list";
if (isEmpty()) {
return Optional.empty();
}
Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path);
if (result.isPresent()) {
- return Optional.of(new Relationships(result.get()));
+ return Optional.of(createRelationships(result.get()));
} else {
return Optional.empty();
}
}
+ protected abstract R createRelationships(String json);
public String getJson() {
if(jsonBody == null) {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index dc4179a86f..1b8844116a 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -33,7 +33,6 @@ import java.util.Set;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.graphinventory.Format;
import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
@@ -212,8 +211,8 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
@Override
public boolean equals(Object o) {
- if (o instanceof AAIUri) {
- return this.build().equals(((AAIUri)o).build());
+ if (o instanceof GraphInventoryUri) {
+ return this.build().equals(((GraphInventoryUri)o).build());
}
return false;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index f3163840ec..16dfa68244 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -80,6 +80,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml
index cabee8e8f7..a39d28038c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml
@@ -1,179 +1,179 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server:
- port: 8080
- tomcat:
- max-threads: 50
-ssl-enable: false
-
-apih-healthcheck-urn: /ecomp/mso/healthcheck,/ecomp/mso/homing/healthcheck,/ecomp/mso/infra/healthcheck,/asdc/healthcheck,/dbadapters/healthcheck,/ecomp/mso/catalog/v2/healthcheck
-jra-healthcheck-urn: /networks/rest/healthcheck,/adapters/rest/healthcheck,/vnfs/rest/healthcheck,/tenants/rest/healthcheck,/appc/rest/healthcheck,/workflows/messages/healthcheck
-camunda-healthcheck-urn: /mso/healthcheck
-
-apih-nodehealthcheck-urn: /ecomp/mso/infra/nodehealthcheck
-jra-nodehealthcheck-urn: /adapters/rest/nodehealthcheck
-camunda-nodehealthcheck-urn: /mso/nodehealthcheck
-
-
-
-mso:
- health:
- endpoints:
- catalogdb: http://localhost:8800
- sdnc: http://localhost:8400
- openstack: http://localhost:8300
- requestdb: http://localhost:8700
- bpmn: http://localhost:8200
- asdc: http://localhost:8400
- requestdbattsvc: http://localhost:8600
-
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: mtanj
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- config:
- path: /src/main/resources/
- infra:
- default:
- alacarte:
- orchestrationUri: /mso/async/services/ALaCarteOrchestrator
- recipeTimeout: 180
- testApi: VNF_API
- service:
- macro:
- default:
- testApi: GR_API
- apih:
- homing:
- sdna:
- url: http://localhost:8089/
- password: 4E0BDC08EE8EDC0572ABBE9FD2D59B62DB725A00B8469E39393D6C86D64284C5D34A57D56F7B58C375316F
- camundaURL: http://localhost:8089/
- camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
- sdc:
- client:
- auth: 97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF
- activate:
- instanceid: test
- userid: cs0008
- endpoint: http://localhost:28090
- msoKey: 07a7159d3bf51a0e53be7a8f89699be7
- tenant:
- isolation:
- retry:
- count: 3
- aai:
- endpoint: http://localhost:28090
- auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
- grm:
- endpoint: http://localhost:28090
- username: gmruser
- password: test
- so:
- operational-environment:
- dmaap:
- username: testuser
- password: VjR5NDcxSzA=
- host: http://localhost:28090
- publisher:
- topic: com.att.ecomp.mso.operationalEnvironmentEvent
-
-# controls what actions the infra API (APIH) allows sent in on REST request
-vnf:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-network:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-volume:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-# H2
-spring:
- datasource:
- jdbc-url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
- h2:
- console:
- enabled: true
- path: /h2
-
- jpa:
- show-sql: true
- hibernate:
- dialect: org.hibernate.dialect.H2Dialect
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable_lazy_load_no_trans: true
- jersey:
- type: filter
- security:
- usercredentials:
- -
- username: sitecontrol
- password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
- role: SiteControl-Client
- -
- username: gui
- password: '$2a$12$9Y4daXavh.oX5fz6t/e7TuCdj7EKW5B5ibqq425fN3/xpp0/Fhyti'
- role: GUI-Client
- -
- username: infraportal
- password: '$2a$12$IpUEhQijWTNbq0fGYVkA9upZrDvdIK6QfblIaKAiwi0vBQRE.C6Ri'
- role: InfraPortal-Client
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-request:
- datasource:
- jdbc-url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
-
-#Actuator
-management:
- context-path: /manage
-
-org:
- onap:
- so:
- adapters:
- network:
- encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
+# will be used as entry in DB to say SITE OFF/ON for healthcheck
+
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+ssl-enable: false
+
+apih-healthcheck-urn: /ecomp/mso/healthcheck,/ecomp/mso/homing/healthcheck,/ecomp/mso/infra/healthcheck,/asdc/healthcheck,/dbadapters/healthcheck,/ecomp/mso/catalog/v2/healthcheck
+jra-healthcheck-urn: /networks/rest/healthcheck,/adapters/rest/healthcheck,/vnfs/rest/healthcheck,/tenants/rest/healthcheck,/appc/rest/healthcheck,/workflows/messages/healthcheck
+camunda-healthcheck-urn: /mso/healthcheck
+
+apih-nodehealthcheck-urn: /ecomp/mso/infra/nodehealthcheck
+jra-nodehealthcheck-urn: /adapters/rest/nodehealthcheck
+camunda-nodehealthcheck-urn: /mso/nodehealthcheck
+
+
+
+mso:
+ health:
+ endpoints:
+ catalogdb: http://localhost:8800
+ sdnc: http://localhost:8400
+ openstack: http://localhost:8300
+ requestdb: http://localhost:8700
+ bpmn: http://localhost:8200
+ asdc: http://localhost:8400
+ requestdbattsvc: http://localhost:8600
+
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
+ logPath: logs
+ site-name: mtanj
+ catalog:
+ db:
+ spring:
+ endpoint: "http://localhost:8080"
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ config:
+ path: /src/main/resources/
+ infra:
+ default:
+ alacarte:
+ orchestrationUri: /mso/async/services/ALaCarteOrchestrator
+ recipeTimeout: 180
+ testApi: VNF_API
+ service:
+ macro:
+ default:
+ testApi: GR_API
+ apih:
+ homing:
+ sdna:
+ url: http://localhost:8089/
+ password: 4E0BDC08EE8EDC0572ABBE9FD2D59B62DB725A00B8469E39393D6C86D64284C5D34A57D56F7B58C375316F
+ camundaURL: http://localhost:8089/
+ camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+ sdc:
+ client:
+ auth: 97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF
+ activate:
+ instanceid: test
+ userid: cs0008
+ endpoint: http://localhost:28090
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ tenant:
+ isolation:
+ retry:
+ count: 3
+ aai:
+ endpoint: http://localhost:28090
+ auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
+ grm:
+ endpoint: http://localhost:28090
+ username: gmruser
+ password: test
+ so:
+ operational-environment:
+ dmaap:
+ username: testuser
+ password: VjR5NDcxSzA=
+ host: http://localhost:28090
+ publisher:
+ topic: com.att.ecomp.mso.operationalEnvironmentEvent
+
+# controls what actions the infra API (APIH) allows sent in on REST request
+vnf:
+ v1:
+ ApiAllowableActions:
+ v2:
+ ApiAllowableActions:
+ v3:
+ ApiAllowableActions:
+
+network:
+ v1:
+ ApiAllowableActions:
+ v2:
+ ApiAllowableActions:
+ v3:
+ ApiAllowableActions:
+
+volume:
+ v1:
+ ApiAllowableActions:
+ v2:
+ ApiAllowableActions:
+ v3:
+ ApiAllowableActions:
+
+# H2
+spring:
+ datasource:
+ url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
+ username: sa
+ password: sa
+ driver-class-name: org.h2.Driver
+ intialize: true
+ h2:
+ console:
+ enabled: true
+ path: /h2
+
+ jpa:
+ show-sql: true
+ hibernate:
+ dialect: org.hibernate.dialect.H2Dialect
+ ddl-auto: validate
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable_lazy_load_no_trans: true
+ jersey:
+ type: filter
+ security:
+ usercredentials:
+ -
+ username: sitecontrol
+ password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
+ role: SiteControl-Client
+ -
+ username: gui
+ password: '$2a$12$9Y4daXavh.oX5fz6t/e7TuCdj7EKW5B5ibqq425fN3/xpp0/Fhyti'
+ role: GUI-Client
+ -
+ username: infraportal
+ password: '$2a$12$IpUEhQijWTNbq0fGYVkA9upZrDvdIK6QfblIaKAiwi0vBQRE.C6Ri'
+ role: InfraPortal-Client
+ -
+ username: bpel
+ password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
+ role: BPEL-Client
+ -
+ username: mso_admin
+ password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
+ role: ACTUATOR
+request:
+ datasource:
+ url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
+ username: sa
+ password: sa
+ driver-class-name: org.h2.Driver
+ intialize: true
+
+#Actuator
+management:
+ context-path: /manage
+
+org:
+ onap:
+ so:
+ adapters:
+ network:
+ encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
index 41e024f625..76e2caaca3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
@@ -29,15 +29,10 @@ mso:
spring:
datasource:
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
- dbcp2:
- initial-size: 5
- max-total: 20
- validation-query: select 1
- test-on-borrow: true
jpa:
show-sql: true
@@ -51,15 +46,10 @@ spring:
request:
datasource:
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
- dbcp2:
- initial-size: 5
- max-total: 20
- validation-query: select 1
- test-on-borrow: true
+ driver-class-name: org.mariadb.jdbc.Driver
#Actuator
management:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 4826c8756f..88cfd77e8c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -84,7 +84,7 @@ mso:
spring:
datasource:
- jdbc-url: jdbc:mariadb://localhost:3307/catalogdb
+ url: jdbc:mariadb://localhost:3307/catalogdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
@@ -107,7 +107,7 @@ spring:
role: InfraPortal-Client
request:
datasource:
- jdbc-url: jdbc:mariadb://localhost:3307/requestdb
+ url: jdbc:mariadb://localhost:3307/requestdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
diff --git a/pom.xml b/pom.xml
index 1d5d53d9a7..bd18e7d4b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,6 @@
<module>bpmn</module>
<module>cloudify-client</module>
<module>cxf-logging</module>
- <module>so-monitoring</module>
<module>packages</module>
</modules>
<properties>