summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java112
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java34
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java263
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java166
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java36
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java155
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java49
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java41
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java1386
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java94
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java38
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java400
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java35
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java51
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java31
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java301
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java87
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java170
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java43
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java51
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java47
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java74
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java130
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java222
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java68
72 files changed, 2306 insertions, 2353 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
index a47b16fc33..d401522800 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.aai;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -34,57 +33,64 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAICreateResources extends AAIResource {
- public void createAAIProject (String projectName, String serviceInstance){
- AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
- getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
-
- }
-
- public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
- Map<String, String> hashMap= new HashMap<>();
- hashMap.put("owning-entity-name", owningEntityName);
- getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI);
- }
+ public void createAAIProject(String projectName, String serviceInstance) {
+ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
+
+ }
+
+ public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ Map<String, String> hashMap = new HashMap<>();
+ hashMap.put("owning-entity-name", owningEntityName);
+ getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI,
+ serviceInstanceURI);
+ }
+
+ public boolean existsOwningEntity(String owningEntityId) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ return getAaiClient().exists(owningEntityURI);
+ }
+
+ public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ getAaiClient().connect(owningEntityURI, serviceInstanceURI);
+ }
+
+ public void createAAIPlatform(String platformName, String vnfId) {
+ AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
+ }
+
+ public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) {
+ AAIResourceUri lineOfBusinessURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
+ }
+
+ public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalCustomerId, serviceType, serviceInstanceId);
+ getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty());
+ }
+
+ public Optional<GenericVnf> getVnfInstance(String vnfId) {
+ try {
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI);
+ Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class);
+ return vnf;
+ } catch (Exception ex) {
+ return Optional.empty();
+ }
+ }
- public boolean existsOwningEntity(String owningEntityId){
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
- return getAaiClient().exists(owningEntityURI);
- }
-
- public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
- getAaiClient().connect(owningEntityURI, serviceInstanceURI);
- }
-
- public void createAAIPlatform(String platformName,String vnfId){
- AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
- AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId);
- getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
- }
-
- public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){
- AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
- AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId);
- getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
- }
- public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId);
- getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty());
- }
-
- public Optional<GenericVnf> getVnfInstance(String vnfId){
- try{
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI);
- Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class);
- return vnf;
- } catch (Exception ex){
- return Optional.empty();
- }
- }
-
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
index cea6fe740d..2526ca5c25 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
@@ -29,21 +29,23 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.springframework.stereotype.Component;
-public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate{
+public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ try {
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ getAaiClient().delete(serviceInstanceURI);
+ execution.setVariable("GENDS_SuccessIndicator", true);
+ } catch (Exception ex) {
+ String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."
+ + ex.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
- ExceptionUtil exceptionUtil = new ExceptionUtil();
- public void execute(DelegateExecution execution) throws Exception {
- try{
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
- getAaiClient().delete(serviceInstanceURI);
- execution.setVariable("GENDS_SuccessIndicator",true);
- } catch(Exception ex){
- String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage();
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- }
-
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java
index 3bc02be476..1410752f76 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java
@@ -24,17 +24,17 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.springframework.stereotype.Component;
@Component
-public abstract class AAIResource {
- private AAIResourcesClient aaiClient;
+public abstract class AAIResource {
+ private AAIResourcesClient aaiClient;
- public AAIResourcesClient getAaiClient() {
- if(aaiClient == null)
- return new AAIResourcesClient();
- else
- return aaiClient;
- }
+ public AAIResourcesClient getAaiClient() {
+ if (aaiClient == null)
+ return new AAIResourcesClient();
+ else
+ return aaiClient;
+ }
- public void setAaiClient(AAIResourcesClient aaiClient) {
- this.aaiClient = aaiClient;
- }
+ public void setAaiClient(AAIResourcesClient aaiClient) {
+ this.aaiClient = aaiClient;
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java
index c5cd2c70da..376ca4dbdb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java
@@ -21,129 +21,144 @@
package org.onap.so.bpmn.infrastructure.aai;
public class AAIServiceInstance {
- String serviceInstanceName;
- String serviceType;
- String serviceRole;
- String orchestrationStatus;
- String modelInvariantUuid;
- String modelVersionId;
- String environmentContext;
- String workloadContext;
-
- public static class AAIServiceInstanceBuilder {
- private String serviceInstanceName;
- private String serviceType;
- private String serviceRole;
- private String orchestrationStatus;
- private String modelInvariantUuid;
- private String modelVersionId;
- private String environmentContext;
- private String workloadContext;
-
- public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- return this;
- }
-
- public AAIServiceInstanceBuilder setServiceType(String serviceType) {
- this.serviceType = serviceType;
- return this;
- }
-
- public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- return this;
- }
-
- public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- return this;
- }
-
- public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- return this;
- }
-
- public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- return this;
- }
-
- public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- return this;
- }
-
- public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- return this;
- }
-
- public AAIServiceInstance createAAIServiceInstance() {
- return new AAIServiceInstance(this);
- }
- }
-
- public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
- this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
- this.serviceType = aaiServiceInstanceBuilder.serviceType;
- this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
- this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
- this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
- this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
- this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
- this.workloadContext = aaiServiceInstanceBuilder.workloadContext;
- }
-
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getServiceType() {
- return serviceType;
- }
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
- public String getServiceRole() {
- return serviceRole;
- }
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
- public String getOrchestrationStatus() {
- return orchestrationStatus;
- }
- public void setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
- public String getModelInvariantUuid() {
- return modelInvariantUuid;
- }
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
- public String getModelVersionId() {
- return modelVersionId;
- }
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
- public String getEnvironmentContext() {
- return environmentContext;
- }
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
- public String getWorkloadContext() {
- return workloadContext;
- }
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
+ String serviceInstanceName;
+ String serviceType;
+ String serviceRole;
+ String orchestrationStatus;
+ String modelInvariantUuid;
+ String modelVersionId;
+ String environmentContext;
+ String workloadContext;
+
+ public static class AAIServiceInstanceBuilder {
+ private String serviceInstanceName;
+ private String serviceType;
+ private String serviceRole;
+ private String orchestrationStatus;
+ private String modelInvariantUuid;
+ private String modelVersionId;
+ private String environmentContext;
+ private String workloadContext;
+
+ public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ return this;
+ }
+
+ public AAIServiceInstance createAAIServiceInstance() {
+ return new AAIServiceInstance(this);
+ }
+ }
+
+ public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
+ this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
+ this.serviceType = aaiServiceInstanceBuilder.serviceType;
+ this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
+ this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
+ this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
+ this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
+ this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
+ this.workloadContext = aaiServiceInstanceBuilder.workloadContext;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
index 0c519ef29f..bbca10be0f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-
import org.onap.aai.domain.yang.OwningEntities;
import org.onap.aai.domain.yang.OwningEntity;
import org.onap.so.client.aai.AAIObjectPlurals;
@@ -37,85 +36,88 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AAICreateResources {
-
- private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class);
-
- public void createAAIProject (String projectName, String serviceInstance){
- AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
-
- }
-
- public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
- Map<String, String> hashMap= new HashMap<>();
- hashMap.put("owning-entity-name", owningEntityName);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI);
- }
-
- public boolean existsOwningEntity(String owningEntityId){
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- return aaiRC.exists(owningEntityURI);
- }
-
- protected OwningEntities getOwningEntityName(String owningEntityName){
-
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- return aaiRC.get(OwningEntities.class,
- AAIUriFactory
- .createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
- .queryParam("owning-entity-name", owningEntityName))
- .orElseGet(() -> {
- logger.debug("No Owning Entity matched by name");
- return null;
- });
-
- }
-
- public Optional<OwningEntity> getOwningEntityNames(String owningEntityName) throws Exception{
- OwningEntity owningEntity = null;
- OwningEntities owningEntities = null;
- owningEntities = getOwningEntityName(owningEntityName);
-
- if (owningEntities == null) {
- return Optional.empty();
- } else if (owningEntities.getOwningEntity().size() > 1) {
- throw new Exception("Multiple OwningEntities Returned");
- } else {
- owningEntity = owningEntities.getOwningEntity().get(0);
- }
- return Optional.of(owningEntity);
- }
-
- public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.connect(owningEntityURI, serviceInstanceURI);
- }
-
- public void createAAIPlatform(String platformName,String vnfId){
- AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
- AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
- }
-
- public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){
- AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
- AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
- }
- public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty());
- }
-
+
+ private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class);
+
+ public void createAAIProject(String projectName, String serviceInstance) {
+ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
+
+ }
+
+ public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ Map<String, String> hashMap = new HashMap<>();
+ hashMap.put("owning-entity-name", owningEntityName);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI);
+ }
+
+ public boolean existsOwningEntity(String owningEntityId) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ return aaiRC.exists(owningEntityURI);
+ }
+
+ protected OwningEntities getOwningEntityName(String owningEntityName) {
+
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ return aaiRC.get(OwningEntities.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ .queryParam("owning-entity-name", owningEntityName)).orElseGet(() -> {
+ logger.debug("No Owning Entity matched by name");
+ return null;
+ });
+
+ }
+
+ public Optional<OwningEntity> getOwningEntityNames(String owningEntityName) throws Exception {
+ OwningEntity owningEntity = null;
+ OwningEntities owningEntities = null;
+ owningEntities = getOwningEntityName(owningEntityName);
+
+ if (owningEntities == null) {
+ return Optional.empty();
+ } else if (owningEntities.getOwningEntity().size() > 1) {
+ throw new Exception("Multiple OwningEntities Returned");
+ } else {
+ owningEntity = owningEntities.getOwningEntity().get(0);
+ }
+ return Optional.of(owningEntity);
+ }
+
+ public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) {
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.connect(owningEntityURI, serviceInstanceURI);
+ }
+
+ public void createAAIPlatform(String platformName, String vnfId) {
+ AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
+ }
+
+ public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) {
+ AAIResourceUri lineOfBusinessURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
+ AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
+ }
+
+ public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalCustomerId, serviceType, serviceInstanceId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty());
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
index 495c77255d..fb95ae3993 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
@@ -28,22 +28,24 @@ 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;
-public class AAIDeleteServiceInstance implements JavaDelegate{
+public class AAIDeleteServiceInstance implements JavaDelegate {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+ public void execute(DelegateExecution execution) throws Exception {
+ try {
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ AAIResourcesClient aaiRC = new AAIResourcesClient();
+ aaiRC.delete(serviceInstanceURI);
+ execution.setVariable("GENDS_SuccessIndicator", true);
+ } catch (Exception ex) {
+ String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."
+ + ex.getMessage();
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
- ExceptionUtil exceptionUtil = new ExceptionUtil();
- public void execute(DelegateExecution execution) throws Exception {
- try{
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
- AAIResourcesClient aaiRC = new AAIResourcesClient();
- aaiRC.delete(serviceInstanceURI);
- execution.setVariable("GENDS_SuccessIndicator",true);
- } catch(Exception ex){
- String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage();
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
- }
-
- }
-
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
index 805ece9de8..2d69351744 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
@@ -21,74 +21,91 @@
package org.onap.so.bpmn.infrastructure.aai.groovyflows;
public class AAIServiceInstance {
- String serviceInstanceName;
- String serviceType;
- String serviceRole;
- String orchestrationStatus;
- String modelInvariantUuid;
- String modelVersionId;
- String environmentContext;
- String workloadContext;
- public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole,
- String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext,
- String workloadContext) {
- this.serviceInstanceName = serviceInstanceName;
- this.serviceType = serviceType;
- this.serviceRole = serviceRole;
- this.orchestrationStatus = orchestrationStatus;
- this.modelInvariantUuid = modelInvariantUuid;
- this.modelVersionId = modelVersionId;
- this.environmentContext = environmentContext;
- this.workloadContext = workloadContext;
- }
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getServiceType() {
- return serviceType;
- }
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
- public String getServiceRole() {
- return serviceRole;
- }
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
- public String getOrchestrationStatus() {
- return orchestrationStatus;
- }
- public void setOrchestrationStatus(String orchestrationStatus) {
- this.orchestrationStatus = orchestrationStatus;
- }
- public String getModelInvariantUuid() {
- return modelInvariantUuid;
- }
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
- public String getModelVersionId() {
- return modelVersionId;
- }
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
- public String getEnvironmentContext() {
- return environmentContext;
- }
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
- public String getWorkloadContext() {
- return workloadContext;
- }
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
+ String serviceInstanceName;
+ String serviceType;
+ String serviceRole;
+ String orchestrationStatus;
+ String modelInvariantUuid;
+ String modelVersionId;
+ String environmentContext;
+ String workloadContext;
+
+ public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole,
+ String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext,
+ String workloadContext) {
+ this.serviceInstanceName = serviceInstanceName;
+ this.serviceType = serviceType;
+ this.serviceRole = serviceRole;
+ this.orchestrationStatus = orchestrationStatus;
+ this.modelInvariantUuid = modelInvariantUuid;
+ this.modelVersionId = modelVersionId;
+ this.environmentContext = environmentContext;
+ this.workloadContext = workloadContext;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java
index 3b443cbaf2..55387d6a3d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java
@@ -27,14 +27,15 @@ import org.springframework.stereotype.Component;
@Component
public class AAIObjectInstanceNameGenerator {
- public String generateInstanceGroupName(InstanceGroup instanceGroup, GenericVnf vnf) {
- if(vnf.getVnfName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) {
- return vnf.getVnfName() + "_" + instanceGroup.getModelInfoInstanceGroup().getFunction();
- } else {
- throw new IllegalArgumentException("Cannot generate instance group name because either one or both fields are null: "
- + " Vnf Instance Name: " + vnf.getVnfName()
- + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction());
- }
- }
-
+ public String generateInstanceGroupName(InstanceGroup instanceGroup, GenericVnf vnf) {
+ if (vnf.getVnfName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) {
+ return vnf.getVnfName() + "_" + instanceGroup.getModelInfoInstanceGroup().getFunction();
+ } else {
+ throw new IllegalArgumentException(
+ "Cannot generate instance group name because either one or both fields are null: "
+ + " Vnf Instance Name: " + vnf.getVnfName() + ", Instance Group Function: "
+ + instanceGroup.getModelInfoInstanceGroup().getFunction());
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
index e0fa41b7a1..493340c9ef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
@@ -22,9 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
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.PNF_CORRELATION_ID;
-
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;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
index 9b60a05e98..d67e6ef0db 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -26,7 +21,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION;
-
import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -50,7 +44,7 @@ public class ConfigCheckerDelegate implements JavaDelegate {
private Logger logger = LoggerFactory.getLogger(ConfigCheckerDelegate.class);
- //ERROR CODE for variable not found in the delegation Context
+ // ERROR CODE for variable not found in the delegation Context
private static int ERROR_CODE = 601;
@Autowired
@@ -63,34 +57,33 @@ public class ConfigCheckerDelegate implements JavaDelegate {
public void execute(DelegateExecution delegateExecution) throws Exception {
logger.debug("Running execute block for activity id:{}, name:{}", delegateExecution.getCurrentActivityId(),
- delegateExecution.getCurrentActivityName());
+ delegateExecution.getCurrentActivityName());
if (delegateExecution.hasVariable(SERVICE_MODEL_INFO)) {
String serviceModelInfo = (String) delegateExecution.getVariable(SERVICE_MODEL_INFO);
String serviceModelUuid = JsonUtils.getJsonValue(serviceModelInfo, MODEL_UUID);
delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
- List<PnfResourceCustomization> pnfCustomizations = catalogDbClient
- .getPnfResourceCustomizationByModelUuid(serviceModelUuid);
+ List<PnfResourceCustomization> pnfCustomizations =
+ catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
if (pnfCustomizations != null && pnfCustomizations.size() >= 1) {
PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
boolean skipPostInstantiationConfiguration = pnfResourceCustomization.isSkipPostInstConf();
- delegateExecution
- .setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION, skipPostInstantiationConfiguration);
+ delegateExecution.setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION,
+ skipPostInstantiationConfiguration);
delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
- delegateExecution
- .setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID,
+ pnfResourceCustomization.getModelCustomizationUUID());
delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName());
} else {
- logger
- .warn("Unable to find the PNF resource customizations of model service UUID: {}", serviceModelUuid);
+ logger.warn("Unable to find the PNF resource customizations of model service UUID: {}",
+ serviceModelUuid);
exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
- "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
+ "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
}
} else {
logger.warn("Unable to find the parameter: {} in the execution context", SERVICE_MODEL_INFO);
- exceptionUtil
- .buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
"Unable to find parameter " + SERVICE_MODEL_INFO);
}
}
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 e56cb83119..cb06085ee8 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
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.aai.domain.yang.Pnf;
@@ -37,9 +36,7 @@ import org.springframework.stereotype.Component;
/**
* Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
*
- * Inputs:
- * - pnfCorrelationId - String
- * - pnfUuid - String
+ * Inputs: - pnfCorrelationId - String - pnfUuid - String
*/
@Component
public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
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 a367bada02..6d73b61ab2 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
@@ -51,8 +51,8 @@ public class CreateRelation implements JavaDelegate {
new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
"An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
}
- logger.debug("The relation has been made between service with id: {} and pnf with name: {}",
- serviceInstanceId, pnfName);
+ logger.debug("The relation has been made between service with id: {} and pnf with name: {}", serviceInstanceId,
+ pnfName);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
index f5483e489e..852ca4fcef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import java.util.UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -35,7 +34,7 @@ public class GeneratePnfUuidDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(GeneratePnfUuidDelegate.class);
@Override
- public void execute(DelegateExecution delegateExecution){
+ public void execute(DelegateExecution delegateExecution) {
UUID uuid = UUID.randomUUID();
logger.debug("Generated UUID for pnf: {}, version: {}, variant: {}", uuid, uuid.version(), uuid.variant());
delegateExecution.setVariable(PNF_UUID, uuid.toString());
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 96455acb84..5cbd530a93 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -36,12 +36,8 @@ public class InformDmaapClient implements JavaDelegate {
public void execute(DelegateExecution execution) {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
- dmaapClient.registerForUpdate(pnfCorrelationId, () ->
- runtimeService
- .createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(execution.getProcessBusinessKey())
- .correlateWithResult()
- );
+ dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult());
}
@Autowired
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 1caadea0de..b52110ea82 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
@@ -26,7 +26,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
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 com.google.common.base.Strings;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
@@ -38,7 +37,8 @@ import org.springframework.stereotype.Component;
@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}$";
+ 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 String pnfEntryNotificationTimeout;
@@ -58,7 +58,8 @@ public class PnfCheckInputs implements JavaDelegate {
private void validatePnfCorrelationId(DelegateExecution execution) {
String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
if (Strings.isNullOrEmpty(pnfCorrelationId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined");
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
+ "pnfCorrelationId variable not defined");
}
}
@@ -83,7 +84,8 @@ public class PnfCheckInputs implements JavaDelegate {
private void validateServiceInstanceId(DelegateExecution execution) {
String serviceInstanceId = (String) execution.getVariable(SERVICE_INSTANCE_ID);
if (Strings.isNullOrEmpty(serviceInstanceId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "serviceInstanceId variable not defined");
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
+ "serviceInstanceId variable not defined");
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java
index 49887af4be..c4c299d4b6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -24,7 +19,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
@@ -50,7 +44,7 @@ public abstract class PrepareCdsCallDelegate implements JavaDelegate {
protected ExceptionBuilder exceptionUtil;
@Override
- public void execute(DelegateExecution delegateExecution){
+ public void execute(DelegateExecution delegateExecution) {
logger.debug("Running execute block for activity:{}", delegateExecution.getCurrentActivityId());
AbstractCDSPropertiesBean cdsPropertiesBean = new AbstractCDSPropertiesBean();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java
index 5bf167ea7a..dd2601f0d0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -25,7 +20,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
@@ -48,7 +42,7 @@ public class PrepareConfigAssignDelegate extends PrepareCdsCallDelegate {
}
@Override
- protected String getRequestObject(final DelegateExecution delegateExecution){
+ protected String getRequestObject(final DelegateExecution delegateExecution) {
ConfigAssignPropertiesForPnf configAssignProperties = new ConfigAssignPropertiesForPnf();
configAssignProperties.setServiceInstanceId((String) delegateExecution.getVariable(SERVICE_INSTANCE_ID));
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java
index 5fbed598e3..16f712fa66 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -24,7 +19,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import java.io.IOException;
import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -55,7 +49,7 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate {
}
@Override
- protected String getRequestObject(DelegateExecution delegateExecution){
+ protected String getRequestObject(DelegateExecution delegateExecution) {
ConfigDeployPropertiesForPnf configDeployProperties = new ConfigDeployPropertiesForPnf();
@@ -85,7 +79,8 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate {
return configDeployRequest.toString();
}
- private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties, DelegateExecution delegateExecution) {
+ private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties,
+ DelegateExecution delegateExecution) {
/**
* Retrieve PNF entry from AAI.
@@ -93,21 +88,23 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate {
try {
String pnfName = (String) delegateExecution.getVariable(PNF_CORRELATION_ID);
Optional<Pnf> pnfOptional = pnfManagement.getEntryFor(pnfName);
- if ( pnfOptional.isPresent()){
+ if (pnfOptional.isPresent()) {
Pnf pnf = pnfOptional.get();
/**
- * PRH patches the AAI with oam address.
- * Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy request.
+ * PRH patches the AAI with oam address. Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy
+ * request.
*/
configDeployProperties.setPnfIpV4Address(pnf.getIpaddressV4Oam());
configDeployProperties.setPnfIpV6Address(pnf.getIpaddressV6Oam());
} else {
- exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "AAI entry for PNF: " + pnfName + " does not exist");
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "AAI entry for PNF: " + pnfName + " does not exist");
}
} catch (IOException e) {
logger.warn(e.getMessage(), e);
- exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to fetch from AAI" + e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "Unable to fetch from AAI" + e.getMessage());
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index fb5d04328f..7cb78a10e5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -41,9 +41,8 @@ public final class JsonUtilForPnfCorrelationId {
List<String> list = new ArrayList<>();
Spliterator<JsonElement> spliterator = array.spliterator();
spliterator.forEachRemaining(jsonElement -> {
- handleEscapedCharacters(jsonElement)
- .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
- .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
+ handleEscapedCharacters(jsonElement).ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
+ .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
});
return list;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 6f828f6cb0..3de0f38b70 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -60,12 +60,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class);
executor = null;
getRequest = new HttpGet(UriBuilder.fromUri(env.getProperty("pnf.dmaap.uriPathPrefix"))
- .scheme(env.getProperty("pnf.dmaap.protocol"))
- .host(env.getProperty("pnf.dmaap.host"))
- .port(env.getProperty("pnf.dmaap.port", Integer.class))
- .path(env.getProperty("pnf.dmaap.topicName"))
- .path(env.getProperty("pnf.dmaap.consumerGroup"))
- .path(env.getProperty("pnf.dmaap.consumerId")).build());
+ .scheme(env.getProperty("pnf.dmaap.protocol")).host(env.getProperty("pnf.dmaap.host"))
+ .port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName"))
+ .path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId"))
+ .build());
}
@Override
@@ -92,8 +90,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
executor = new ScheduledThreadPoolExecutor(1);
executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
- executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0,
- topicListenerDelayInSeconds, TimeUnit.SECONDS);
+ executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, topicListenerDelayInSeconds,
+ TimeUnit.SECONDS);
dmaapThreadListenerIsRunning = true;
}
}
@@ -116,8 +114,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
- }
- finally {
+ } finally {
getRequest.reset();
}
}
@@ -136,7 +133,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId);
- //runnable.run();
+ // runnable.run();
runnable = null;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
index 32ea357817..b1af8b1e0b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
@@ -46,8 +46,8 @@ public class PnfManagementImpl implements PnfManagement {
@Override
public void createRelation(String serviceInstanceId, String pnfName) {
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- serviceInstanceId);
+ AAIResourceUri serviceInstanceURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName);
new AAIResourcesClient().connect(serviceInstanceURI, pnfUri);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
index ee8743f846..8b2bb9a8de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
@@ -22,22 +22,22 @@ package org.onap.so.bpmn.infrastructure.properties;
import java.util.Arrays;
import java.util.List;
import org.onap.so.bpmn.core.UrnPropertiesReader;
-
import org.onap.so.bpmn.core.UrnPropertiesReader;
public class BPMNProperties {
public static String getProperty(String key, String defaultValue) {
- String value = UrnPropertiesReader.getVariable(key);
- if (value == null) {
- return defaultValue;
- } else {
- return value;
- }
+ String value = UrnPropertiesReader.getVariable(key);
+ if (value == null) {
+ return defaultValue;
+ } else {
+ return value;
+ }
}
public static List<String> getResourceSequenceProp(String input) {
- String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence");
+ String resourceSequence =
+ UrnPropertiesReader.getVariable("mso.workflow.custom." + input + ".resource.sequence");
if (resourceSequence != null) {
return Arrays.asList(resourceSequence.split(","));
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
index 292f6ef575..2995e24c00 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.vfcmodel;
-
/**
* NS Create Input Parameter For VFC Adapter<br>
* <p>
@@ -44,7 +43,6 @@ public class NSResourceInputParameter {
-
/**
* @return Returns the nsServiceName.
*/
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java
index 81826a27eb..3e35952a9e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java
@@ -21,8 +21,7 @@ package org.onap.so.bpmn.infrastructure.vfcmodel;
/**
- * The operation key object for NS
- * <br>
+ * The operation key object for NS <br>
* <p>
* </p>
*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
index 0d8f2fcbd7..ad388feffc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
@@ -37,7 +37,8 @@ public class NsParameters {
private List<LocationConstraint> locationConstraints;
- private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
+ private Map<String, Object> additionalParamForNs = new HashMap<String, Object>();
+
/**
* @return Returns the locationConstraints.
*/
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java
index 970fa43d9f..8b9295b44f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java
@@ -28,7 +28,7 @@ package org.onap.so.bpmn.infrastructure.vfcmodel;
* </p>
*
* @author
- * @version ONAP Amsterdam Release 2017-10-18
+ * @version ONAP Amsterdam Release 2017-10-18
*/
public class VimLocation {
private String vimId;
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 9b878afb7c..896a8bd98c 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
@@ -73,549 +73,550 @@ import org.springframework.web.util.UriUtils;
public class ServicePluginFactory {
- // SOTN calculate route
- public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc";
-
- public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
-
- public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
-
- private static final int DEFAULT_TIME_OUT = 60000;
-
- static JsonUtils jsonUtil = new JsonUtils();
-
- private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class);
-
- private static ServicePluginFactory instance;
-
-
- public static synchronized ServicePluginFactory getInstance() {
- if (null == instance) {
- instance = new ServicePluginFactory();
- }
- return instance;
- }
-
- private ServicePluginFactory() {
-
- }
-
- private String getInventoryOSSEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT);
- }
-
- private String getThirdSPEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT);
- }
-
- private String getOOFCalcEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT);
- }
-
- @SuppressWarnings("unchecked")
- public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- if(!isNeedProcessSite(uuiRequest)) {
- return uuiRequest;
- }
-
- Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
- if (uuiObject == null) {
- return uuiRequest;
- }
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
- List<Object> resources = (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
-
- if (isSiteLocationLocal(serviceRequestInputs, resources)) {
- // resources changed : added TP info
- return getJsonString(uuiObject);
- }
-
- List<Resource> addResourceList = new ArrayList<>();
- addResourceList.addAll(serviceDecomposition.getServiceResources());
-
- serviceDecomposition.setVnfResources(null);
- serviceDecomposition.setAllottedResources(null);
- serviceDecomposition.setNetworkResources(null);
- serviceDecomposition.setConfigResources(null);
- for (Resource resource : addResourceList) {
- String resourcemodelName = resource.getModelInfo().getModelName();
- if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
- // change serviceDecomposition
- serviceDecomposition.addResource(resource);
- break;
- }
- }
-
- return uuiRequest;
- }
-
- private boolean isNeedProcessSite(String uuiRequest) {
- return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
- }
-
- @SuppressWarnings("unchecked")
- private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {
- Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);
-
- if(tpInfoMap.isEmpty()) {
- return true;
- }
- String host = (String) tpInfoMap.get("host");
- // host is empty means TP is in local, not empty means TP is in remote ONAP
- if (!host.isEmpty()) {
- return false;
- }
-
- Map<String, Object> accessTPInfo = new HashMap<String, Object>();
- accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
- accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
- accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
- accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
- accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
-
- // change resources
- String resourceName = (String) tpInfoMap.get("resourceName");
- for(Object curResource : resources) {
- Map<String, Object> resource = (Map<String, Object>)curResource;
- String curResourceName = (String) resource.get("resourceName");
- curResourceName = curResourceName.replaceAll(" ", "");
- if(resourceName.equalsIgnoreCase(curResourceName)) {
- putResourceRequestInputs(resource, accessTPInfo);
- break;
- }
- }
-
- return true;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
- Object location = null;
- Object clientSignal = null;
- String vpnAttachmentResourceName = null;
-
- // support R2 uuiReq and R1 uuiReq
- // logic for R2 uuiRequest params in service level
- for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
- String key = entry.getKey();
- if (key.toLowerCase().contains("site_address")) {
- location = entry.getValue();
- }
- if (key.toLowerCase().contains("sotncondition_clientsignal")) {
- clientSignal = entry.getValue();
- vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
- }
- }
-
- Map<String, Object> tpInfoMap = new HashMap<String, Object>();
-
- // Site resource has location param and SOTNAttachment resource has clientSignal param
- if(location == null || clientSignal == null ) {
- return tpInfoMap;
- }
-
- // Query terminal points from InventoryOSS system by location.
- String locationAddress = (String) location;
- List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
- if(locationTPList != null && !locationTPList.isEmpty()) {
- for(Object tp: locationTPList) {
- Map<String, Object> tpJson = (Map<String, Object>) tp;
- String loc = (String)tpJson.get ("location");
- if(StringUtils.equalsIgnoreCase (locationAddress, loc)) {
- tpInfoMap = tpJson;
- // add resourceName
- tpInfoMap.put("resourceName", vpnAttachmentResourceName);
- break;
- }
- }
- logger.debug("Get Terminal TP from InventoryOSS");
- return tpInfoMap;
- }
-
- return tpInfoMap;
- }
-
- @SuppressWarnings("unchecked")
- private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
- String url = getInventoryOSSEndPoint();
- url += "/oss/inventory?location=" + UriUtils.encode(locationAddress,"UTF-8");
- String responseContent = sendRequest(url, "GET", "");
- List<Object> accessTPs = new ArrayList<>();
- if (null != responseContent) {
- accessTPs = getJsonObject(responseContent, List.class);
- }
- return accessTPs;
- }
-
- @SuppressWarnings("unchecked")
- private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
- Map<String, Object> resourceParametersObject = new HashMap<>();
- Map<String, Object> resourceRequestInputs = new HashMap<>();
- resourceRequestInputs.put("requestInputs", resourceInputs);
- resourceParametersObject.put("parameters", resourceRequestInputs);
-
- if(resource.containsKey("parameters")) {
- Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
- if(resParametersObject.containsKey("requestInputs")) {
- Map<String, Object> resRequestInputs = (Map<String, Object>) resourceRequestInputs.get("requestInputs");
- Map<String, Object> oldRequestInputs = (Map<String, Object>) resParametersObject.get("requestInputs");
- if(oldRequestInputs != null) {
- oldRequestInputs.putAll(resRequestInputs);
- }
- else {
- resParametersObject.put("requestInputs", resRequestInputs);
- }
- }
- else {
- resParametersObject.putAll(resourceRequestInputs);
- }
- }
- else {
- resource.putAll(resourceParametersObject);
- }
-
- return;
- }
-
-
-
- @SuppressWarnings("unchecked")
- public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {
- Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
- if (uuiObject == null) {
- return uuiRequest;
- }
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
-
- if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
- return uuiRequest;
- }
-
- allocateCrossTPResources(execution, serviceRequestInputs);
- return getJsonString(uuiObject);
- }
-
- @SuppressWarnings("unchecked")
- private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
- if(serviceRequestInputs.containsKey("CallSource"))
- {
- String callSource = (String) serviceRequestInputs.get("CallSource");
- if("ExternalAPI".equalsIgnoreCase(callSource)) {
- return false;
- }
- }
- for (String input : serviceRequestInputs.keySet())
- {
- if(input.toLowerCase().contains("sotnconnectivity")) {
- return true;
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
-
- Map<String, Object> crossTPs = this.getTPsfromAAI();
-
- if(crossTPs == null || crossTPs.isEmpty()) {
- serviceRequestInputs.put("local-access-provider-id", "");
- serviceRequestInputs.put("local-access-client-id", "");
- serviceRequestInputs.put("local-access-topology-id", "");
- serviceRequestInputs.put("local-access-node-id", "");
- serviceRequestInputs.put("local-access-ltp-id", "");
- serviceRequestInputs.put("remote-access-provider-id", "");
- serviceRequestInputs.put("remote-access-client-id", "");
- serviceRequestInputs.put("remote-access-topology-id", "");
- serviceRequestInputs.put("remote-access-node-id", "");
- serviceRequestInputs.put("remote-access-ltp-id", "");
- }
- else {
- serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
- serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
- serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
- serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
- serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
- serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
- serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
- serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
- serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
- serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
- }
-
- return;
- }
-
- // This method returns Local and remote TPs information from AAI
- public Map getTPsfromAAI() {
- Map<String, Object> tpInfo = new HashMap<>();
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
- AAIResourcesClient client = new AAIResourcesClient();
- Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
-
- if (result.isPresent()) {
- LogicalLinks links = result.get();
- boolean isRemoteLink = false;
-
- links.getLogicalLink();
-
- for (LogicalLink link : links.getLogicalLink()) {
- AAIResultWrapper wrapper = new AAIResultWrapper(link);
- Optional<Relationships> optRelationships = wrapper.getRelationships();
- List<AAIResourceUri> pInterfaces = new ArrayList<>();
- if (optRelationships.isPresent()) {
- Relationships relationships = optRelationships.get();
- if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) {
- isRemoteLink = true;
- }
- pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
- }
-
- if (isRemoteLink) {
- // find remote p interface
- AAIResourceUri localTP = null;
- AAIResourceUri remoteTP = null;
-
- AAIResourceUri pInterface0 = pInterfaces.get(0);
-
- if (isRemotePInterface(client, pInterface0)) {
- remoteTP = pInterfaces.get(0);
- localTP = pInterfaces.get(1);
- } else {
- localTP = pInterfaces.get(0);
- remoteTP = pInterfaces.get(1);
- }
-
- if (localTP != null && remoteTP != null) {
- // give local tp
- String tpUrl = localTP.build().toString();
- PInterface intfLocal = client.get(PInterface.class, localTP).get();
- tpInfo.put("local-access-node-id", tpUrl.split("/")[6]);
-
- String[] networkRef = intfLocal.getNetworkRef().split("/");
- if (networkRef.length == 6) {
- tpInfo.put("local-access-provider-id", networkRef[1]);
- tpInfo.put("local-access-client-id", networkRef[3]);
- tpInfo.put("local-access-topology-id", networkRef[5]);
- }
- String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStr.contains("-")) {
- tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
- }
-
- // give remote tp
- tpUrl = remoteTP.build().toString();
- PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
- tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]);
-
- String[] networkRefRemote = intfRemote.getNetworkRef().split("/");
-
- if (networkRefRemote.length == 6) {
- tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
- tpInfo.put("remote-access-client-id", networkRefRemote[3]);
- tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
- }
- String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStrR.contains("-")) {
- tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
- }
- return tpInfo;
- }
- }
- }
- }
- return tpInfo;
- }
-
- // this method check if pInterface is remote
- private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
-
- String uriString = uri.build().toString();
-
- if (uriString != null) {
- // get the pnfname
- String[] token = uriString.split("/");
- AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]);
-
- AAIResultWrapper wrapper = client.get(parent);
- Optional<Relationships> optRelationships = wrapper.getRelationships();
- if (optRelationships.isPresent()) {
- Relationships relationships = optRelationships.get();
-
- return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
- }
- }
-
- return false;
- }
-
- public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
-
- // now only for sotn
- if (isSOTN(serviceDecomposition, uuiRequest)) {
- // We Need to query the terminalpoint of the VPN by site location
- // info
- return preProcessSOTNService(serviceDecomposition, uuiRequest);
- }
- return uuiRequest;
- }
-
- public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- // now only for sotn
- if (isSOTN(serviceDecomposition, uuiRequest)) {
- return doSOTNServiceHoming(serviceDecomposition, uuiRequest);
- }
- return uuiRequest;
- }
-
- private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- // there should be a register platform , we check it very simple here.
- return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType");
- }
-
- @SuppressWarnings("unchecked")
- private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
- if (uuiObject == null) {
- return uuiRequest;
- }
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
- List<Object> resources = (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
- // This is a logic for demo , it could not be finalized to community.
- String srcLocation = "";
- String dstLocation = "";
- String srcClientSignal = "";
- String dstClientSignal = "";
- // support R2 uuiReq and R1 uuiReq
- // logic for R2 uuiRequest params in service level
- for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
- if (entry.getKey().toLowerCase().contains("location")) {
- if ("".equals(srcLocation)) {
- srcLocation = (String) entry.getValue();
- } else if ("".equals(dstLocation)) {
- dstLocation = (String) entry.getValue();
- }
- }
- if (entry.getKey().toLowerCase().contains("clientsignal")) {
- if ("".equals(srcClientSignal)) {
- srcClientSignal = (String) entry.getValue();
- } else if ("".equals(dstClientSignal)) {
- dstClientSignal = (String) entry.getValue();
- }
- }
- }
-
- // logic for R1 uuiRequest, params in resource level
- for (Object resource : resources) {
- Map<String, Object> resourceObject = (Map<String, Object>) resource;
- Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
- for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
- if (entry.getKey().toLowerCase().contains("location")) {
- if ("".equals(srcLocation)) {
- srcLocation = (String) entry.getValue();
- } else if ("".equals(dstLocation)) {
- dstLocation = (String) entry.getValue();
- }
- }
- if (entry.getKey().toLowerCase().contains("clientsignal")) {
- if ("".equals(srcClientSignal)) {
- srcClientSignal = (String) entry.getValue();
- } else if ("".equals(dstClientSignal)) {
- dstClientSignal = (String) entry.getValue();
- }
- }
- }
- }
-
- Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
- // here we put client signal to vpn resource inputs
- if(null!=vpnRequestInputs) {
- vpnRequestInputs.put("src-client-signal", srcClientSignal);
- vpnRequestInputs.put("dst-client-signal", dstClientSignal);
- }
-
-
- // Now we need to query terminal points from SP resourcemgr system.
- List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation);
- Map<String, Object> tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(0);
-
- serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id"));
- serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id"));
- serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id"));
- serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id"));
- serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id"));
- tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(1);
-
- serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id"));
- serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id"));
- serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id"));
- serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id"));
- serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id"));
-
- String newRequest = getJsonString(uuiObject);
- return newRequest;
- }
-
- private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
- Map<String, String> locationSrc = new HashMap<>();
- locationSrc.put("location", srcLocation);
- Map<String, String> locationDst = new HashMap<>();
- locationDst.put("location", dstLocation);
- List<Map<String, String>> locations = new ArrayList<>();
- locations.add(locationSrc);
- locations.add(locationDst);
- List<Object> returnList = new ArrayList<>();
- String reqContent = getJsonString(locations);
- String url = getThirdSPEndPoint();
- String responseContent = sendRequest(url, "POST", reqContent);
- if (null != responseContent) {
- returnList = getJsonObject(responseContent, List.class);
- }
- return returnList;
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
- for (Object resource : resources) {
- Map<String, Object> resourceObject = (Map<String, Object>) resource;
- Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
- for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
- if (entry.getKey().toLowerCase().contains("vpntype")) {
- return resourceRequestInputs;
- }
- }
- }
- return null;
- }
-
- public static void main(String args[]){
- String str = "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/";
-
- int index1 = str.indexOf("/network/");
- int index2 = str.indexOf("/network-data");
-
- String str1 = str.substring(index1 + "/network/".length(), index2);
- System.out.println(str1);
-
- }
+ // SOTN calculate route
+ public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc";
+
+ public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
+
+ public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
+
+ private static final int DEFAULT_TIME_OUT = 60000;
+
+ static JsonUtils jsonUtil = new JsonUtils();
+
+ private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class);
+
+ private static ServicePluginFactory instance;
+
+
+ public static synchronized ServicePluginFactory getInstance() {
+ if (null == instance) {
+ instance = new ServicePluginFactory();
+ }
+ return instance;
+ }
+
+ private ServicePluginFactory() {
+
+ }
+
+ private String getInventoryOSSEndPoint() {
+ return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint",
+ INVENTORY_OSS_DEFAULT_ENDPOINT);
+ }
+
+ private String getThirdSPEndPoint() {
+ return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT);
+ }
+
+ private String getOOFCalcEndPoint() {
+ return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT);
+ }
+
+ @SuppressWarnings("unchecked")
+ public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ if (!isNeedProcessSite(uuiRequest)) {
+ return uuiRequest;
+ }
+
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ if (uuiObject == null) {
+ return uuiRequest;
+ }
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
+ List<Object> resources =
+ (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
+
+ if (isSiteLocationLocal(serviceRequestInputs, resources)) {
+ // resources changed : added TP info
+ return getJsonString(uuiObject);
+ }
+
+ List<Resource> addResourceList = new ArrayList<>();
+ addResourceList.addAll(serviceDecomposition.getServiceResources());
+
+ serviceDecomposition.setVnfResources(null);
+ serviceDecomposition.setAllottedResources(null);
+ serviceDecomposition.setNetworkResources(null);
+ serviceDecomposition.setConfigResources(null);
+ for (Resource resource : addResourceList) {
+ String resourcemodelName = resource.getModelInfo().getModelName();
+ if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
+ // change serviceDecomposition
+ serviceDecomposition.addResource(resource);
+ break;
+ }
+ }
+
+ return uuiRequest;
+ }
+
+ private boolean isNeedProcessSite(String uuiRequest) {
+ return uuiRequest.toLowerCase().contains("site_address")
+ && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {
+ Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);
+
+ if (tpInfoMap.isEmpty()) {
+ return true;
+ }
+ String host = (String) tpInfoMap.get("host");
+ // host is empty means TP is in local, not empty means TP is in remote ONAP
+ if (!host.isEmpty()) {
+ return false;
+ }
+
+ Map<String, Object> accessTPInfo = new HashMap<String, Object>();
+ accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
+ accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
+ accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
+ accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
+ accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+ // change resources
+ String resourceName = (String) tpInfoMap.get("resourceName");
+ for (Object curResource : resources) {
+ Map<String, Object> resource = (Map<String, Object>) curResource;
+ String curResourceName = (String) resource.get("resourceName");
+ curResourceName = curResourceName.replaceAll(" ", "");
+ if (resourceName.equalsIgnoreCase(curResourceName)) {
+ putResourceRequestInputs(resource, accessTPInfo);
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
+ Object location = null;
+ Object clientSignal = null;
+ String vpnAttachmentResourceName = null;
+
+ // support R2 uuiReq and R1 uuiReq
+ // logic for R2 uuiRequest params in service level
+ for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+ String key = entry.getKey();
+ if (key.toLowerCase().contains("site_address")) {
+ location = entry.getValue();
+ }
+ if (key.toLowerCase().contains("sotncondition_clientsignal")) {
+ clientSignal = entry.getValue();
+ vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
+ }
+ }
+
+ Map<String, Object> tpInfoMap = new HashMap<String, Object>();
+
+ // Site resource has location param and SOTNAttachment resource has clientSignal param
+ if (location == null || clientSignal == null) {
+ return tpInfoMap;
+ }
+
+ // Query terminal points from InventoryOSS system by location.
+ String locationAddress = (String) location;
+ List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
+ if (locationTPList != null && !locationTPList.isEmpty()) {
+ for (Object tp : locationTPList) {
+ Map<String, Object> tpJson = (Map<String, Object>) tp;
+ String loc = (String) tpJson.get("location");
+ if (StringUtils.equalsIgnoreCase(locationAddress, loc)) {
+ tpInfoMap = tpJson;
+ // add resourceName
+ tpInfoMap.put("resourceName", vpnAttachmentResourceName);
+ break;
+ }
+ }
+ logger.debug("Get Terminal TP from InventoryOSS");
+ return tpInfoMap;
+ }
+
+ return tpInfoMap;
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
+ String url = getInventoryOSSEndPoint();
+ url += "/oss/inventory?location=" + UriUtils.encode(locationAddress, "UTF-8");
+ String responseContent = sendRequest(url, "GET", "");
+ List<Object> accessTPs = new ArrayList<>();
+ if (null != responseContent) {
+ accessTPs = getJsonObject(responseContent, List.class);
+ }
+ return accessTPs;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
+ Map<String, Object> resourceParametersObject = new HashMap<>();
+ Map<String, Object> resourceRequestInputs = new HashMap<>();
+ resourceRequestInputs.put("requestInputs", resourceInputs);
+ resourceParametersObject.put("parameters", resourceRequestInputs);
+
+ if (resource.containsKey("parameters")) {
+ Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
+ if (resParametersObject.containsKey("requestInputs")) {
+ Map<String, Object> resRequestInputs = (Map<String, Object>) resourceRequestInputs.get("requestInputs");
+ Map<String, Object> oldRequestInputs = (Map<String, Object>) resParametersObject.get("requestInputs");
+ if (oldRequestInputs != null) {
+ oldRequestInputs.putAll(resRequestInputs);
+ } else {
+ resParametersObject.put("requestInputs", resRequestInputs);
+ }
+ } else {
+ resParametersObject.putAll(resourceRequestInputs);
+ }
+ } else {
+ resource.putAll(resourceParametersObject);
+ }
+
+ return;
+ }
+
+
+
+ @SuppressWarnings("unchecked")
+ public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ if (uuiObject == null) {
+ return uuiRequest;
+ }
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
+
+ if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
+ return uuiRequest;
+ }
+
+ allocateCrossTPResources(execution, serviceRequestInputs);
+ return getJsonString(uuiObject);
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
+ if (serviceRequestInputs.containsKey("CallSource")) {
+ String callSource = (String) serviceRequestInputs.get("CallSource");
+ if ("ExternalAPI".equalsIgnoreCase(callSource)) {
+ return false;
+ }
+ }
+ for (String input : serviceRequestInputs.keySet()) {
+ if (input.toLowerCase().contains("sotnconnectivity")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
+
+ Map<String, Object> crossTPs = this.getTPsfromAAI();
+
+ if (crossTPs == null || crossTPs.isEmpty()) {
+ serviceRequestInputs.put("local-access-provider-id", "");
+ serviceRequestInputs.put("local-access-client-id", "");
+ serviceRequestInputs.put("local-access-topology-id", "");
+ serviceRequestInputs.put("local-access-node-id", "");
+ serviceRequestInputs.put("local-access-ltp-id", "");
+ serviceRequestInputs.put("remote-access-provider-id", "");
+ serviceRequestInputs.put("remote-access-client-id", "");
+ serviceRequestInputs.put("remote-access-topology-id", "");
+ serviceRequestInputs.put("remote-access-node-id", "");
+ serviceRequestInputs.put("remote-access-ltp-id", "");
+ } else {
+ serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
+ serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
+ serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
+ serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
+ serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
+ serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
+ serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
+ serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
+ serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
+ serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
+ }
+
+ return;
+ }
+
+ // This method returns Local and remote TPs information from AAI
+ public Map getTPsfromAAI() {
+ Map<String, Object> tpInfo = new HashMap<>();
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
+ AAIResourcesClient client = new AAIResourcesClient();
+ Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
+
+ if (result.isPresent()) {
+ LogicalLinks links = result.get();
+ boolean isRemoteLink = false;
+
+ links.getLogicalLink();
+
+ for (LogicalLink link : links.getLogicalLink()) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(link);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ List<AAIResourceUri> pInterfaces = new ArrayList<>();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+ if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) {
+ isRemoteLink = true;
+ }
+ pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
+ }
+
+ if (isRemoteLink) {
+ // find remote p interface
+ AAIResourceUri localTP = null;
+ AAIResourceUri remoteTP = null;
+
+ AAIResourceUri pInterface0 = pInterfaces.get(0);
+
+ if (isRemotePInterface(client, pInterface0)) {
+ remoteTP = pInterfaces.get(0);
+ localTP = pInterfaces.get(1);
+ } else {
+ localTP = pInterfaces.get(0);
+ remoteTP = pInterfaces.get(1);
+ }
+
+ if (localTP != null && remoteTP != null) {
+ // give local tp
+ String tpUrl = localTP.build().toString();
+ PInterface intfLocal = client.get(PInterface.class, localTP).get();
+ tpInfo.put("local-access-node-id", tpUrl.split("/")[6]);
+
+ String[] networkRef = intfLocal.getNetworkRef().split("/");
+ if (networkRef.length == 6) {
+ tpInfo.put("local-access-provider-id", networkRef[1]);
+ tpInfo.put("local-access-client-id", networkRef[3]);
+ tpInfo.put("local-access-topology-id", networkRef[5]);
+ }
+ String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStr.contains("-")) {
+ tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+
+ // give remote tp
+ tpUrl = remoteTP.build().toString();
+ PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
+ tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]);
+
+ String[] networkRefRemote = intfRemote.getNetworkRef().split("/");
+
+ if (networkRefRemote.length == 6) {
+ tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
+ tpInfo.put("remote-access-client-id", networkRefRemote[3]);
+ tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
+ }
+ String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStrR.contains("-")) {
+ tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+ return tpInfo;
+ }
+ }
+ }
+ }
+ return tpInfo;
+ }
+
+ // this method check if pInterface is remote
+ private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) {
+
+ String uriString = uri.build().toString();
+
+ if (uriString != null) {
+ // get the pnfname
+ String[] token = uriString.split("/");
+ AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]);
+
+ AAIResultWrapper wrapper = client.get(parent);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+
+ return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
+ }
+ }
+
+ return false;
+ }
+
+ public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+
+ // now only for sotn
+ if (isSOTN(serviceDecomposition, uuiRequest)) {
+ // We Need to query the terminalpoint of the VPN by site location
+ // info
+ return preProcessSOTNService(serviceDecomposition, uuiRequest);
+ }
+ return uuiRequest;
+ }
+
+ public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ // now only for sotn
+ if (isSOTN(serviceDecomposition, uuiRequest)) {
+ return doSOTNServiceHoming(serviceDecomposition, uuiRequest);
+ }
+ return uuiRequest;
+ }
+
+ private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ // there should be a register platform , we check it very simple here.
+ return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType");
+ }
+
+ @SuppressWarnings("unchecked")
+ private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ if (uuiObject == null) {
+ return uuiRequest;
+ }
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
+ List<Object> resources =
+ (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
+ // This is a logic for demo , it could not be finalized to community.
+ String srcLocation = "";
+ String dstLocation = "";
+ String srcClientSignal = "";
+ String dstClientSignal = "";
+ // support R2 uuiReq and R1 uuiReq
+ // logic for R2 uuiRequest params in service level
+ for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("location")) {
+ if ("".equals(srcLocation)) {
+ srcLocation = (String) entry.getValue();
+ } else if ("".equals(dstLocation)) {
+ dstLocation = (String) entry.getValue();
+ }
+ }
+ if (entry.getKey().toLowerCase().contains("clientsignal")) {
+ if ("".equals(srcClientSignal)) {
+ srcClientSignal = (String) entry.getValue();
+ } else if ("".equals(dstClientSignal)) {
+ dstClientSignal = (String) entry.getValue();
+ }
+ }
+ }
+
+ // logic for R1 uuiRequest, params in resource level
+ for (Object resource : resources) {
+ Map<String, Object> resourceObject = (Map<String, Object>) resource;
+ Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
+ Map<String, Object> resourceRequestInputs =
+ (Map<String, Object>) resourceParametersObject.get("requestInputs");
+ for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("location")) {
+ if ("".equals(srcLocation)) {
+ srcLocation = (String) entry.getValue();
+ } else if ("".equals(dstLocation)) {
+ dstLocation = (String) entry.getValue();
+ }
+ }
+ if (entry.getKey().toLowerCase().contains("clientsignal")) {
+ if ("".equals(srcClientSignal)) {
+ srcClientSignal = (String) entry.getValue();
+ } else if ("".equals(dstClientSignal)) {
+ dstClientSignal = (String) entry.getValue();
+ }
+ }
+ }
+ }
+
+ Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
+ // here we put client signal to vpn resource inputs
+ if (null != vpnRequestInputs) {
+ vpnRequestInputs.put("src-client-signal", srcClientSignal);
+ vpnRequestInputs.put("dst-client-signal", dstClientSignal);
+ }
+
+
+ // Now we need to query terminal points from SP resourcemgr system.
+ List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation);
+ Map<String, Object> tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(0);
+
+ serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id"));
+ serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id"));
+ serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id"));
+ serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id"));
+ serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id"));
+ tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(1);
+
+ serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id"));
+ serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id"));
+ serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id"));
+ serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id"));
+ serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
+ }
+
+ private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
+ Map<String, String> locationSrc = new HashMap<>();
+ locationSrc.put("location", srcLocation);
+ Map<String, String> locationDst = new HashMap<>();
+ locationDst.put("location", dstLocation);
+ List<Map<String, String>> locations = new ArrayList<>();
+ locations.add(locationSrc);
+ locations.add(locationDst);
+ List<Object> returnList = new ArrayList<>();
+ String reqContent = getJsonString(locations);
+ String url = getThirdSPEndPoint();
+ String responseContent = sendRequest(url, "POST", reqContent);
+ if (null != responseContent) {
+ returnList = getJsonObject(responseContent, List.class);
+ }
+ return returnList;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
+ for (Object resource : resources) {
+ Map<String, Object> resourceObject = (Map<String, Object>) resource;
+ Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
+ Map<String, Object> resourceRequestInputs =
+ (Map<String, Object>) resourceParametersObject.get("requestInputs");
+ for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("vpntype")) {
+ return resourceRequestInputs;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void main(String args[]) {
+ String str =
+ "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/";
+
+ int index1 = str.indexOf("/network/");
+ int index2 = str.indexOf("/network-data");
+
+ String str1 = str.substring(index1 + "/network/".length(), index2);
+ System.out.println(str1);
+
+ }
@SuppressWarnings("unchecked")
private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) {
@@ -624,15 +625,15 @@ public class ServicePluginFactory {
if (uuiObject == null) {
return uuiRequest;
}
- Map<String, Object> serviceObject = (Map<String, Object>) uuiObject
- .getOrDefault("service", Collections.emptyMap());
- Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject
- .getOrDefault("parameters", Collections.emptyMap());
- Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject
- .getOrDefault("requestInputs", Collections.emptyMap());
+ Map<String, Object> serviceObject =
+ (Map<String, Object>) uuiObject.getOrDefault("service", Collections.emptyMap());
+ Map<String, Object> serviceParametersObject =
+ (Map<String, Object>) serviceObject.getOrDefault("parameters", Collections.emptyMap());
+ Map<String, Object> serviceRequestInputs =
+ (Map<String, Object>) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap());
Map<String, Object> oofQueryObject = new HashMap<>();
- List<Object> resources = (List<Object>) serviceParametersObject
- .getOrDefault("resources", Collections.emptyList());
+ List<Object> resources =
+ (List<Object>) serviceParametersObject.getOrDefault("resources", Collections.emptyList());
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"));
oofQueryObject.put("src-access-topology-id", serviceRequestInputs.get("inner-src-access-topology-id"));
@@ -660,147 +661,144 @@ public class ServicePluginFactory {
return getJsonString(uuiObject);
}
- private Map<String, Object> getReturnRoute(List<Object> returnList){
- 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");
- if("100".equals(accessTopoId)){
- returnRoute.putAll(returnVpnInfo);
- }
- else if("101".equals(accessTopoId)){
- for(String key : returnVpnInfo.keySet()){
- returnRoute.put("domain1-" + key, returnVpnInfo.get(key));
- }
- }
- else if("102".equals(accessTopoId)){
- for(String key : returnVpnInfo.keySet()){
- returnRoute.put("domain2-" + key, returnVpnInfo.get(key));
- }
- }
- else{
- for(String key : returnVpnInfo.keySet()){
- returnRoute.put("domain" + accessTopoId +"-" + key, returnVpnInfo.get(key));
- }
- }
- }
- return returnRoute;
- }
-
- private Map<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid,
- String serviceParameters) {
- List<String> resourceList = jsonUtil.StringArrayToList(execution,
- JsonUtils.getJsonValue(serviceParameters, "resources"));
- // Get the right location str for resource. default is an empty array.
- String resourceInputsFromUui = "";
- for (String resource : resourceList) {
- String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
- if (resourceCustomizationUuid.equals(resCusUuid)) {
- String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
- resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
- }
- }
- Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
- return resourceInputsFromUuiMap;
- }
-
- private static <T> T getJsonObject(String jsonstr, Class<T> type) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- try {
- return mapper.readValue(jsonstr, type);
- } catch (IOException e) {
- logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
- ErrorCode.BusinessProcesssError.getValue(), e);
- }
- return null;
- }
-
- public static String getJsonString(Object srcObj) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
- String jsonStr = null;
- try {
- jsonStr = mapper.writeValueAsString(srcObj);
- } catch (JsonProcessingException e) {
- logger.debug("SdcToscaParserException", e);
- }
- return jsonStr;
- }
-
- private static String sendRequest(String url, String methodType, String content) {
-
- String msbUrl = url;
- HttpRequestBase method = null;
- HttpResponse httpResponse = null;
-
- try {
- int timeout = DEFAULT_TIME_OUT;
-
- RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
- .setConnectionRequestTimeout(timeout).build();
-
- HttpClient client = HttpClientBuilder.create().build();
-
- if ("POST".equals(methodType.toUpperCase())) {
- HttpPost httpPost = new HttpPost(msbUrl);
- httpPost.setConfig(requestConfig);
- httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
- method = httpPost;
- } else if ("PUT".equals(methodType.toUpperCase())) {
- HttpPut httpPut = new HttpPut(msbUrl);
- httpPut.setConfig(requestConfig);
- httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
- method = httpPut;
- } else if ("GET".equals(methodType.toUpperCase())) {
- HttpGet httpGet = new HttpGet(msbUrl);
- httpGet.setConfig(requestConfig);
- httpGet.addHeader("X-FromAppId", "MSO");
- httpGet.addHeader("Accept","application/json");
- method = httpGet;
- } else if ("DELETE".equals(methodType.toUpperCase())) {
- HttpDelete httpDelete = new HttpDelete(msbUrl);
- httpDelete.setConfig(requestConfig);
- method = httpDelete;
- }
-
- httpResponse = client.execute(method);
- String responseContent = null;
- if (null != httpResponse && httpResponse.getEntity() != null) {
- try {
- responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
- } catch (ParseException e) {
- logger.debug("ParseException in sendrequest", e);
- } catch (IOException e) {
- logger.debug("IOException in sendrequest", e);
- }
- }
- if (null != method) {
- method.reset();
- }
- method = null;
- return responseContent;
-
- } catch (SocketTimeoutException | ConnectTimeoutException e) {
- return null;
-
- } catch (Exception e) {
- return null;
-
- } finally {
- if (httpResponse != null) {
- try {
- EntityUtils.consume(httpResponse.getEntity());
- } catch (Exception e) {
- }
- }
- if (method != null) {
- try {
- method.reset();
- } catch (Exception e) {
-
- }
- }
- }
- }
+ private Map<String, Object> getReturnRoute(List<Object> returnList) {
+ 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");
+ if ("100".equals(accessTopoId)) {
+ returnRoute.putAll(returnVpnInfo);
+ } else if ("101".equals(accessTopoId)) {
+ for (String key : returnVpnInfo.keySet()) {
+ returnRoute.put("domain1-" + key, returnVpnInfo.get(key));
+ }
+ } else if ("102".equals(accessTopoId)) {
+ for (String key : returnVpnInfo.keySet()) {
+ returnRoute.put("domain2-" + key, returnVpnInfo.get(key));
+ }
+ } else {
+ for (String key : returnVpnInfo.keySet()) {
+ returnRoute.put("domain" + accessTopoId + "-" + key, returnVpnInfo.get(key));
+ }
+ }
+ }
+ return returnRoute;
+ }
+
+ private Map<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid,
+ String serviceParameters) {
+ List<String> resourceList =
+ jsonUtil.StringArrayToList(execution, JsonUtils.getJsonValue(serviceParameters, "resources"));
+ // Get the right location str for resource. default is an empty array.
+ String resourceInputsFromUui = "";
+ for (String resource : resourceList) {
+ String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
+ if (resourceCustomizationUuid.equals(resCusUuid)) {
+ String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
+ resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
+ }
+ }
+ Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
+ return resourceInputsFromUuiMap;
+ }
+
+ private static <T> T getJsonObject(String jsonstr, Class<T> type) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ try {
+ return mapper.readValue(jsonstr, type);
+ } catch (IOException e) {
+ logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), e);
+ }
+ return null;
+ }
+
+ public static String getJsonString(Object srcObj) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ String jsonStr = null;
+ try {
+ jsonStr = mapper.writeValueAsString(srcObj);
+ } catch (JsonProcessingException e) {
+ logger.debug("SdcToscaParserException", e);
+ }
+ return jsonStr;
+ }
+
+ private static String sendRequest(String url, String methodType, String content) {
+
+ String msbUrl = url;
+ HttpRequestBase method = null;
+ HttpResponse httpResponse = null;
+
+ try {
+ int timeout = DEFAULT_TIME_OUT;
+
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+ .setConnectionRequestTimeout(timeout).build();
+
+ HttpClient client = HttpClientBuilder.create().build();
+
+ if ("POST".equals(methodType.toUpperCase())) {
+ HttpPost httpPost = new HttpPost(msbUrl);
+ httpPost.setConfig(requestConfig);
+ httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+ method = httpPost;
+ } else if ("PUT".equals(methodType.toUpperCase())) {
+ HttpPut httpPut = new HttpPut(msbUrl);
+ httpPut.setConfig(requestConfig);
+ httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+ method = httpPut;
+ } else if ("GET".equals(methodType.toUpperCase())) {
+ HttpGet httpGet = new HttpGet(msbUrl);
+ httpGet.setConfig(requestConfig);
+ httpGet.addHeader("X-FromAppId", "MSO");
+ httpGet.addHeader("Accept", "application/json");
+ method = httpGet;
+ } else if ("DELETE".equals(methodType.toUpperCase())) {
+ HttpDelete httpDelete = new HttpDelete(msbUrl);
+ httpDelete.setConfig(requestConfig);
+ method = httpDelete;
+ }
+
+ httpResponse = client.execute(method);
+ String responseContent = null;
+ if (null != httpResponse && httpResponse.getEntity() != null) {
+ try {
+ responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+ } catch (ParseException e) {
+ logger.debug("ParseException in sendrequest", e);
+ } catch (IOException e) {
+ logger.debug("IOException in sendrequest", e);
+ }
+ }
+ if (null != method) {
+ method.reset();
+ }
+ method = null;
+ return responseContent;
+
+ } catch (SocketTimeoutException | ConnectTimeoutException e) {
+ return null;
+
+ } catch (Exception e) {
+ return null;
+
+ } finally {
+ if (httpResponse != null) {
+ try {
+ EntityUtils.consume(httpResponse.getEntity());
+ } catch (Exception e) {
+ }
+ }
+ if (method != null) {
+ try {
+ method.reset();
+ } catch (Exception e) {
+
+ }
+ }
+ }
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 4c9bb4259e..5451f9ff57 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -27,7 +27,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -52,7 +51,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -69,30 +67,31 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private static final String TOPOLOGY_PROPERTIES = "topology.properties";
public static final String ONAP_IP = "ONAP_IP";
- private static final String POST_BODY_TEMPLATE = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"+
- " <ns:updateResourceOperationStatus>\n"+
- " <errorCode>$errorCode</errorCode>\n"+
- " <jobId>$jobId</jobId>\n"+
- " <operType>$operType</operType>\n"+
- " <operationId>$operationId</operationId>\n"+
- " <progress>$progress</progress>\n"+
- " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"+
- " <serviceId>$serviceId</serviceId>\n"+
- " <status>$status</status>\n"+
- " <statusDescription>$statusDescription</statusDescription>\n"+
- " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
-
- private static final String GET_BODY_TEMPLATE = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n" +
- " <ns:getResourceOperationStatus>\n" +
- " <operationId>$operationId</operationId>\n" +
- " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n" +
- " <serviceId>$serviceId</serviceId>\n" +
- " </ns:getResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
+ private static final String POST_BODY_TEMPLATE =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"
+ + " <ns:updateResourceOperationStatus>\n"
+ + " <errorCode>$errorCode</errorCode>\n" + " <jobId>$jobId</jobId>\n"
+ + " <operType>$operType</operType>\n"
+ + " <operationId>$operationId</operationId>\n"
+ + " <progress>$progress</progress>\n"
+ + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"
+ + " <serviceId>$serviceId</serviceId>\n"
+ + " <status>$status</status>\n"
+ + " <statusDescription>$statusDescription</statusDescription>\n"
+ + " </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
+
+ private static final String GET_BODY_TEMPLATE =
+ " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.onap.so/requestsdb\"><soapenv:Header/><soapenv:Body>\n"
+ + " <ns:getResourceOperationStatus>\n"
+ + " <operationId>$operationId</operationId>\n"
+ + " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n"
+ + " <serviceId>$serviceId</serviceId>\n"
+ + " </ns:getResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException {
logger.info("AbstractSdncOperationTask.updateResOperStatus begin!");
- String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
+ String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
@@ -119,12 +118,13 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
String result = null;
String errorMsg;
- try(CloseableHttpClient httpClient = HttpClients.createDefault()) {
+ try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost);
result = EntityUtils.toString(closeableHttpResponse.getEntity());
logger.info("result = {}", result);
- if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
- logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode());
+ if (closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
+ logger.info("exception: fail for status code = {}",
+ closeableHttpResponse.getStatusLine().getStatusCode());
throw new RouteException(result, "SERVICE_GET_ERR");
}
@@ -171,9 +171,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
return getBody;
}
- private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException {
+ private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId,
+ String resourceTemplateUUID) throws RouteException {
logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!");
- String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
+ String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
@@ -224,7 +225,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.error("exception: AbstractSdncOperationTask.fail!:", e);
logger.error(Arrays.toString(e.getStackTrace()));
execution.setVariable("SDNCA_SuccessIndicator", false);
- updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!");
+ updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100",
+ "sendRestrequestAndHandleResponse finished!");
}
logger.info("AbstractSdncOperationTask.execute end!");
@@ -247,15 +249,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
return inputs;
}
- public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception;
+ public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) throws Exception;
- public void updateProgress(DelegateExecution execution,
- String status,
- String errorCode,
- String progress,
- String statusDescription) {
+ public void updateProgress(DelegateExecution execution, String status, String errorCode, String progress,
+ String statusDescription) {
logger.info("AbstractSdncOperationTask.updateProgress begin!");
String serviceId = (String) execution.getVariable("serviceId");
serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
@@ -265,7 +263,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID;
resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID;
try {
- ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
+ ResourceOperationStatus resourceOperationStatus =
+ getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
if (!StringUtils.isBlank(status)) {
resourceOperationStatus.setStatus(status);
}
@@ -284,8 +283,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("exception: AbstractSdncOperationTask.updateProgress fail!");
logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception);
logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- " updateProgress catch exception: ", this.getTaskName(),
- ErrorCode.UnknownError.getValue(), exception.getClass().toString());
+ " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(),
+ exception.getClass().toString());
}
}
@@ -293,11 +292,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
protected boolean isSend2SdncDirectly() {
logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!");
String sdncHost = UrnPropertiesReader.getVariable("sdnc.host");
- if (!StringUtils.isBlank(sdncHost)) {
- logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true.");
- return true;
- }
-
+ if (!StringUtils.isBlank(sdncHost)) {
+ logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true.");
+ return true;
+ }
+
logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false.");
return false;
}
@@ -305,7 +304,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
protected String getSdncIp() {
logger.info("AbstractSdncOperationTask.getSdncIp begin.");
String sdncIp = null;
- sdncIp = UrnPropertiesReader.getVariable("sdnc-ip");
+ sdncIp = UrnPropertiesReader.getVariable("sdnc-ip");
String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp;
logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp);
return returnIp;
@@ -340,7 +339,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
strMsbPort = env.getProperty("msb.port", String.valueOf(DEFAULT_MSB_PORT));
}
msbPort = Integer.valueOf(strMsbPort);
-
+
logger.info("AbstractSdncOperationTask.getGenericResourceApiClient msbIp = " + msbIp + " msbPort = " + msbPort);
MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort);
RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient);
@@ -353,6 +352,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
}
public String getProcessKey(DelegateExecution execution) {
- return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey();
+ return execution.getProcessEngineServices().getRepositoryService()
+ .getProcessDefinition(execution.getProcessDefinitionId()).getKey();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
index a5c609dc2a..4d58439fda 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import java.util.Map;
-
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
@@ -49,29 +48,30 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation";
@Override
- public void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception {
+ public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) throws Exception {
logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
- updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!");
+ updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40",
+ "sendRestrequestAndHandleResponse begin!");
NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder();
RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs);
updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "50", "RequestBody build finished!");
RpcNetworkTopologyOperationOutputEntity outputEntity;
if (!isSend2SdncDirectly()) {
- outputEntity = genericResourceApiClient.postNetworkTopologyOperation
- (HeaderUtil.DefaulAuth, inputEntity).execute().body();
- updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveOutput(execution, outputEntity);
+ outputEntity = genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth, inputEntity)
+ .execute().body();
+ updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
+ saveOutput(execution, outputEntity);
} else {
send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
}
- updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
+ updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED,
+ "execute finished!");
logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!");
}
- private void send2SdncDirectly(String defaulAuth,
- RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException {
+ private void send2SdncDirectly(String defaulAuth, RpcNetworkTopologyOperationInputEntity inputEntity)
+ throws RouteException {
logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!");
String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL;
HttpPost httpPost = new HttpPost(url);
@@ -84,7 +84,8 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!");
}
- private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException {
+ private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output)
+ throws RouteException {
logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
index 2fd550dbb8..4fb6817a39 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import java.util.Map;
-
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
@@ -50,9 +49,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation";
@Override
- public void sendRestrequestAndHandleResponse(DelegateExecution execution,
- Map<String, String> inputs,
- GenericResourceApi genericResourceApiClient) throws Exception {
+ public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) throws Exception {
logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder();
@@ -60,10 +58,10 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
updateProgress(execution, null, null, "50", "RequestBody build finished!");
RpcServiceTopologyOperationOutputEntity outputEntity;
if (!isSend2SdncDirectly()) {
- outputEntity = genericResourceApiClient.postServiceTopologyOperation
- (HeaderUtil.DefaulAuth, inputEntity).execute().body();
- updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveOutput(execution, outputEntity);
+ outputEntity = genericResourceApiClient.postServiceTopologyOperation(HeaderUtil.DefaulAuth, inputEntity)
+ .execute().body();
+ updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
+ saveOutput(execution, outputEntity);
} else {
send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
}
@@ -71,8 +69,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
}
- private void send2SdncDirectly(String defaulAuth,
- RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException {
+ private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity)
+ throws RouteException {
logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!");
String url = getSdncHost() + URL;
HttpPost httpPost = new HttpPost(url);
@@ -85,7 +83,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!");
}
- private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception {
+ private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output)
+ throws Exception {
logger.info("SdncServiceTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
index f54d6692d6..001d8fb6c0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import java.util.Map;
-
import org.apache.commons.lang3.StringUtils;
import org.onap.msb.sdk.httpclient.RestServiceCreater;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
@@ -46,33 +45,32 @@ public class SdncUnderlayVpnOperationClient {
private static Logger logger = LoggerFactory.getLogger(SdncUnderlayVpnOperationClient.class);
- public boolean excute(String msbIp,
- int msbPort,
- Map<String, String> inputs,
- String iServiceID,
- String iOperationID,
- String resourceTemplateUUID_i){
- ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i);
+ public boolean excute(String msbIp, int msbPort, Map<String, String> inputs, String iServiceID, String iOperationID,
+ String resourceTemplateUUID_i) {
+ ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i);
GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort);
updateProgress(id, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!");
return sendRestrequestAndHandleResponse(id, inputs, genericResourceApiClient);
}
- public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map<String, String> inputs, GenericResourceApi genericResourceApiClient){
+ public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map<String, String> inputs,
+ GenericResourceApi genericResourceApiClient) {
updateProgress(id, null, null, "40", "sendRestrequestAndHandleResponse begin!");
NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder();
RpcNetworkTopologyOperationInputEntity body = builder.build(null, inputs);
updateProgress(id, null, null, "50", "RequestBody build finished!");
- //RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null;
+ // RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null;
try {
- genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body();
+ genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth, body).execute().body();
} catch (Exception e) {
logger.debug("Exception: ", e);
- updateProgress(id, RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage());
+ updateProgress(id, RequestsDbConstant.Status.ERROR, null, null,
+ "sendRestrequestAndHandleResponse exception:" + e.getMessage());
return false;
}
updateProgress(id, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
+ updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED,
+ "execute finished!");
return true;
}
@@ -88,13 +86,11 @@ public class SdncUnderlayVpnOperationClient {
return restServiceCreater.createService(GenericResourceApi.class);
}
- public void updateProgress(ResourceOperationStatusId id, String status,
- String errorCode,
- String progress,
- String statusDescription) {
-
-
- ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(id);
+ public void updateProgress(ResourceOperationStatusId id, String status, String errorCode, String progress,
+ String statusDescription) {
+
+
+ ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();// rosRepo.getOne(id);
if (!StringUtils.isBlank(status)) {
resourceOperationStatus.setStatus(status);
}
@@ -107,7 +103,7 @@ public class SdncUnderlayVpnOperationClient {
if (!StringUtils.isBlank(statusDescription)) {
resourceOperationStatus.setStatusDescription(statusDescription);
}
- //rosRepo.save(resourceOperationStatus);
+ // rosRepo.save(resourceOperationStatus);
}
private void saveOutput() {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
index 8bc9dce966..5b7f3bb432 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
@@ -41,8 +41,13 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask {
serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
String operationId = (String) execution.getVariable("operationId");
String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID");
- resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID;
- ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(new ResourceOperationStatusId(serviceId, operationId, resourceTemplateUUID));
+ resourceTemplateUUID =
+ StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId")
+ : resourceTemplateUUID;
+ ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();// rosRepo.getOne(new
+ // ResourceOperationStatusId(serviceId,
+ // operationId,
+ // resourceTemplateUUID));
return resourceOperationStatus.getOperType();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java
index a837782a2c..ca9269242c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java
@@ -34,15 +34,15 @@ public interface GenericResourceApi {
@POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation")
Call<ResponseBody> postNetworkTopologyOperation(@Header("Authorization") String authorization,
- @Body RequestBody input);
+ @Body RequestBody input);
@POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation")
- Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Header("Authorization") String authorization,
- @Body RpcNetworkTopologyOperationInputEntity input);
+ Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(
+ @Header("Authorization") String authorization, @Body RpcNetworkTopologyOperationInputEntity input);
@POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation")
- Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Header("Authorization") String authorization,
- @Body RpcServiceTopologyOperationInputEntity input);
+ Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(
+ @Header("Authorization") String authorization, @Body RpcServiceTopologyOperationInputEntity input);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
index 696be02809..3da5b0de70 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
@@ -36,8 +36,7 @@ public class HeaderUtil {
private static String base64Encode(String str) {
String base64 = str;
try {
- base64 = Base64.getEncoder()
- .encodeToString(str.getBytes("utf-8"));
+ base64 = Base64.getEncoder().encodeToString(str.getBytes("utf-8"));
} catch (Exception ex) {
}
return base64;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
index 961b846ace..21b14c35f9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity;
@@ -35,205 +34,206 @@ import org.onap.so.requestsdb.RequestsDbConstant;
public abstract class AbstractBuilder<I, O> {
- public static final String OPERATION_TYPE = "operationType";
- public static final String RESOURCE_TYPE = "resourceType";
-
- public enum RequestAction {
- CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"),
- ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"),
- CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"),
- DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"),
- DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"),
- CREATE_VNF_INSTANCE(5, "CreateVnfInstance"),
- ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"),
- DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"),
- CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"),
- ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"),
- DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"),
- CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"),
- DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"),
- CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"),
- DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"),
- ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"),
- DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance");
-
- String name;
- int value;
-
- private RequestAction(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public int getIntValue() {
- return this.value;
- }
- }
-
- public enum SvcAction {
- RESERVE(0, "reserve"),
- ASSIGN(1, "assign"),
- ACTIVATE(2, "activate"),
- DELETE(3, "delete"),
- CHANGEASSIGN(4, "changeassign"),
- CHANGEDELETE(5, "changedelete"),
- ROLLBACK(6, "rollback"),
- DEACTIVATE(7, "deactivate"),
- UNASSIGN(8, "unassign"),
- CREATE(9, "create");
-
- String name;
- int value;
-
- private SvcAction(int value, String name) {
- this.value = value;
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public int getIntValue() {
- return this.value;
- }
- }
-
- protected String requestId = null;
-
- abstract O build(DelegateExecution execution, I input) throws Exception;
-
- protected String getRequestAction(DelegateExecution execution) {
- String action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName();
- String operType = (String) execution.getVariable(OPERATION_TYPE);
- String resourceType = (String)execution.getVariable(RESOURCE_TYPE);
- if (!StringUtils.isBlank(operType)) {
- if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
- if (isOverlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName();
- } else if (isUnderlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.DELETE_NETWORK_INSTANCE.getName();
- } else {
- action = /*RequestInformation.*/RequestAction.DELETE_SERVICE_INSTANCE.getName();
- }
- } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) {
- if (isOverlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName();
- } else if (isUnderlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName();
- } else {
- action = /*RequestInformation.*/RequestAction.CREATE_SERVICE_INSTANCE.getName();
- }
- }
- }
- return action;
- }
-
- private boolean isOverlay(String resourceType) {
- return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay");
- }
-
- private boolean isUnderlay(String resourceType) {
- return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay");
- }
-
- protected String getSvcAction(DelegateExecution execution) {
- String action = /*SdncRequestHeader.*/SvcAction.CREATE.getName();
- String operType = (String) execution.getVariable(OPERATION_TYPE);
- String resourceType = (String)execution.getVariable(RESOURCE_TYPE);
- if (!StringUtils.isBlank(operType)) {
- if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
- if (isOverlay(resourceType)) {
- action = /*SdncRequestHeader.*/SvcAction.DEACTIVATE.getName();
- } else if (isUnderlay(resourceType)) {
- action = /*SdncRequestHeader.*/SvcAction.DELETE.getName();
- } else {
- action = /*SdncRequestHeader.*/SvcAction.UNASSIGN.getName();
- }
- } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) {
- if (isOverlay(resourceType)) {
- action = /*SdncRequestHeader.*/SvcAction.ACTIVATE.getName();
- } else if (isUnderlay(resourceType)) {
- action = /*SdncRequestHeader.*/SvcAction.CREATE.getName();
- } else {
- action = /*SdncRequestHeader.*/SvcAction.ASSIGN.getName();
- }
- }
- }
- return action;
- }
-
- protected synchronized String getRequestId(DelegateExecution execution) {
- if (StringUtils.isBlank(requestId)) {
- requestId = (String) execution.getVariable("msoRequestId");
- if (StringUtils.isBlank(requestId)) {
- requestId = UUID.randomUUID().toString();
- }
- }
- return requestId;
- }
-
- protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) {
- OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity();
- String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid");
- String modelVersion = (String) execution.getVariable("modelVersion");
- String modelUuid = (String) execution.getVariable("modelUuid");
- String modelName = (String) execution.getVariable("serviceModelName");
- onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid);
- onapModelInformationEntity.setModelVersion(modelVersion);
- onapModelInformationEntity.setModelUuid(modelUuid);
- onapModelInformationEntity.setModelName(modelName);
- return onapModelInformationEntity;
- }
-
- protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) {
- OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity();
- String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID");
- String modelVersion = (String) execution.getVariable("modelVersion");
- String modelUuid = (String) execution.getVariable("resourceUUID");
- String modelName = (String) execution.getVariable(RESOURCE_TYPE);
- onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid);
- onapModelInformationEntity.setModelVersion(modelVersion);
- onapModelInformationEntity.setModelUuid(modelUuid);
- onapModelInformationEntity.setModelName(modelName);
- return onapModelInformationEntity;
+ public static final String OPERATION_TYPE = "operationType";
+ public static final String RESOURCE_TYPE = "resourceType";
+
+ public enum RequestAction {
+ CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), ACTIVATE_NETWORK_INSTANCE(1,
+ "ActivateNetworkInstance"), CREATE_SERVICE_INSTANCE(2,
+ "CreateServiceInstance"), DELETE_SERVICE_INSTANCE(3,
+ "DeleteServiceInstance"), DELETE_NETWORK_INSTANCE(4,
+ "DeleteNetworkInstance"), CREATE_VNF_INSTANCE(5,
+ "CreateVnfInstance"), ACTIVATE_VNF_INSTANCE(6,
+ "ActivateVnfInstance"), DELETE_VNF_INSTANCE(7,
+ "DeleteVnfInstance"), CREATE_VF_MODULE_INSTANCE(8,
+ "CreateVfModuleInstance"), ACTIVATE_VF_MODULE_INSTANCE(
+ 9,
+ "ActivateVfModuleInstance"), DELETE_VF_MODULE_INSTANCE(
+ 10,
+ "DeleteVfModuleInstance"), CREATE_CONTRAIL_ROUTE_INSTANCE(
+ 11,
+ "CreateContrailRouteInstance"), DELETE_CONTRAIL_ROUTE_INSTANCE(
+ 12,
+ "DeleteContrailRouteInstance"), CREATE_SECURITY_ZONE_INSTANCE(
+ 13,
+ "CreateSecurityZoneInstance"), DELETE_SECURITY_ZONE_INSTANCE(
+ 14,
+ "DeleteSecurityZoneInstance"), ACTIVATE_DCI_NETWORK_INSTANCE(
+ 15,
+ "ActivateDCINetworkInstance"), DEACTIVATE_DCI_NETWORK_INSTANCE(
+ 16,
+ "DeActivateDCINetworkInstance");
+
+ String name;
+ int value;
+
+ private RequestAction(int value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public int getIntValue() {
+ return this.value;
+ }
+ }
+
+ public enum SvcAction {
+ RESERVE(0, "reserve"), ASSIGN(1, "assign"), ACTIVATE(2, "activate"), DELETE(3, "delete"), CHANGEASSIGN(4,
+ "changeassign"), CHANGEDELETE(5, "changedelete"), ROLLBACK(6,
+ "rollback"), DEACTIVATE(7, "deactivate"), UNASSIGN(8, "unassign"), CREATE(9, "create");
+
+ String name;
+ int value;
+
+ private SvcAction(int value, String name) {
+ this.value = value;
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public int getIntValue() {
+ return this.value;
+ }
+ }
+
+ protected String requestId = null;
+
+ abstract O build(DelegateExecution execution, I input) throws Exception;
+
+ protected String getRequestAction(DelegateExecution execution) {
+ String action = /* RequestInformation. */RequestAction.CREATE_NETWORK_INSTANCE.getName();
+ String operType = (String) execution.getVariable(OPERATION_TYPE);
+ String resourceType = (String) execution.getVariable(RESOURCE_TYPE);
+ if (!StringUtils.isBlank(operType)) {
+ if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
+ if (isOverlay(resourceType)) {
+ action = /* RequestInformation. */RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName();
+ } else if (isUnderlay(resourceType)) {
+ action = /* RequestInformation. */RequestAction.DELETE_NETWORK_INSTANCE.getName();
+ } else {
+ action = /* RequestInformation. */RequestAction.DELETE_SERVICE_INSTANCE.getName();
+ }
+ } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) {
+ if (isOverlay(resourceType)) {
+ action = /* RequestInformation. */RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName();
+ } else if (isUnderlay(resourceType)) {
+ action = /* RequestInformation. */RequestAction.CREATE_NETWORK_INSTANCE.getName();
+ } else {
+ action = /* RequestInformation. */RequestAction.CREATE_SERVICE_INSTANCE.getName();
+ }
+ }
+ }
+ return action;
+ }
+
+ private boolean isOverlay(String resourceType) {
+ return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay");
+ }
+
+ private boolean isUnderlay(String resourceType) {
+ return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay");
+ }
+
+ protected String getSvcAction(DelegateExecution execution) {
+ String action = /* SdncRequestHeader. */SvcAction.CREATE.getName();
+ String operType = (String) execution.getVariable(OPERATION_TYPE);
+ String resourceType = (String) execution.getVariable(RESOURCE_TYPE);
+ if (!StringUtils.isBlank(operType)) {
+ if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
+ if (isOverlay(resourceType)) {
+ action = /* SdncRequestHeader. */SvcAction.DEACTIVATE.getName();
+ } else if (isUnderlay(resourceType)) {
+ action = /* SdncRequestHeader. */SvcAction.DELETE.getName();
+ } else {
+ action = /* SdncRequestHeader. */SvcAction.UNASSIGN.getName();
+ }
+ } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) {
+ if (isOverlay(resourceType)) {
+ action = /* SdncRequestHeader. */SvcAction.ACTIVATE.getName();
+ } else if (isUnderlay(resourceType)) {
+ action = /* SdncRequestHeader. */SvcAction.CREATE.getName();
+ } else {
+ action = /* SdncRequestHeader. */SvcAction.ASSIGN.getName();
+ }
+ }
+ }
+ return action;
+ }
+
+ protected synchronized String getRequestId(DelegateExecution execution) {
+ if (StringUtils.isBlank(requestId)) {
+ requestId = (String) execution.getVariable("msoRequestId");
+ if (StringUtils.isBlank(requestId)) {
+ requestId = UUID.randomUUID().toString();
+ }
+ }
+ return requestId;
+ }
+
+ protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) {
+ OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity();
+ String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid");
+ String modelVersion = (String) execution.getVariable("modelVersion");
+ String modelUuid = (String) execution.getVariable("modelUuid");
+ String modelName = (String) execution.getVariable("serviceModelName");
+ onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid);
+ onapModelInformationEntity.setModelVersion(modelVersion);
+ onapModelInformationEntity.setModelUuid(modelUuid);
+ onapModelInformationEntity.setModelName(modelName);
+ return onapModelInformationEntity;
+ }
+
+ protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) {
+ OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity();
+ String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID");
+ String modelVersion = (String) execution.getVariable("modelVersion");
+ String modelUuid = (String) execution.getVariable("resourceUUID");
+ String modelName = (String) execution.getVariable(RESOURCE_TYPE);
+ onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid);
+ onapModelInformationEntity.setModelVersion(modelVersion);
+ onapModelInformationEntity.setModelUuid(modelUuid);
+ onapModelInformationEntity.setModelName(modelName);
+ return onapModelInformationEntity;
}
- protected List<ParamEntity> getParamEntities(Map<String, String> inputs) {
- List<ParamEntity> paramEntityList = new ArrayList<>();
- if (inputs != null && !inputs.isEmpty()) {
- inputs.keySet().forEach(key -> {
- ParamEntity paramEntity = new ParamEntity();
- paramEntity.setName(key);
- paramEntity.setValue(inputs.get(key));
- paramEntityList.add(paramEntity);
- });
- }
- return paramEntityList;
- }
-
- protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) {
- RequestInformationEntity requestInformationEntity = new RequestInformationEntity();
- requestInformationEntity.setRequestId(getRequestId(execution));
- requestInformationEntity.setRequestAction(getRequestAction(execution));
- return requestInformationEntity;
- }
-
- protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) {
- ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity();
- serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId"));
- serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
- serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution));
- serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
- serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId"));
- return serviceInformationEntity;
- }
-
- protected String getServiceInstanceName(DelegateExecution execution) {
- return (String) execution.getVariable("serviceInstanceName");
- }
+ protected List<ParamEntity> getParamEntities(Map<String, String> inputs) {
+ List<ParamEntity> paramEntityList = new ArrayList<>();
+ if (inputs != null && !inputs.isEmpty()) {
+ inputs.keySet().forEach(key -> {
+ ParamEntity paramEntity = new ParamEntity();
+ paramEntity.setName(key);
+ paramEntity.setValue(inputs.get(key));
+ paramEntityList.add(paramEntity);
+ });
+ }
+ return paramEntityList;
+ }
+
+ protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) {
+ RequestInformationEntity requestInformationEntity = new RequestInformationEntity();
+ requestInformationEntity.setRequestId(getRequestId(execution));
+ requestInformationEntity.setRequestAction(getRequestAction(execution));
+ return requestInformationEntity;
+ }
+
+ protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) {
+ ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity();
+ serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId"));
+ serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
+ serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution));
+ serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
+ serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId"));
+ return serviceInformationEntity;
+ }
+
+ protected String getServiceInstanceName(DelegateExecution execution) {
+ return (String) execution.getVariable("serviceInstanceName");
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java
index 547df2bb3a..4a2194ed3d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
import java.util.List;
import java.util.Map;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInformationEntity;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInputParametersEntity;
@@ -35,44 +34,53 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNet
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity;
-public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
+public class NetworkRpcInputEntityBuilder
+ extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
@Override
public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) {
- RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity();
- NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs);
+ RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity =
+ new RpcNetworkTopologyOperationInputEntity();
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity =
+ getNetworkTopologyOperationInputEntity(execution, inputs);
rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity);
return rpcNetworkTopologyOperationInputEntity;
}
- private void loadNetwrokRequestInputEntity(Map<String, String> inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
+ private void loadNetwrokRequestInputEntity(Map<String, String> inputs,
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity();
- NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity();
+ NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity();
List<ParamEntity> paramEntityList = getParamEntities(inputs);
networkInputParametersEntity.setParamList(paramEntityList);
- networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity);
+ networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity);
networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity);
}
- private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
+ DelegateExecution execution) {
RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
}
- private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
+ DelegateExecution execution) {
SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity);
}
- private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
+ DelegateExecution execution) {
ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
}
- private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map<String, String> inputs) {
- NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity();
+ private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution,
+ Map<String, String> inputs) {
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity =
+ new NetworkTopologyOperationInputEntity();
loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution);
loadRequestInformationEntity(networkTopologyOperationInputEntity, execution);
loadServiceInformation(networkTopologyOperationInputEntity, execution);
@@ -81,7 +89,8 @@ public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, St
return networkTopologyOperationInputEntity;
}
- private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
+ private void loadNetworkInformationEntity(DelegateExecution execution,
+ NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java
index 466652edff..944802372b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilder.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
import java.util.Map;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity;
@@ -30,20 +29,26 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.Servic
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceRequestInputEntity;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceTopologyOperationInputEntity;
-public class ServiceRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcServiceTopologyOperationInputEntity> {
+public class ServiceRpcInputEntityBuilder
+ extends AbstractBuilder<Map<String, String>, RpcServiceTopologyOperationInputEntity> {
@Override
- public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) throws Exception {
- RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = new RpcServiceTopologyOperationInputEntity();
- ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = new ServiceTopologyOperationInputEntity();
+ public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs)
+ throws Exception {
+ RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity =
+ new RpcServiceTopologyOperationInputEntity();
+ ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity =
+ new ServiceTopologyOperationInputEntity();
loadSdncRequestHeaderEntity(serviceTopologyOperationInputEntity, execution);
loadRequestInformationEntity(serviceTopologyOperationInputEntity, execution);
loadServiceInformation(serviceTopologyOperationInputEntity, execution);
loadServiceRequestInputEntity(serviceTopologyOperationInputEntity, execution);
- rpcServiceTopologyOperationInputEntity.setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity);
+ rpcServiceTopologyOperationInputEntity
+ .setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity);
return rpcServiceTopologyOperationInputEntity;
}
- private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
ServiceRequestInputEntity serviceRequestInputEntity = getServiceRequestInputEntity(execution);
serviceTopologyOperationInputEntity.setServiceRequestInput(serviceRequestInputEntity);
}
@@ -54,17 +59,20 @@ public class ServiceRpcInputEntityBuilder extends AbstractBuilder<Map<String, St
return serviceRequestInputEntity;
}
- private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadServiceInformation(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
serviceTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
}
- private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadRequestInformationEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
serviceTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
}
- private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) {
+ private void loadSdncRequestHeaderEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity,
+ DelegateExecution execution) {
SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java
index 0863917f21..847aa72469 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputParametersEntity.java
@@ -21,13 +21,12 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.List;
public class NetworkInputParametersEntity {
- @JsonProperty("GENERIC-RESOURCE-API:param")
+ @JsonProperty("GENERIC-RESOURCE-API:param")
private List<ParamEntity> paramList;
-
+
public List<ParamEntity> getParamList() {
return paramList;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java
index af448942cc..238a4f32c0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RequestInformationEntity {
- @JsonProperty("GENERIC-RESOURCE-API:request-id")
+ @JsonProperty("GENERIC-RESOURCE-API:request-id")
private String requestId;
@JsonProperty("GENERIC-RESOURCE-API:request-action")
@@ -40,7 +40,7 @@ public class RequestInformationEntity {
@JsonProperty("GENERIC-RESOURCE-API:order-version")
private String orerVersion;
-
+
public String getRequestId() {
return requestId;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java
index 4e58a61750..76494f5585 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java
@@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RpcNetworkTopologyOperationInputEntity {
- @JsonProperty("GENERIC-RESOURCE-API:input")
+ @JsonProperty("GENERIC-RESOURCE-API:input")
private NetworkTopologyOperationInputEntity input = null;
-
+
public NetworkTopologyOperationInputEntity getInput() {
return input;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java
index 915a8a5e39..c93b3f2ad9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java
@@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RpcNetworkTopologyOperationOutputEntity {
- @JsonProperty("GENERIC-RESOURCE-API:output")
+ @JsonProperty("GENERIC-RESOURCE-API:output")
private NetworkTopologyOperationOutputEntity output;
-
+
public NetworkTopologyOperationOutputEntity getOutput() {
return output;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java
index 145759e190..dbca00ae24 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java
@@ -23,14 +23,15 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
public class RpcServiceTopologyOperationInputEntity {
- @JsonProperty("GENERIC-RESOURCE-API:input")
+ @JsonProperty("GENERIC-RESOURCE-API:input")
private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity;
-
+
public ServiceTopologyOperationInputEntity getServiceTopologyOperationInputEntity() {
return serviceTopologyOperationInputEntity;
}
- public void setServiceTopologyOperationInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) {
+ public void setServiceTopologyOperationInputEntity(
+ ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) {
this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
index c1ba7dc614..5c199bd413 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
@@ -21,13 +21,12 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.util.List;
public class ServiceInputParametersEntity {
- @JsonProperty("GENERIC-RESOURCE-API:param")
+ @JsonProperty("GENERIC-RESOURCE-API:param")
private List<ParamEntity> paramList;
-
+
public List<ParamEntity> getParamList() {
return paramList;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java
index 0f77e41120..03d9b37522 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java
@@ -19,14 +19,14 @@
*/
package org.onap.so.bpmn;
-import org.junit.runner.RunWith;
+import org.junit.runner.RunWith;
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
@SuiteClasses({"**/service/*Test.class", "**/process/*Test.class", "**/subprocess/*Test.class"})
public class AllBPMNTestSuites {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java
index 57d842f8b5..7f86709432 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java
@@ -19,14 +19,14 @@
*/
package org.onap.so.bpmn;
-import org.junit.runner.RunWith;
+import org.junit.runner.RunWith;
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
-@SuiteClasses({"**/tasks/*Test.class","**/infrastructure/aai/*Test.class"})
+@SuiteClasses({"**/tasks/*Test.class", "**/infrastructure/aai/*Test.class"})
public class AllTasksTestsTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java
index ddcc6fe875..7123567247 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java
@@ -23,19 +23,16 @@
package org.onap.so.bpmn;
import org.junit.runner.RunWith;
-
import com.googlecode.junittoolbox.SuiteClasses;
import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
-@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class",
- "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class",
- "!**/infrastructure/scripts/*Test.class",
- "**/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.class",
- "**/infrastructure/scripts/DoUpdateNetworkInstanceTest.class",
- "**/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.class",
- "**/*Test.class"})
+@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class",
+ "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class", "!**/infrastructure/scripts/*Test.class",
+ "**/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.class",
+ "**/infrastructure/scripts/DoUpdateNetworkInstanceTest.class",
+ "**/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.class", "**/*Test.class"})
public class AllTestsTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java
index f69521fd76..1c4074cae1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure;
import org.junit.Test;
-
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.rule.impl.GetterMustExistRule;
@@ -38,35 +37,31 @@ import com.openpojo.reflection.filters.FilterPackageInfo;
public class BeansTest {
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
- private PojoClassFilter enumFilter = new FilterEnum();
-
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ private PojoClassFilter enumFilter = new FilterEnum();
+
+
+ @Test
+ public void pojoStructure() {
+ test("org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
+
+ .with(new SetterTester()).with(new GetterTester()).with(new SetterTester()).with(new GetterTester())
- @Test
- public void pojoStructure() {
- test("org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity");
- }
+ .build();
- private void test(String pojoPackage) {
- Validator validator = ValidatorBuilder.create()
- .with(new GetterMustExistRule())
- .with(new SetterMustExistRule())
-
- .with(new SetterTester())
- .with(new GetterTester())
- .with(new SetterTester())
- .with(new GetterTester())
-
- .build();
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter,
+ new FilterNonConcrete());
+ }
- validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete());
- }
-
- private static class FilterTestClasses implements PojoClassFilter {
- public boolean include(PojoClass pojoClass) {
- return !pojoClass.getSourcePath().contains("/test-classes/");
- }
- }
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
index ad9e210452..c2af155d51 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
@@ -31,22 +31,19 @@ import org.springframework.util.StringUtils;
@EnableWebSecurity
public class WebSecurityConfigImpl extends WebSecurityConfig {
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.csrf().disable()
- .authorizeRequests()
- .antMatchers("/manage/health","/manage/info").permitAll()
- .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
- .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
- .and()
- .httpBasic();
- }
-
- @Override
- public void configure(WebSecurity web) throws Exception {
- super.configure(web);
- StrictHttpFirewall firewall = new MSOSpringFirewall();
- web.httpFirewall(firewall);
- }
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService",
+ "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
+ .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic();
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
index 2e588b7078..289d97108f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
@@ -28,10 +28,8 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-
import java.util.HashMap;
import java.util.Optional;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,150 +46,157 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@RunWith(MockitoJUnitRunner.class)
public class AAICreateResourcesTest {
-
- private AAICreateResources aaiCreateResources;
-
- private String projectName;
- private String serviceInstanceId;
- private String owningEntityId;
- private String owningEntityName;
- private String platformName;
- private String vnfId;
- private String lineOfBusiness;
- private String globalCustomerId;
- private String serviceType;
-
- @Spy
- private AAIResourcesClient aaiResourcesClient;
-
- @Before
- public void before() {
-
-
- aaiCreateResources = new AAICreateResources();
- aaiCreateResources.setAaiClient(aaiResourcesClient);
-
- projectName = "projectName";
- serviceInstanceId = "serviceInstanceId";
- owningEntityId = "owningEntityId";
- owningEntityName = "owningEntityName";
- platformName = "platformName";
- vnfId = "vnfId";
- lineOfBusiness = "lineOfBusiness";
- globalCustomerId = "globalCustomerId";
- serviceType = "serviceType";
- }
-
- @Test
- public void createAAIProjectTest() {
- doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class));
- doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
-
-
- aaiCreateResources.createAAIProject(projectName, serviceInstanceId);
-
- AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
-
- verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty());
- verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- }
-
- @Test
- public void createAAIOwningEntityTest() {
- doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class));
- doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
-
- aaiCreateResources.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstanceId);
-
- HashMap<String, String> owningEntityMap = new HashMap<>();
- owningEntityMap.put("owning-entity-name", owningEntityName);
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
-
- verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap));
- verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- }
-
- @Test
- public void existsOwningEntityTest() {
- doReturn(true).when(aaiResourcesClient).exists(isA(AAIResourceUri.class));
-
- boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId);
-
- AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
-
- verify(aaiResourcesClient, times(1)).exists(owningEntityURI);
- assertTrue(expectedBoolean);
- }
-
- @Test
- public void connectOwningEntityandServiceInstanceTest() {
- doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
-
- aaiCreateResources.connectOwningEntityandServiceInstance(owningEntityId, serviceInstanceId);
-
- verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- }
-
- @Test
- public void createAAIPlatformTest() {
- doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class));
- doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
-
- aaiCreateResources.createAAIPlatform(platformName, vnfId);
-
- AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
-
- verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty());
- verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- }
-
- @Test
- public void createAAILineOfBusinessTest() {
- doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class));
- doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
-
- aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId);
-
- AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
-
- verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty());
- verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
- }
-
- @Test
- public void createAAIServiceInstanceTest() {
- doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class));
-
- aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId);
-
- AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId);
-
- verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty());
- }
-
- @Test
- public void getVnfInstanceTest() {
- AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("vnfUriAaiResponse");
-
- doReturn(aaiResultWrapper).when(aaiResourcesClient).get(isA(AAIResourceUri.class));
-
- Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
-
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
-
- verify(aaiResourcesClient, times(1)).get(vnfURI);
- assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class));
- }
-
- @Test
- public void getVnfInstanceExceptionTest() {
- doThrow(RuntimeException.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class));
-
- Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
-
- AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
-
- verify(aaiResourcesClient, times(1)).get(vnfURI);
- assertEquals(actualVnf, Optional.empty());
- }
+
+ private AAICreateResources aaiCreateResources;
+
+ private String projectName;
+ private String serviceInstanceId;
+ private String owningEntityId;
+ private String owningEntityName;
+ private String platformName;
+ private String vnfId;
+ private String lineOfBusiness;
+ private String globalCustomerId;
+ private String serviceType;
+
+ @Spy
+ private AAIResourcesClient aaiResourcesClient;
+
+ @Before
+ public void before() {
+
+
+ aaiCreateResources = new AAICreateResources();
+ aaiCreateResources.setAaiClient(aaiResourcesClient);
+
+ projectName = "projectName";
+ serviceInstanceId = "serviceInstanceId";
+ owningEntityId = "owningEntityId";
+ owningEntityName = "owningEntityName";
+ platformName = "platformName";
+ vnfId = "vnfId";
+ lineOfBusiness = "lineOfBusiness";
+ globalCustomerId = "globalCustomerId";
+ serviceType = "serviceType";
+ }
+
+ @Test
+ public void createAAIProjectTest() {
+ doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ isA(Optional.class));
+ doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+
+ aaiCreateResources.createAAIProject(projectName, serviceInstanceId);
+
+ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+
+ verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty());
+ verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createAAIOwningEntityTest() {
+ doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ isA(Optional.class));
+ doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ aaiCreateResources.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstanceId);
+
+ HashMap<String, String> owningEntityMap = new HashMap<>();
+ owningEntityMap.put("owning-entity-name", owningEntityName);
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+
+ verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap));
+ verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void existsOwningEntityTest() {
+ doReturn(true).when(aaiResourcesClient).exists(isA(AAIResourceUri.class));
+
+ boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId);
+
+ AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+
+ verify(aaiResourcesClient, times(1)).exists(owningEntityURI);
+ assertTrue(expectedBoolean);
+ }
+
+ @Test
+ public void connectOwningEntityandServiceInstanceTest() {
+ doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ aaiCreateResources.connectOwningEntityandServiceInstance(owningEntityId, serviceInstanceId);
+
+ verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createAAIPlatformTest() {
+ doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ isA(Optional.class));
+ doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ aaiCreateResources.createAAIPlatform(platformName, vnfId);
+
+ AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
+
+ verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty());
+ verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createAAILineOfBusinessTest() {
+ doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ isA(Optional.class));
+ doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+
+ aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId);
+
+ AAIResourceUri lineOfBusinessURI =
+ AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
+
+ verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty());
+ verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ }
+
+ @Test
+ public void createAAIServiceInstanceTest() {
+ doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ isA(Optional.class));
+
+ aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId);
+
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalCustomerId, serviceType, serviceInstanceId);
+
+ verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty());
+ }
+
+ @Test
+ public void getVnfInstanceTest() {
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("vnfUriAaiResponse");
+
+ doReturn(aaiResultWrapper).when(aaiResourcesClient).get(isA(AAIResourceUri.class));
+
+ Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
+
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+
+ verify(aaiResourcesClient, times(1)).get(vnfURI);
+ assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class));
+ }
+
+ @Test
+ public void getVnfInstanceExceptionTest() {
+ doThrow(RuntimeException.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class));
+
+ Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
+
+ AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+
+ verify(aaiResourcesClient, times(1)).get(vnfURI);
+ assertEquals(actualVnf, Optional.empty());
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java
index a540a6d2cc..1aca331a17 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
@@ -38,47 +37,47 @@ import org.mockito.MockitoAnnotations;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-public class AAIDeleteServiceInstanceTest {
- private AAIDeleteServiceInstance aaiDeleteServiceInstance;
- @Mock
- private DelegateExecution execution;
-
- @Mock
- private AAIResourcesClient aaiResourcesClient;
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
-
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
-
- aaiDeleteServiceInstance = new AAIDeleteServiceInstance();
- aaiDeleteServiceInstance.setAaiClient(aaiResourcesClient);
- }
-
- @Test
- public void executeTest() throws Exception {
- doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId");
- doNothing().when(aaiResourcesClient).delete(isA(AAIResourceUri.class));
- doNothing().when(execution).setVariable(isA(String.class), isA(Boolean.class));
-
- aaiDeleteServiceInstance.execute(execution);
-
- verify(execution, times(1)).getVariable("serviceInstanceId");
- verify(aaiResourcesClient, times(1)).delete(isA(AAIResourceUri.class));
- verify(execution, times(1)).setVariable("GENDS_SuccessIndicator", true);
- }
-
- @Test
- public void executeExceptionTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- doReturn("testProcessKey").when(execution).getVariable("testProcessKey");
- doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId");
- doThrow(RuntimeException.class).when(aaiResourcesClient).delete(isA(AAIResourceUri.class));
-
- aaiDeleteServiceInstance.execute(execution);
- }
+public class AAIDeleteServiceInstanceTest {
+ private AAIDeleteServiceInstance aaiDeleteServiceInstance;
+ @Mock
+ private DelegateExecution execution;
+
+ @Mock
+ private AAIResourcesClient aaiResourcesClient;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+
+ aaiDeleteServiceInstance = new AAIDeleteServiceInstance();
+ aaiDeleteServiceInstance.setAaiClient(aaiResourcesClient);
+ }
+
+ @Test
+ public void executeTest() throws Exception {
+ doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId");
+ doNothing().when(aaiResourcesClient).delete(isA(AAIResourceUri.class));
+ doNothing().when(execution).setVariable(isA(String.class), isA(Boolean.class));
+
+ aaiDeleteServiceInstance.execute(execution);
+
+ verify(execution, times(1)).getVariable("serviceInstanceId");
+ verify(aaiResourcesClient, times(1)).delete(isA(AAIResourceUri.class));
+ verify(execution, times(1)).setVariable("GENDS_SuccessIndicator", true);
+ }
+
+ @Test
+ public void executeExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doReturn("testProcessKey").when(execution).getVariable("testProcessKey");
+ doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId");
+ doThrow(RuntimeException.class).when(aaiResourcesClient).delete(isA(AAIResourceUri.class));
+
+ aaiDeleteServiceInstance.execute(execution);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java
index b68b787904..90576c9566 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java
@@ -26,91 +26,91 @@ import org.junit.Test;
public class AAIServiceInstanceTest {
- AAIServiceInstance test = new AAIServiceInstance.AAIServiceInstanceBuilder()
- .setServiceInstanceName("serviceInstanceName").setServiceType("serviceType").setServiceRole("serviceRole")
- .setOrchestrationStatus("orchestrationStatus").setModelInvariantUuid("modelInvariantUuid")
- .setModelVersionId("modelVersionId").setEnvironmentContext("environmentContext")
- .setWorkloadContext("workloadContext").createAAIServiceInstance();
-
- @Test
- public void getServiceInstanceNameTest() throws Exception {
- test.getServiceInstanceName();
- }
-
- @Test
- public void setServiceInstanceNameTest() throws Exception {
- test.setServiceInstanceName("serviceInstanceName");
- }
-
- @Test
- public void getServiceTypeTest() throws Exception {
- test.getServiceType();
- }
-
- @Test
- public void setServiceTypeTest() throws Exception {
- test.setServiceType("serviceType");
- }
-
- @Test
- public void getServiceRoleTest() throws Exception {
- test.getServiceRole();
- }
-
- @Test
- public void setServiceRoleTest() throws Exception {
- test.setServiceRole("serviceRole");
- }
-
- @Test
- public void getOrchestrationStatusTest() throws Exception {
- test.getOrchestrationStatus();
- }
-
- @Test
- public void setOrchestrationStatusTest() throws Exception {
- test.setOrchestrationStatus("status");
- }
-
- @Test
- public void getModelInvariantUuidTest() throws Exception {
- test.getModelInvariantUuid();
- }
-
- @Test
- public void setModelInvariantUuidTest() throws Exception {
- test.setModelInvariantUuid("uuid");
- }
-
- @Test
- public void getModelVersionIdTest() throws Exception {
- test.getModelVersionId();
- }
-
- @Test
- public void setModelVersionIdTest() throws Exception {
- test.setModelVersionId("versionId");
- }
-
- @Test
- public void getEnvironmentContextTest() throws Exception {
- test.getEnvironmentContext();
- }
-
- @Test
- public void setEnvironmentContextTest() throws Exception {
- test.setEnvironmentContext("context");
- }
-
- @Test
- public void getWorkloadContextTest() throws Exception {
- test.getWorkloadContext();
- }
-
- @Test
- public void setWorkloadContextTest() throws Exception {
- test.setWorkloadContext("context");
- }
+ AAIServiceInstance test = new AAIServiceInstance.AAIServiceInstanceBuilder()
+ .setServiceInstanceName("serviceInstanceName").setServiceType("serviceType").setServiceRole("serviceRole")
+ .setOrchestrationStatus("orchestrationStatus").setModelInvariantUuid("modelInvariantUuid")
+ .setModelVersionId("modelVersionId").setEnvironmentContext("environmentContext")
+ .setWorkloadContext("workloadContext").createAAIServiceInstance();
+
+ @Test
+ public void getServiceInstanceNameTest() throws Exception {
+ test.getServiceInstanceName();
+ }
+
+ @Test
+ public void setServiceInstanceNameTest() throws Exception {
+ test.setServiceInstanceName("serviceInstanceName");
+ }
+
+ @Test
+ public void getServiceTypeTest() throws Exception {
+ test.getServiceType();
+ }
+
+ @Test
+ public void setServiceTypeTest() throws Exception {
+ test.setServiceType("serviceType");
+ }
+
+ @Test
+ public void getServiceRoleTest() throws Exception {
+ test.getServiceRole();
+ }
+
+ @Test
+ public void setServiceRoleTest() throws Exception {
+ test.setServiceRole("serviceRole");
+ }
+
+ @Test
+ public void getOrchestrationStatusTest() throws Exception {
+ test.getOrchestrationStatus();
+ }
+
+ @Test
+ public void setOrchestrationStatusTest() throws Exception {
+ test.setOrchestrationStatus("status");
+ }
+
+ @Test
+ public void getModelInvariantUuidTest() throws Exception {
+ test.getModelInvariantUuid();
+ }
+
+ @Test
+ public void setModelInvariantUuidTest() throws Exception {
+ test.setModelInvariantUuid("uuid");
+ }
+
+ @Test
+ public void getModelVersionIdTest() throws Exception {
+ test.getModelVersionId();
+ }
+
+ @Test
+ public void setModelVersionIdTest() throws Exception {
+ test.setModelVersionId("versionId");
+ }
+
+ @Test
+ public void getEnvironmentContextTest() throws Exception {
+ test.getEnvironmentContext();
+ }
+
+ @Test
+ public void setEnvironmentContextTest() throws Exception {
+ test.setEnvironmentContext("context");
+ }
+
+ @Test
+ public void getWorkloadContextTest() throws Exception {
+ test.getWorkloadContext();
+ }
+
+ @Test
+ public void setWorkloadContextTest() throws Exception {
+ test.setWorkloadContext("context");
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java
index ebcce191e9..9030fa8328 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.common.name.generation;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
@@ -34,25 +33,25 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
public class AAIObjectInstanceNameGeneratorTest {
- @Before
- public void before() {
- }
-
- @Test
- public void generateInstanceGroupNameTest() throws Exception {
-
- ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
- modelVnfc.setFunction("vre");
- modelVnfc.setType("VNFC");
-
- InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId("test-001");
- instanceGroup.setModelInfoInstanceGroup(modelVnfc);
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("vnf-123");
- vnf.setVnfName("test-vnf");
-
- assertEquals("test-vnf_vre", new AAIObjectInstanceNameGenerator().generateInstanceGroupName(instanceGroup, vnf));
- }
-
+ @Before
+ public void before() {}
+
+ @Test
+ public void generateInstanceGroupNameTest() throws Exception {
+
+ ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
+ modelVnfc.setFunction("vre");
+ modelVnfc.setType("VNFC");
+
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId("test-001");
+ instanceGroup.setModelInfoInstanceGroup(modelVnfc);
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnf-123");
+ vnf.setVnfName("test-vnf");
+
+ assertEquals("test-vnf_vre",
+ new AAIObjectInstanceNameGenerator().generateInstanceGroupName(instanceGroup, vnf));
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
index b0ff82e3aa..c67b44e44a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Test;
-
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
@@ -37,7 +36,8 @@ public class CancelDmaapSubscriptionTest {
DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl();
delegate.setDmaapClient(dmaapClientTest);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID)))
+ .thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> {
});
@@ -46,4 +46,4 @@ public class CancelDmaapSubscriptionTest {
// then
assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse();
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
index 6a0aaf776e..4206d796f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
@@ -29,7 +29,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl
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.PNF_CORRELATION_ID;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
@@ -46,9 +45,9 @@ public class CheckAaiForPnfCorrelationIdDelegateTest {
public static class ConnectionOkTests {
private CheckAaiForPnfCorrelationIdDelegate delegate;
-
+
@Rule
- public ExpectedException expectedException = ExpectedException.none();
+ public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
@@ -94,9 +93,9 @@ public class CheckAaiForPnfCorrelationIdDelegateTest {
public static class NoConnectionTests {
private CheckAaiForPnfCorrelationIdDelegate delegate;
-
+
@Rule
- public ExpectedException expectedException = ExpectedException.none();
+ public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
@@ -116,4 +115,4 @@ public class CheckAaiForPnfCorrelationIdDelegateTest {
verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java
index 571f64335f..5000ca017c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -30,7 +25,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -52,7 +46,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {CatalogDbClient.class, ExceptionBuilder.class, ConfigCheckerDelegate.class,
- ProcessEngineConfiguration.class})
+ ProcessEngineConfiguration.class})
public class ConfigCheckerDelegateTest {
private static String TEST_PROCESS_KEY = "processKey1";
@@ -64,14 +58,11 @@ public class ConfigCheckerDelegateTest {
/**
* Service model info json.
*/
- private static String TEST_SERVICE_MODEL_INFO = "{\n"
- + " \"modelType\":\"service\",\n"
- + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
- + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
- + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n"
- + " \"modelName\":\"PNF_demo_resource\",\n"
- + " \"modelVersion\":\"1.0\"\n"
- + " }";
+ private static String TEST_SERVICE_MODEL_INFO = "{\n" + " \"modelType\":\"service\",\n"
+ + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
+ + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n"
+ + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n"
+ + " \"modelName\":\"PNF_demo_resource\",\n" + " \"modelVersion\":\"1.0\"\n" + " }";
/**
* Testing model UUID, should be the same as specified in the TEST_SERVICE_MODEL_INFO.
@@ -94,7 +85,7 @@ public class ConfigCheckerDelegateTest {
List<PnfResourceCustomization> pnfResourceCustomizations = new ArrayList<>();
pnfResourceCustomizations.add(buildPnfResourceCustomization());
given(catalogDbClient.getPnfResourceCustomizationByModelUuid(TEST_MODEL_UUID))
- .willReturn(pnfResourceCustomizations);
+ .willReturn(pnfResourceCustomizations);
execution.setVariable("testProcessKey", TEST_PROCESS_KEY);
execution.setVariable(SERVICE_MODEL_INFO, TEST_SERVICE_MODEL_INFO);
}
@@ -128,12 +119,12 @@ public class ConfigCheckerDelegateTest {
@Test
public void testExecution_EmptyPnfResourceCustomization_exceptionThrown() {
given(catalogDbClient.getPnfResourceCustomizationByModelUuid("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(Collections.EMPTY_LIST);
+ .willReturn(Collections.EMPTY_LIST);
assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class);
assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
- .contains("Unable to find the PNF resource customizations of model service UUID")
- .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .contains("Unable to find the PNF resource customizations of model service UUID")
+ .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
@@ -142,7 +133,7 @@ public class ConfigCheckerDelegateTest {
execution.removeVariable("serviceModelInfo");
assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class);
assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
- .contains("Unable to find parameter serviceModelInfo");
+ .contains("Unable to find parameter serviceModelInfo");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
-} \ No newline at end of file
+}
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 986edfeecf..c90235b103 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
@@ -27,7 +27,6 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import java.util.UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Test;
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 c743ee7018..85a9a5c166 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
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
-
import java.io.IOException;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
index 8a1cdfa4c0..597d111e2c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Test;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
index eb9f657d4f..446c73dda1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -27,7 +27,6 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
-
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -74,7 +73,8 @@ public class InformDmaapClientTest {
private DelegateExecution mockDelegateExecution() {
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID)))
+ .thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
@@ -85,4 +85,4 @@ public class InformDmaapClientTest {
when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
return delegateExecution;
}
-} \ No newline at end of file
+}
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 001815b206..6c8716cbd7 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
@@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_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 java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.BpmnError;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index 3a9d6d0055..8577d9555b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -51,8 +50,7 @@ public class PnfManagementTestImpl implements PnfManagement {
}
@Override
- public void createRelation(String serviceInstanceId, String pnfName) {
- }
+ public void createRelation(String serviceInstanceId, String pnfName) {}
public Map<String, Pnf> getCreated() {
return created;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java
index 8d817e5bca..110ee2146c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -32,7 +27,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -72,7 +66,7 @@ public class PrepareConfigAssignDelegateTest {
private DelegateExecution execution = new DelegateExecutionFake();
@Before
- public void setUp(){
+ public void setUp() {
execution.setVariable("testProcessKey", TEST_PROCESS_KEY);
execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
execution.setVariable(MODEL_UUID, TEST_MODEL_UUID);
@@ -118,8 +112,8 @@ public class PrepareConfigAssignDelegateTest {
try {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(requestObject);
- ConfigAssignRequestPnf configAssignRequestPnf = mapper
- .treeToValue(tree.at("/config-assign-request"), ConfigAssignRequestPnf.class);
+ ConfigAssignRequestPnf configAssignRequestPnf =
+ mapper.treeToValue(tree.at("/config-assign-request"), ConfigAssignRequestPnf.class);
assertThat(configAssignRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID);
ConfigAssignPropertiesForPnf properties = configAssignRequestPnf.getConfigAssignPropertiesForPnf();
@@ -133,4 +127,4 @@ public class PrepareConfigAssignDelegateTest {
fail("Check request body is json message" + e.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java
index 0964d2146b..8d19d9e563 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ 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.
+ * 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.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.pnf.delegate;
@@ -34,7 +29,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -119,7 +113,7 @@ public class PrepareConfigDeployDelegateTest {
}
@Test
- public void testExecution_failedAaiConnection_exceptionThrown(){
+ public void testExecution_failedAaiConnection_exceptionThrown() {
try {
/**
* Mock the IOException from AAI.
@@ -128,13 +122,14 @@ public class PrepareConfigDeployDelegateTest {
} catch (IOException e) {
e.printStackTrace();
}
- assertThatThrownBy(()->prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
- assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString().contains("Unable to fetch from AAI");
+ assertThatThrownBy(() -> prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
+ assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
+ .contains("Unable to fetch from AAI");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
@Test
- public void testExecution_aaiEntryNotExist_exceptionThrown(){
+ public void testExecution_aaiEntryNotExist_exceptionThrown() {
try {
/**
* Mock the AAI without PNF.
@@ -143,8 +138,9 @@ public class PrepareConfigDeployDelegateTest {
} catch (IOException e) {
e.printStackTrace();
}
- assertThatThrownBy(()->prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
- assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString().contains("AAI entry for PNF: " + TEST_PNF_CORRELATION_ID + " does not exist");
+ assertThatThrownBy(() -> prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class);
+ assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString()
+ .contains("AAI entry for PNF: " + TEST_PNF_CORRELATION_ID + " does not exist");
assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class);
}
@@ -167,12 +163,11 @@ public class PrepareConfigDeployDelegateTest {
try {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(requestObject);
- ConfigDeployRequestPnf configDeployRequestPnf = mapper
- .treeToValue(tree.at("/config-deploy-request"), ConfigDeployRequestPnf.class);
+ ConfigDeployRequestPnf configDeployRequestPnf =
+ mapper.treeToValue(tree.at("/config-deploy-request"), ConfigDeployRequestPnf.class);
assertThat(configDeployRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID);
- ConfigDeployPropertiesForPnf properties = configDeployRequestPnf
- .getConfigDeployPropertiesForPnf();
+ ConfigDeployPropertiesForPnf properties = configDeployRequestPnf.getConfigDeployPropertiesForPnf();
assertThat(properties.getServiceInstanceId()).matches(TEST_SERVICE_INSTANCE_ID);
assertThat(properties.getPnfName()).matches(TEST_PNF_CORRELATION_ID);
assertThat(properties.getPnfId()).matches(TEST_PNF_UUID);
@@ -185,4 +180,4 @@ public class PrepareConfigDeployDelegateTest {
fail("Check request body is json message" + e.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index 17a6ee09d8..8741208d26 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import static org.assertj.core.api.Assertions.assertThat;
-
import java.util.List;
import org.junit.Test;
@@ -41,12 +40,12 @@ public class JsonUtilForPnfCorrelationIdTest {
@Test
public void parseJsonSuccessful() {
- List<String> expectedResult = JsonUtilForPnfCorrelationId
- .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID);
+ List<String> expectedResult =
+ JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID);
assertThat(expectedResult).containsExactly("corrTest1", "corrTest2");
- List<String> expectedResult2 = JsonUtilForPnfCorrelationId
- .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID);
+ List<String> expectedResult2 =
+ JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID);
assertThat(expectedResult2).containsExactly("corrTest3");
}
@@ -59,8 +58,8 @@ public class JsonUtilForPnfCorrelationIdTest {
@Test
public void parseJson_emptyListReturnedWhenNothingFound() {
- List<String> expectedResult = JsonUtilForPnfCorrelationId
- .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID);
+ List<String> expectedResult =
+ JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID);
assertThat(expectedResult).isEmpty();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index cbfe6c1512..ca3373e8cb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -30,14 +30,12 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
-
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
@@ -53,6 +51,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread;
import org.springframework.core.env.Environment;
+
@RunWith(MockitoJUnitRunner.class)
public class PnfEventReadyDmaapClientTest {
@@ -83,8 +82,8 @@ public class PnfEventReadyDmaapClientTest {
@Before
public void init() throws NoSuchFieldException, IllegalAccessException {
- when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
- when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
+ when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
+ when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
when(env.getProperty(eq("pnf.dmaap.protocol"))).thenReturn(PROTOCOL);
when(env.getProperty(eq("pnf.dmaap.uriPathPrefix"))).thenReturn(URI_PATH_PREFIX);
when(env.getProperty(eq("pnf.dmaap.topicName"))).thenReturn(EVENT_TOPIC_TEST);
@@ -102,56 +101,60 @@ public class PnfEventReadyDmaapClientTest {
/**
* Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the key that we get from response
- * <p> run method should invoke thread from map to notify camunda process, remove element from the map (map is
- * empty) and shutdown the executor because of empty map
+ * <p>
+ * - DmaapThreadListener is running, flag is set to true
+ * <p>
+ * - map is filled with one entry with the key that we get from response
+ * <p>
+ * run method should invoke thread from map to notify camunda process, remove element from the map (map is empty)
+ * and shutdown the executor because of empty map
*/
@Test
- public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady()
- throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID)));
+ public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady() throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class)))
+ .thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID)));
testedObjectInnerClassThread.run();
ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
- verify(httpClientMock).execute(captor1.capture());
-
- assertEquals(captor1.getValue().getURI().getHost(),HOST);
- assertEquals(captor1.getValue().getURI().getPort(),PORT);
- assertEquals(captor1.getValue().getURI().getScheme(),PROTOCOL);
- assertEquals(captor1.getValue().getURI().getPath(),"/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
-
- //verify(threadMockToNotifyCamundaFlow).run();
+ verify(httpClientMock).execute(captor1.capture());
+
+ assertEquals(captor1.getValue().getURI().getHost(), HOST);
+ assertEquals(captor1.getValue().getURI().getPort(), PORT);
+ assertEquals(captor1.getValue().getURI().getScheme(), PROTOCOL);
+ assertEquals(captor1.getValue().getURI().getPath(),
+ "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
+
+ // verify(threadMockToNotifyCamundaFlow).run();
verify(executorMock).shutdown();
}
/**
* Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId
- * taken from http response. run method should not do anything with the map not run any thread to notify camunda
- * process
+ * <p>
+ * - DmaapThreadListener is running, flag is set to true
+ * <p>
+ * - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId taken from http
+ * response. run method should not do anything with the map not run any thread to notify camunda process
*/
@Test
- public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap()
- throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(
- String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP)));
+ public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap() throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class))).thenReturn(createResponse(
+ String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP)));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
/**
* Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse
- * run method should not do anything with the map and not run any thread to notify camunda process
+ * <p>
+ * - DmaapThreadListener is running, flag is set to true
+ * <p>
+ * - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse run
+ * method should not do anything with the map and not run any thread to notify camunda process
*/
@Test
public void pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID));
+ when(httpClientMock.execute(any(HttpGet.class)))
+ .thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
@@ -167,8 +170,7 @@ public class PnfEventReadyDmaapClientTest {
executorField.set(testedObject, executorMock);
executorField.setAccessible(false);
- Field pnfCorrelationToThreadMapField = testedObject.getClass()
- .getDeclaredField("pnfCorrelationIdToThreadMap");
+ Field pnfCorrelationToThreadMapField = testedObject.getClass().getDeclaredField("pnfCorrelationIdToThreadMap");
pnfCorrelationToThreadMapField.setAccessible(true);
Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java
index 239361d306..61a4654668 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.vfcmodel;
import org.junit.Test;
-
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.rule.impl.NoNestedClassRule;
@@ -30,16 +29,12 @@ import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
public class VfcModelPojoTest {
- private String packageName = "org.onap.so.bpmn.infrastructure.vfcmodel";
+ private String packageName = "org.onap.so.bpmn.infrastructure.vfcmodel";
- @Test
- public void validate() {
- Validator validator = ValidatorBuilder.create()
- .with(new NoNestedClassRule())
- .with(new NoPublicFieldsRule())
- .with(new SetterTester())
- .with(new GetterTester())
- .build();
- validator.validate(packageName);
- }
+ @Test
+ public void validate() {
+ Validator validator = ValidatorBuilder.create().with(new NoNestedClassRule()).with(new NoPublicFieldsRule())
+ .with(new SetterTester()).with(new GetterTester()).build();
+ validator.validate(packageName);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
index 6e22123996..0b4050beec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.workflow.service;
import static org.mockito.Mockito.doReturn;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,80 +37,53 @@ public class ServicePluginFactoryTest {
@Spy
ServicePluginFactory servicePluginFactory;
- String uuiRequest = "{"
- + " \"service\":{"
- + " \"name\":\"ONAP_223531\","
- + " \"description\":\"ONAP_1546\","
- + " \"serviceInvariantUuid\":\"4a09419a-c9fd-4a53-b1bd-b49603169ca1\","
- + " \"serviceUuid\":\"1bd0eae6-2dcc-4461-9ae6-56d641f369d6\","
- + " \"globalSubscriberId\":\"test_custormer\","
- + " \"serviceType\":\"example-service-type\","
- + " \"parameters\":{"
- + " \"locationConstraints\":["
- + " ],"
- + " \"resources\":["
- + " {"
- + " \"resourceName\":\"vEPC_ONAP01\","
- + " \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\","
- + " \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\","
- + " \"resourceCustomizationUuid\":\"47a0e235-b67a-4ea4-a0cf-25761afed231\","
- + " \"parameters\":{"
- + " \"locationConstraints\":["
- + " {"
- + " \"vnfProfileId\":\"b244d433-8c9c-49ad-9c70-8e34b8dc8328\","
- + " \"locationConstraints\":{"
- + " \"vimId\":\"vmware_vio\""
- + " }"
- + " },"
- + " {"
- + " \"vnfProfileId\":\"8a9f7c48-21ce-41b7-95b8-a8ac61ccb1ff\","
- + " \"locationConstraints\":{"
- + " \"vimId\":\"core-dc_RegionOne\""
- + " }"
- + " }"
- + " ],"
- + " \"resources\":["
- + " ],"
- + " \"requestInputs\":{"
- + " \"sdncontroller\":\"\""
- + " }"
- + " }"
- + " },"
- + " {"
- + " \"resourceName\":\"VL OVERLAYTUNNEL\","
- + " \"resourceInvariantUuid\":\"184494cf-472f-436f-82e2-d83dddde21cb\","
- + " \"resourceUuid\":\"95bc3e59-c9c5-458f-ad6e-78874ab4b3cc\","
- + " \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed232\","
- + " \"parameters\":{"
- + " \"locationConstraints\":["
- + " ],"
- + " \"resources\":["
- + " ],"
- + " \"requestInputs\":{"
- + " }"
- + " }"
- + " }"
- + " ],"
- + " \"requestInputs\":{"
- + " \"vlunderlayvpn0_name\":\"l3connect\","
- + " \"vlunderlayvpn0_site1_id\":\"IP-WAN-Controller-1\","
- + " \"vlunderlayvpn0_site2_id\":\"SPTNController\","
- + " \"vlunderlayvpn0_site1_networkName\":\"network1,network2\","
- + " \"vlunderlayvpn0_site2_networkName\":\"network3,network4\","
- + " \"vlunderlayvpn0_site1_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1a\","
- + " \"vlunderlayvpn0_site2_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\","
- + " \"vlunderlayvpn0_site2_importRT1\":\"200:1,200:2\","
- + " \"vlunderlayvpn0_site1_exportRT1\":\"300:1,300:2\","
- + " \"vlunderlayvpn0_site2_exportRT1\":\"400:1,400:2\","
- + " \"vlunderlayvpn0_site1_vni\":\"2000\","
- + " \"vlunderlayvpn0_site2_vni\":\"3000\","
- + " \"vlunderlayvpn0_tunnelType\":\"L3-DCI\","
- + " \"CallSource\":\"NOT-ExternalAPI\","
- + " \"sotnconnectivity\":\"\""
- + " }"
- + " }"
- + " }"
- + "}";
+ String uuiRequest = "{" + " \"service\":{" + " \"name\":\"ONAP_223531\","
+ + " \"description\":\"ONAP_1546\","
+ + " \"serviceInvariantUuid\":\"4a09419a-c9fd-4a53-b1bd-b49603169ca1\","
+ + " \"serviceUuid\":\"1bd0eae6-2dcc-4461-9ae6-56d641f369d6\","
+ + " \"globalSubscriberId\":\"test_custormer\"," + " \"serviceType\":\"example-service-type\","
+ + " \"parameters\":{" + " \"locationConstraints\":[" + " ],"
+ + " \"resources\":[" + " {"
+ + " \"resourceName\":\"vEPC_ONAP01\","
+ + " \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\","
+ + " \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\","
+ + " \"resourceCustomizationUuid\":\"47a0e235-b67a-4ea4-a0cf-25761afed231\","
+ + " \"parameters\":{" + " \"locationConstraints\":["
+ + " {"
+ + " \"vnfProfileId\":\"b244d433-8c9c-49ad-9c70-8e34b8dc8328\","
+ + " \"locationConstraints\":{"
+ + " \"vimId\":\"vmware_vio\"" + " }"
+ + " }," + " {"
+ + " \"vnfProfileId\":\"8a9f7c48-21ce-41b7-95b8-a8ac61ccb1ff\","
+ + " \"locationConstraints\":{"
+ + " \"vimId\":\"core-dc_RegionOne\""
+ + " }" + " }" + " ],"
+ + " \"resources\":[" + " ],"
+ + " \"requestInputs\":{" + " \"sdncontroller\":\"\""
+ + " }" + " }" + " }," + " {"
+ + " \"resourceName\":\"VL OVERLAYTUNNEL\","
+ + " \"resourceInvariantUuid\":\"184494cf-472f-436f-82e2-d83dddde21cb\","
+ + " \"resourceUuid\":\"95bc3e59-c9c5-458f-ad6e-78874ab4b3cc\","
+ + " \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed232\","
+ + " \"parameters\":{" + " \"locationConstraints\":["
+ + " ]," + " \"resources\":[" + " ],"
+ + " \"requestInputs\":{" + " }" + " }"
+ + " }" + " ]," + " \"requestInputs\":{"
+ + " \"vlunderlayvpn0_name\":\"l3connect\","
+ + " \"vlunderlayvpn0_site1_id\":\"IP-WAN-Controller-1\","
+ + " \"vlunderlayvpn0_site2_id\":\"SPTNController\","
+ + " \"vlunderlayvpn0_site1_networkName\":\"network1,network2\","
+ + " \"vlunderlayvpn0_site2_networkName\":\"network3,network4\","
+ + " \"vlunderlayvpn0_site1_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1a\","
+ + " \"vlunderlayvpn0_site2_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\","
+ + " \"vlunderlayvpn0_site2_importRT1\":\"200:1,200:2\","
+ + " \"vlunderlayvpn0_site1_exportRT1\":\"300:1,300:2\","
+ + " \"vlunderlayvpn0_site2_exportRT1\":\"400:1,400:2\","
+ + " \"vlunderlayvpn0_site1_vni\":\"2000\","
+ + " \"vlunderlayvpn0_site2_vni\":\"3000\","
+ + " \"vlunderlayvpn0_tunnelType\":\"L3-DCI\","
+ + " \"CallSource\":\"NOT-ExternalAPI\"," + " \"sotnconnectivity\":\"\""
+ + " }" + " }" + " }" + "}";
@Test
@@ -123,16 +95,14 @@ public class ServicePluginFactoryTest {
@Test
public void doProcessSiteLocation_uuiObjectNull() {
String faultyJsonInput = "site_address,sotncondition_clientsignal";
- String result = servicePluginFactory.doProcessSiteLocation(
- serviceDecomposition, faultyJsonInput);
+ String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, faultyJsonInput);
Assert.assertEquals(result, faultyJsonInput);
}
@Test
public void doProcessSiteLocation_isSiteLocationLocal() {
String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}";
- String result = servicePluginFactory.doProcessSiteLocation(
- serviceDecomposition, jsonWithOnlyNeededValues);
+ String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, jsonWithOnlyNeededValues);
Assert.assertEquals(result, jsonWithOnlyNeededValues);
}
@@ -153,7 +123,7 @@ public class ServicePluginFactoryTest {
@Test
public void doTPResourcesAllocation_isNeedAllocateCrossTPResources() {
- //doReturn(null).when(servicePluginFactory).getTPsfromAAI();
+ // doReturn(null).when(servicePluginFactory).getTPsfromAAI();
String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}";
String result = servicePluginFactory.doTPResourcesAllocation(null, jsonWithOnlyNeededValues);
Assert.assertEquals(result, jsonWithOnlyNeededValues);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java
index ca8ec22088..f523e7ab1d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java
@@ -20,15 +20,14 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client;
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
public class HeaderUtilTest {
@Test
public void getAuthorizationTest() throws Exception {
- String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS);
- assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization);
+ String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS);
+ assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization);
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
index 4ac131f873..6f884cb126 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
@@ -20,13 +20,11 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
import static org.junit.Assert.assertEquals;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -52,10 +50,10 @@ public class AbstractBuilderTest {
DelegateExecution delegateExecution = new DelegateExecution() {
private String operType;
- private String resourceType;
- private String requestId;
+ private String resourceType;
+ private String requestId;
- @Override
+ @Override
public String getProcessInstanceId() {
return null;
}
@@ -207,14 +205,14 @@ public class AbstractBuilderTest {
@Override
public Object getVariable(String s) {
- if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
- return operType;
- } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
- return resourceType;
- } else if ("msoRequestId".equals(s)) {
- return requestId;
- }
- return null;
+ if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
+ return operType;
+ } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
+ return resourceType;
+ } else if ("msoRequestId".equals(s)) {
+ return requestId;
+ }
+ return null;
}
@Override
@@ -254,13 +252,13 @@ public class AbstractBuilderTest {
@Override
public void setVariable(String s, Object o) {
- if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
- operType = (String) o;
- } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
- resourceType = (String) o;
- } else if ("msoRequestId".equals(s)) {
- requestId = (String) o;
- }
+ if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
+ operType = (String) o;
+ } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
+ resourceType = (String) o;
+ } else if ("msoRequestId".equals(s)) {
+ requestId = (String) o;
+ }
}
@Override
@@ -328,27 +326,27 @@ public class AbstractBuilderTest {
}
- @Override
- public ProcessEngine getProcessEngine(){
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public ProcessEngine getProcessEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public void setProcessBusinessKey(String arg0){
- // TODO Auto-generated method stub
+ @Override
+ public void setProcessBusinessKey(String arg0) {
+ // TODO Auto-generated method stub
- }
+ }
};
@Test
public void requestActionGetIntValueTest() {
- assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue());
+ assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue());
}
@Test
public void svcActionGetIntValueTest() {
- assertEquals(0, SvcAction.RESERVE.getIntValue());
+ assertEquals(0, SvcAction.RESERVE.getIntValue());
}
@Test
@@ -358,81 +356,93 @@ public class AbstractBuilderTest {
@Test
public void getRequestActionBlankOperationTypeTest() throws Exception {
- assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionDeleteOperationTypeBlankResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
- assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
+ assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionDeleteOperationTypeBadResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
- assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
+ assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
- assertEquals(AbstractBuilder.RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
+ assertEquals(AbstractBuilder.RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
- assertEquals(AbstractBuilder.RequestAction.DELETE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
+ assertEquals(AbstractBuilder.RequestAction.DELETE_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionDeleteOperationTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionCreateOperationTypeBlankResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
- assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
+ assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionCreateOperationTypeBadResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
- assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
+ assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionCreateOperationTypeOverlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
- assertEquals(AbstractBuilder.RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
+ assertEquals(AbstractBuilder.RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
- assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
+ assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionCreateOperationTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
public void getRequestActionBadOperationType() {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
- assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
+ assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(),
+ abstractBuilder.getRequestAction(delegateExecution));
}
@Test
@@ -442,95 +452,95 @@ public class AbstractBuilderTest {
@Test
public void getSvcActionDeleteOperationTypeBlankResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
- assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
+ assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionDeleteOperationTypeBadResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
- assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
+ assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
- assertEquals(AbstractBuilder.SvcAction.DEACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
+ assertEquals(AbstractBuilder.SvcAction.DEACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
- assertEquals(AbstractBuilder.SvcAction.DELETE.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
+ assertEquals(AbstractBuilder.SvcAction.DELETE.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionDeleteOperationTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
- assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
+ assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionCreateOperationTypeBlankResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
- assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
+ assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionCreateOperationTypeBadResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
- assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
+ assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionCreateOperationTypeOverlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
- assertEquals(AbstractBuilder.SvcAction.ACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
+ assertEquals(AbstractBuilder.SvcAction.ACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
- assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
+ assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionCreateOperationTypeTest() throws Exception {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
- assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
+ assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getSvcActionBadOperationType() {
- delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
- assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
+ delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
+ assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
}
@Test
public void getRequestIdBlankNotOnExecutionTest() {
- abstractBuilder.getRequestId(delegateExecution);
+ abstractBuilder.getRequestId(delegateExecution);
}
@Test
public void getRequestIdBlankOnExecutionTest() {
- String expected = "requestId";
- delegateExecution.setVariable("msoRequestId", expected);
- assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
+ String expected = "requestId";
+ delegateExecution.setVariable("msoRequestId", expected);
+ assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
}
@Test
public void getRequestIdTest() {
- String expected = "requestId";
- abstractBuilder.requestId = expected;
- assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
+ String expected = "requestId";
+ abstractBuilder.requestId = expected;
+ assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
}
@Test
@@ -545,8 +555,8 @@ public class AbstractBuilderTest {
@Test
public void getParamEntitiesTest() throws Exception {
- Map<String, String> inputs = new HashMap<>();
- inputs.put("foo", "bar");
+ Map<String, String> inputs = new HashMap<>();
+ inputs.put("foo", "bar");
List<ParamEntity> list = abstractBuilder.getParamEntities(inputs);
assertEquals(1, list.size());
assertEquals("foo", list.get(0).getName());
@@ -555,14 +565,14 @@ public class AbstractBuilderTest {
@Test
public void getParamEntitiesNullInputsTest() {
- List<ParamEntity> list = abstractBuilder.getParamEntities(null);
- assertEquals(0, list.size());
+ List<ParamEntity> list = abstractBuilder.getParamEntities(null);
+ assertEquals(0, list.size());
}
@Test
public void getParamEntitiesEmptyInputsTest() {
- List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>());
- assertEquals(0, list.size());
+ List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>());
+ assertEquals(0, list.size());
}
@Test
@@ -580,4 +590,4 @@ public class AbstractBuilderTest {
abstractBuilder.getServiceInstanceName(delegateExecution);
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java
index 4e39c7b4e3..ed16f5d197 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
-
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -35,14 +34,14 @@ import org.camunda.bpm.model.bpmn.instance.FlowElement;
import org.junit.Test;
public class NetworkRpcInputEntityBuilderTest {
- NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder();
+ NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder();
- DelegateExecution delegateExecution = new DelegateExecution() {
+ DelegateExecution delegateExecution = new DelegateExecution() {
private String operType;
- private String resourceType;
- private String requestId;
+ private String resourceType;
+ private String requestId;
- @Override
+ @Override
public String getProcessInstanceId() {
return null;
}
@@ -194,14 +193,14 @@ public class NetworkRpcInputEntityBuilderTest {
@Override
public Object getVariable(String s) {
- if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
- return operType;
- } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
- return resourceType;
- } else if ("msoRequestId".equals(s)) {
- return requestId;
- }
- return null;
+ if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
+ return operType;
+ } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
+ return resourceType;
+ } else if ("msoRequestId".equals(s)) {
+ return requestId;
+ }
+ return null;
}
@Override
@@ -241,13 +240,13 @@ public class NetworkRpcInputEntityBuilderTest {
@Override
public void setVariable(String s, Object o) {
- if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
- operType = (String) o;
- } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
- resourceType = (String) o;
- } else if ("msoRequestId".equals(s)) {
- requestId = (String) o;
- }
+ if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
+ operType = (String) o;
+ } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
+ resourceType = (String) o;
+ } else if ("msoRequestId".equals(s)) {
+ requestId = (String) o;
+ }
}
@Override
@@ -315,22 +314,22 @@ public class NetworkRpcInputEntityBuilderTest {
}
- @Override
- public ProcessEngine getProcessEngine(){
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public ProcessEngine getProcessEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public void setProcessBusinessKey(String arg0){
- // TODO Auto-generated method stub
+ @Override
+ public void setProcessBusinessKey(String arg0) {
+ // TODO Auto-generated method stub
- }
+ }
};
- @Test
- public void buildTest() {
- networRpcInputEntityBuilder.build(delegateExecution, null);
- }
+ @Test
+ public void buildTest() {
+ networRpcInputEntityBuilder.build(delegateExecution, null);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java
index 556ff67fad..3d1b1de8c0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
-
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -35,14 +34,14 @@ import org.camunda.bpm.model.bpmn.instance.FlowElement;
import org.junit.Test;
public class ServiceRpcInputEntityBuilderTest {
- ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder();
+ ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder();
- DelegateExecution delegateExecution = new DelegateExecution() {
+ DelegateExecution delegateExecution = new DelegateExecution() {
private String operType;
- private String resourceType;
- private String requestId;
+ private String resourceType;
+ private String requestId;
- @Override
+ @Override
public String getProcessInstanceId() {
return null;
}
@@ -194,14 +193,14 @@ public class ServiceRpcInputEntityBuilderTest {
@Override
public Object getVariable(String s) {
- if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
- return operType;
- } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
- return resourceType;
- } else if ("msoRequestId".equals(s)) {
- return requestId;
- }
- return null;
+ if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
+ return operType;
+ } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
+ return resourceType;
+ } else if ("msoRequestId".equals(s)) {
+ return requestId;
+ }
+ return null;
}
@Override
@@ -241,13 +240,13 @@ public class ServiceRpcInputEntityBuilderTest {
@Override
public void setVariable(String s, Object o) {
- if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
- operType = (String) o;
- } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
- resourceType = (String) o;
- } else if ("msoRequestId".equals(s)) {
- requestId = (String) o;
- }
+ if (AbstractBuilder.OPERATION_TYPE.equals(s)) {
+ operType = (String) o;
+ } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) {
+ resourceType = (String) o;
+ } else if ("msoRequestId".equals(s)) {
+ requestId = (String) o;
+ }
}
@Override
@@ -315,22 +314,22 @@ public class ServiceRpcInputEntityBuilderTest {
}
- @Override
- public ProcessEngine getProcessEngine(){
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public ProcessEngine getProcessEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public void setProcessBusinessKey(String arg0){
- // TODO Auto-generated method stub
+ @Override
+ public void setProcessBusinessKey(String arg0) {
+ // TODO Auto-generated method stub
- }
+ }
};
- @Test
- public void buildTest() throws Exception {
- serviceRpcInputEntityBuilder.build(delegateExecution, null);
- }
+ @Test
+ public void buildTest() throws Exception {
+ serviceRpcInputEntityBuilder.build(delegateExecution, null);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java
index c8949cee0f..70dfd6bd57 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity;
import org.junit.Test;
-
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
import com.openpojo.validation.Validator;
@@ -36,41 +35,34 @@ import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
public class ClientEntityPojoTest {
- @Test
- public void pojoStructure() {
- test(PojoClassFactory.getPojoClass(NetworkInformationEntity.class));
- test(PojoClassFactory.getPojoClass(NetworkInputParametersEntity.class));
- test(PojoClassFactory.getPojoClass(NetworkRequestInputEntity.class));
- test(PojoClassFactory.getPojoClass(NetworkResponseInformationEntity.class));
- test(PojoClassFactory.getPojoClass(NetworkTopologyOperationInputEntity.class));
- test(PojoClassFactory.getPojoClass(NetworkTopologyOperationOutputEntity.class));
- test(PojoClassFactory.getPojoClass(OnapModelInformationEntity.class));
- test(PojoClassFactory.getPojoClass(ParamEntity.class));
- test(PojoClassFactory.getPojoClass(RequestInformationEntity.class));
- test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationInputEntity.class));
- test(PojoClassFactory.getPojoClass(SdncRequestHeaderEntity.class));
- test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationInputEntity.class));
- test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationOutputEntity.class));
- test(PojoClassFactory.getPojoClass(ServiceInformationEntity.class));
- test(PojoClassFactory.getPojoClass(ServiceInputParametersEntity.class));
- test(PojoClassFactory.getPojoClass(ServiceRequestInputEntity.class));
- test(PojoClassFactory.getPojoClass(ServiceResponseInformationEntity.class));
- test(PojoClassFactory.getPojoClass(ServiceTopologyOperationInputEntity.class));
- test(PojoClassFactory.getPojoClass(ServiceTopologyOperationOutputEntity.class));
- test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationOutputEntity.class));
- }
-
- private void test(PojoClass pojoClass) {
- Validator validator = ValidatorBuilder.create()
- .with(new GetterMustExistRule())
- .with(new SetterMustExistRule())
- .with(new NoNestedClassRule())
- .with(new NoPrimitivesRule())
- .with(new NoPublicFieldsRule())
- .with(new SetterTester())
- .with(new GetterTester())
- .with(new DefaultValuesNullTester())
- .build();
- validator.validate(pojoClass);
- }
+ @Test
+ public void pojoStructure() {
+ test(PojoClassFactory.getPojoClass(NetworkInformationEntity.class));
+ test(PojoClassFactory.getPojoClass(NetworkInputParametersEntity.class));
+ test(PojoClassFactory.getPojoClass(NetworkRequestInputEntity.class));
+ test(PojoClassFactory.getPojoClass(NetworkResponseInformationEntity.class));
+ test(PojoClassFactory.getPojoClass(NetworkTopologyOperationInputEntity.class));
+ test(PojoClassFactory.getPojoClass(NetworkTopologyOperationOutputEntity.class));
+ test(PojoClassFactory.getPojoClass(OnapModelInformationEntity.class));
+ test(PojoClassFactory.getPojoClass(ParamEntity.class));
+ test(PojoClassFactory.getPojoClass(RequestInformationEntity.class));
+ test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationInputEntity.class));
+ test(PojoClassFactory.getPojoClass(SdncRequestHeaderEntity.class));
+ test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationInputEntity.class));
+ test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationOutputEntity.class));
+ test(PojoClassFactory.getPojoClass(ServiceInformationEntity.class));
+ test(PojoClassFactory.getPojoClass(ServiceInputParametersEntity.class));
+ test(PojoClassFactory.getPojoClass(ServiceRequestInputEntity.class));
+ test(PojoClassFactory.getPojoClass(ServiceResponseInformationEntity.class));
+ test(PojoClassFactory.getPojoClass(ServiceTopologyOperationInputEntity.class));
+ test(PojoClassFactory.getPojoClass(ServiceTopologyOperationOutputEntity.class));
+ test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationOutputEntity.class));
+ }
+
+ private void test(PojoClass pojoClass) {
+ Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
+ .with(new NoNestedClassRule()).with(new NoPrimitivesRule()).with(new NoPublicFieldsRule())
+ .with(new SetterTester()).with(new GetterTester()).with(new DefaultValuesNullTester()).build();
+ validator.validate(pojoClass);
+ }
}