aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql175
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy169
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java192
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java89
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java112
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java112
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java45
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java88
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java87
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java70
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java70
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java68
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java51
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java50
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java41
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java42
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn98
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn50
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml306
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java150
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java89
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java75
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java248
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java167
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java78
-rw-r--r--common/src/main/java/org/onap/so/client/RestTemplateConfig.java34
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProperties.java17
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java54
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpClientConnectionConfiguration.java)34
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/RestTemplateConfiguration.java)30
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProvider.java)24
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java2
-rw-r--r--common/src/main/java/org/onap/so/rest/exceptions/InvalidRestRequestException.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/InvalidRestRequestException.java)13
-rw-r--r--common/src/main/java/org/onap/so/rest/exceptions/RestProcessingException.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/RestProcessingException.java)12
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java72
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProviderImpl.java)125
-rw-r--r--common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java20
-rw-r--r--common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java58
-rw-r--r--common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java45
-rw-r--r--common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java252
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java3
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java49
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java28
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java4
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java37
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java2
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java12
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java19
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java41
-rw-r--r--so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java61
69 files changed, 3967 insertions, 582 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql
new file mode 100644
index 0000000000..e44a6b97ba
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql
@@ -0,0 +1,175 @@
+USE catalogdb;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`workflow` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ARTIFACT_UUID` VARCHAR(200) NOT NULL,
+ `ARTIFACT_NAME` VARCHAR(200) NOT NULL,
+ `NAME` VARCHAR(200) NOT NULL,
+ `OPERATION_NAME` VARCHAR(200) NULL,
+ `VERSION` DOUBLE NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `BODY` LONGTEXT NULL,
+ `RESOURCE_TARGET` VARCHAR(200) NOT NULL,
+ `SOURCE` VARCHAR(200) NOT NULL,
+ `TIMEOUT_MINUTES` INT(11) NULL DEFAULT NULL,
+ `ARTIFACT_CHECKSUM` VARCHAR(200) NULL DEFAULT 'MANUAL RECORD',
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_workflow` (`ARTIFACT_UUID` ASC, `NAME` ASC, `VERSION` ASC, `SOURCE` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`vnf_resource_to_workflow` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `VNF_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `WORKFLOW_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_vnf_resource_to_workflow` (`VNF_RESOURCE_MODEL_UUID` ASC, `WORKFLOW_ID` ASC),
+ INDEX `fk_vnf_resource_to_workflow__workflow1_idx` (`WORKFLOW_ID` ASC),
+ INDEX `fk_vnf_resource_to_workflow__vnf_res_mod_uuid_idx` (`VNF_RESOURCE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_vnf_resource_to_workflow__vnf_resource1`
+ FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`)
+ REFERENCES `catalogdb`.`vnf_resource` (`MODEL_UUID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_resource_to_workflow__workflow1`
+ FOREIGN KEY (`WORKFLOW_ID`)
+ REFERENCES `catalogdb`.`workflow` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NOT NULL,
+ `VERSION` DOUBLE NOT NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec` (`NAME` ASC, `VERSION` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`user_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `PAYLOAD_LOCATION` VARCHAR(500) NULL,
+ `LABEL` VARCHAR(200) NOT NULL,
+ `TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `IS_REQUIRED` TINYINT(1) NOT NULL,
+ `MAX_LENGTH` INT(11) NULL,
+ `ALLOWABLE_CHARS` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_user_parameters` (`NAME` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`workflow_activity_spec_sequence` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `WORKFLOW_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `SEQ_NO` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_workflow_activity_spec_sequence` (`WORKFLOW_ID` ASC, `ACTIVITY_SPEC_ID` ASC, `SEQ_NO` ASC),
+ INDEX `fk_workflow_activity_spec_sequence__activity_spec_idx` (`ACTIVITY_SPEC_ID` ASC),
+ INDEX `fk_workflow_activity_spec_sequence__workflow_actifact_uuid_idx` (`WORKFLOW_ID` ASC),
+ CONSTRAINT `fk_workflow_activity_spec_sequence__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_workflow_activity_spec_sequence__workflow1`
+ FOREIGN KEY (`WORKFLOW_ID`)
+ REFERENCES `catalogdb`.`workflow` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `TYPE` VARCHAR(200) NOT NULL,
+ `DIRECTION` VARCHAR(200) NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_parameters` (`NAME` ASC, `DIRECTION` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_categories` (
+ `ID` INT(11) NOT NULL,
+ `NAME` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_categories` (`NAME` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_to_activity_spec_categories` (
+ `ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_CATEGORIES_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_to_activity_spec_categories` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_CATEGORIES_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx` (`ACTIVITY_SPEC_CATEGORIES_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx1` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec_c1`
+ FOREIGN KEY (`ACTIVITY_SPEC_CATEGORIES_ID`)
+ REFERENCES `catalogdb`.`activity_spec_categories` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_to_activity_spec_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_PARAMETERS_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_activity_spec_to_activity_spec_params__act_sp_param_id_idx` (`ACTIVITY_SPEC_PARAMETERS_ID` ASC),
+ UNIQUE INDEX `UK_activity_spec_to_activity_spec_parameters` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_parameters__act_spec_id_idx` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activity_spec_1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activ_spec_param1`
+ FOREIGN KEY (`ACTIVITY_SPEC_PARAMETERS_ID`)
+ REFERENCES `catalogdb`.`activity_spec_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_to_user_parameters` (
+ `ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `USER_PARAMETERS_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_to_user_parameters` (`ACTIVITY_SPEC_ID` ASC, `USER_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_user_parameters__user_parameters1_idx` (`USER_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_user_parameters__activity_spec1_idx` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_user_parameters__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_user_parameters__user_parameters1`
+ FOREIGN KEY (`USER_PARAMETERS_ID`)
+ REFERENCES `catalogdb`.`user_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index 56d425745f..7e866f9008 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -44,6 +44,7 @@
<sourceFolder>src/gen/java/main</sourceFolder>
<withXml>true</withXml>
<useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
</configOptions>
</configuration>
</execution>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index dba6a1a2bb..484be19137 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -32,111 +34,15 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIResourcesClient
import org.springframework.web.util.UriUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.JsonSlurper
public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
- public MsoUtils utils = new MsoUtils()
-
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- */
- public void logError(String message) {
- log('ERROR', message, null, "true")
- }
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logError(String message, Throwable cause) {
- log('ERROR', message, cause, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- */
- public void logWarn(String message) {
- log('WARN', message, null, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logWarn(String message, Throwable cause) {
- log('WARN', message, cause, "true")
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, String isDebugLogEnabled) {
- log('DEBUG', message, null, isDebugLogEnabled)
- }
+ private static final Logger logger = LoggerFactory.getLogger( MsoUtils.class);
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, Throwable cause, String isDebugLogEnabled) {
- log('DEBUG', message, cause, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, String isLevelEnabled) {
- log(level, message, null, isLevelEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, Throwable cause, String isLevelEnabled) {
- if (cause == null) {
- utils.log(level, message, isLevelEnabled);
- } else {
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- printWriter.println(message);
- cause.printStackTrace(printWriter);
- utils.log(level, stringWriter.toString(), isLevelEnabled);
- printWriter.close();
- }
- }
-
- /**
- * Logs a WorkflowException at the ERROR level with the specified message.
- * @param execution the execution
- */
- public void logWorkflowException(DelegateExecution execution, String message) {
- def workflowException = execution.getVariable("WorkflowException")
-
- if (workflowException == null) {
- logError(message);
- } else {
- logError(message + ": " + workflowException)
- }
- }
+ public MsoUtils utils = new MsoUtils()
/**
* Saves the WorkflowException in the execution to the specified variable,
@@ -173,7 +79,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
', requredVariables=' + requiredVariables +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
+ logger.debug('Entered ' + method)
String processKey = getProcessKey(execution)
def prefix = execution.getVariable("prefix")
@@ -236,13 +142,13 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
serviceInstanceId = (String) execution.getVariable("mso-service-instance-id")
}
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.debug('Exited ' + method)
return request
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logError('Caught exception in ' + method, e)
+ logger.error('Caught exception in ' + method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -258,7 +164,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
+ logger.debug('Entered ' + method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
@@ -278,8 +184,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def parsed = jsonSlurper.parseText(request)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.debug('Exited ' + method)
return parsed
}
@@ -309,10 +215,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) {
- logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled)
+ logger.debug("Sync response has already been sent for " + processKey)
}else{
- logDebug("Building " + processKey + " response ", isDebugLogEnabled)
+ logger.debug("Building " + processKey + " response ")
int intResponseCode;
@@ -337,11 +243,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable(processKey + "Status", status);
execution.setVariable("WorkflowResponse", response)
- logDebug("Sending response for " + processKey
+ logger.debug("Sending response for " + processKey
+ " ResponseCode=" + intResponseCode
+ " Status=" + status
- + " Response=\n" + response,
- isDebugLogEnabled)
+ + " Response=\n" + response)
// TODO: ensure that this flow was invoked asynchronously?
@@ -362,7 +267,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
} catch (Exception ex) {
- logError("Unable to send workflow response to client ....", ex)
+ logger.error("Unable to send workflow response to client ....", ex)
}
}
@@ -432,7 +337,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def element = utils.getNodeXml(xml, elementName, false)
if (element.trim().isEmpty()) {
def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
} else {
return element
@@ -454,7 +359,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def elementText = utils.getNodeText(xml, elementName)
if ((elementText == null) || (elementText.isEmpty())) {
def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
} else {
return elementText
@@ -569,9 +474,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
String prefix = execution.getVariable('prefix')
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled)
+ logger.debug('Entered SetSuccessIndicator Method')
execution.setVariable(prefix+'SuccessIndicator', isSuccess)
- logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled)
+ logger.debug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '')
}
/**
@@ -579,14 +484,14 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*
*/
public void sendSyncError(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String requestId = execution.getVariable("mso-request-id")
- logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
+ logger.debug('sendSyncError, requestId: ' + requestId)
WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException")
if (workflowExceptionObj != null) {
String errorMessage = workflowExceptionObj.getErrorMessage()
def errorCode = workflowExceptionObj.getErrorCode()
- logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled)
+ logger.debug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode)
sendWorkflowResponse(execution, errorCode, errorMessage)
}
}
@@ -602,27 +507,27 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
DelegateExecution execution = (DelegateExecution) args[0]
def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
- def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + classAndMethod, isDebugEnabled)
- logDebug('Received parameters: ' + args, isDebugEnabled)
+ logger.debug('Entered ' + classAndMethod)
+ logger.debug('Received parameters: ' + args)
try{
def methodToCall = this.metaClass.getMetaMethod(methodName, args)
- logDebug('Method to call: ' + methodToCall, isDebugEnabled)
+ logger.debug('Method to call: ' + methodToCall)
methodToCall?.invoke(this, args)
}
catch(BpmnError bpmnError) {
- logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled)
+ logger.debug('Rethrowing BpmnError ' + bpmnError.getMessage())
throw bpmnError
}
catch(Exception e) {
e.printStackTrace()
- logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled)
+ logger.debug('Unexpected error encountered - ' + e.getMessage())
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
finally {
- logDebug('Exited ' + classAndMethod, isDebugEnabled)
+ logger.debug('Exited ' + classAndMethod)
}
}
}
@@ -718,8 +623,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def disableRollback = execution.getVariable("disableRollback")
def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean()
- logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled)
- logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled)
+ logger.debug('disableRollback: ' + disableRollback)
+ logger.debug('defaultRollback: ' + defaultRollback)
def rollbackEnabled
@@ -727,7 +632,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
// get from default urn settings for mso_rollback
disableRollback = !defaultRollback
rollbackEnabled = defaultRollback
- logDebug('disableRollback is null or empty!', isDebugLogEnabled)
+ logger.debug('disableRollback is null or empty!')
}
else {
if(disableRollback == true) {
@@ -742,7 +647,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
- logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
+ logger.debug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled)
}
public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
@@ -752,7 +657,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+ logger.debug(dataErrorMessage)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index c2e4ee4454..92c1579aa0 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -290,7 +290,7 @@ class MsoUtils {
}
}
- def log(logmode,logtxt,isDebugLogEnabled="false"){
+ def private log(logmode,logtxt,isDebugLogEnabled="false"){
if ("INFO"==logmode) {
logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN");
} else if ("WARN"==logmode) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
index ba3ab7f315..c6e7668f22 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
@@ -143,8 +143,28 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
private String nfFunction;
@JsonProperty("nf-role")
private String nfRole;
+ @JsonProperty("CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+ @JsonProperty("CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
public String getNfFunction() {
return nfFunction;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
new file mode 100644
index 0000000000..29abe4413b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
@@ -0,0 +1,192 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader;
+import org.onap.ccsdk.apps.controllerblueprints.common.api.EventType;
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.so.client.PreconditionFailedException;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.Struct;
+import com.google.protobuf.Struct.Builder;
+import com.google.protobuf.util.JsonFormat;
+
+import io.grpc.Status;
+
+/**
+ * Util class to support Call to CDS client
+ *
+ */
+@Component
+public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractCDSProcessingBBUtils.class);
+
+ private static final String SUCCESS = "Success";
+ private static final String FAILED = "Failed";
+ private static final String PROCESSING = "Processing";
+
+ private final AtomicReference<String> cdsResponse = new AtomicReference<>();
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ /**
+ * Extracting data from execution object and building the ExecutionServiceInput
+ * Object
+ *
+ * @param execution
+ * DelegateExecution object
+ */
+ public void constructExecutionServiceInputObject(DelegateExecution execution) {
+ logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest ");
+
+ try {
+ AbstractCDSPropertiesBean executionObject = (AbstractCDSPropertiesBean) execution
+ .getVariable("executionObject");
+
+ String payload = executionObject.getRequestObject();
+
+ CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId())
+ .setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId())
+ .build();
+ ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder()
+ .setBlueprintName(executionObject.getBlueprintName())
+ .setBlueprintVersion(executionObject.getBlueprintVersion())
+ .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
+
+ Builder struct = Struct.newBuilder();
+ try {
+ JsonFormat.parser().merge(payload, struct);
+ } catch (InvalidProtocolBufferException e) {
+ logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}",
+ executionObject.getBlueprintVersion(), executionObject.getBlueprintName(),
+ executionObject.getActionName(), e);
+ }
+
+ ExecutionServiceInput executionServiceInput = ExecutionServiceInput.newBuilder()
+ .setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers).setPayload(struct.build())
+ .build();
+
+ execution.setVariable("executionServiceInput", executionServiceInput);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * get the executionServiceInput object from execution and send a request to CDS
+ * Client and wait for TIMEOUT period
+ *
+ * @param execution
+ * DelegateExecution object
+ */
+ public void sendRequestToCDSClient(DelegateExecution execution) {
+
+ logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient ");
+ try {
+ CDSProperties props = RestPropertiesLoader.getInstance().getNewImpl(CDSProperties.class);
+ if (props == null) {
+ throw new PreconditionFailedException(
+ "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
+ }
+
+ ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution
+ .getVariable("executionServiceInput");
+
+ CDSProcessingListener cdsProcessingListener = new AbstractCDSProcessingBBUtils();
+
+ CDSProcessingClient cdsClient = new CDSProcessingClient(cdsProcessingListener);
+ CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
+
+ try {
+ countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
+ } finally {
+ cdsClient.close();
+ }
+
+ if (cdsResponse != null) {
+ execution.setVariable("CDSStatus", cdsResponse.get());
+ }
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Get Response from CDS Client
+ *
+ */
+ @Override
+ public void onMessage(ExecutionServiceOutput message) {
+ logger.info("Received notification from CDS: {}", message);
+ EventType eventType = message.getStatus().getEventType();
+
+ switch (eventType) {
+
+ case EVENT_COMPONENT_FAILURE:
+ // failed processing with failure
+ cdsResponse.set(FAILED);
+ break;
+ case EVENT_COMPONENT_PROCESSING:
+ // still processing
+ cdsResponse.set(PROCESSING);
+ break;
+ case EVENT_COMPONENT_EXECUTED:
+ // done with async processing
+ cdsResponse.set(SUCCESS);
+ break;
+ default:
+ cdsResponse.set(FAILED);
+ break;
+ }
+
+ }
+
+ /**
+ * On error at CDS, log the error
+ */
+ @Override
+ public void onError(Throwable t) {
+ Status status = Status.fromThrowable(t);
+ logger.error("Failed processing blueprint {}", status, t);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
new file mode 100644
index 0000000000..4b645984cf
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
@@ -0,0 +1,89 @@
+package org.onap.so.client.cds.beans;
+
+import java.io.Serializable;
+
+public class AbstractCDSPropertiesBean implements Serializable {
+
+ private static final long serialVersionUID = -4800522372460352963L;
+
+ private String blueprintName;
+
+ private String blueprintVersion;
+
+ private String requestObject;
+
+ private String originatorId;
+
+ private String requestId;
+
+ private String subRequestId;
+
+ private String actionName;
+
+ private String mode;
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+ public String getRequestObject() {
+ return requestObject;
+ }
+
+ public void setRequestObject(String requestObject) {
+ this.requestObject = requestObject;
+ }
+
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ public void setOriginatorId(String originatorId) {
+ this.originatorId = originatorId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getSubRequestId() {
+ return subRequestId;
+ }
+
+ public void setSubRequestId(String subRequestId) {
+ this.subRequestId = subRequestId;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
new file mode 100644
index 0000000000..bdb9161735
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
@@ -0,0 +1,112 @@
+package org.onap.so.client.cds.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"pnf-id",
+"pnf-name",
+"service-model-uuid",
+"pnf-customization-uuid"
+})
+
+public class ConfigAssignPropertiesForPnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("pnf-id")
+ private String pnfId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
+
+ @JsonIgnore
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getPnfCustomizationUuid() {
+ return pnfCustomizationUuid;
+ }
+
+ public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
+ this.pnfCustomizationUuid = pnfCustomizationUuid;
+ }
+
+ public Map<String, Object> getUserParam() {
+ return this.userParam;
+ }
+
+ public void setUserParam(String name, Object value) {
+ this.userParam.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
new file mode 100644
index 0000000000..1ce26d8585
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
@@ -0,0 +1,112 @@
+package org.onap.so.client.cds.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"vnf-id",
+"vnf-name",
+"service-model-uuid",
+"vnf-customization-uuid"
+})
+
+public class ConfigAssignPropertiesForVnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnf-name")
+ private String vnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
+
+ @JsonIgnore
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
+
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
+
+ public Map<String, Object> getUserParam() {
+ return this.userParam;
+ }
+
+ public void setUserParam(String name, Object value) {
+ this.userParam.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
new file mode 100644
index 0000000000..b96847f422
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
@@ -0,0 +1,46 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-assign-properties",
+"resolution-key"
+})
+
+public class ConfigAssignRequestPnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+ @JsonProperty("config-assign-properties")
+ private ConfigAssignPropertiesForPnf configAssignPropertiesForPnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigAssignPropertiesForPnf getConfigAssignPropertiesForPnf() {
+ return configAssignPropertiesForPnf;
+ }
+
+ public void setConfigAssignPropertiesForPnf(ConfigAssignPropertiesForPnf configAssignPropertiesForPnf) {
+ this.configAssignPropertiesForPnf = configAssignPropertiesForPnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
new file mode 100644
index 0000000000..b3a9601e2e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
@@ -0,0 +1,45 @@
+
+package org.onap.so.client.cds.beans;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-assign-properties",
+"resolution-key"
+})
+public class ConfigAssignRequestVnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+ @JsonProperty("config-assign-properties")
+ private ConfigAssignPropertiesForVnf configAssignPropertiesForVnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigAssignPropertiesForVnf getConfigAssignPropertiesForVnf() {
+ return configAssignPropertiesForVnf;
+ }
+
+ public void setConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignPropertiesForVnf) {
+ this.configAssignPropertiesForVnf = configAssignPropertiesForVnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
new file mode 100644
index 0000000000..b8fb5b96bd
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
@@ -0,0 +1,88 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"pnf-id",
+"pnf-name",
+"service-model-uuid",
+"pnf-customization-uuid"
+})
+
+public class ConfigDeployPropertiesForPnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("pnf-id")
+ private String pnfId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getPnfCustomizationUuid() {
+ return pnfCustomizationUuid;
+ }
+
+ public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
+ this.pnfCustomizationUuid = pnfCustomizationUuid;
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
new file mode 100644
index 0000000000..ca2530b541
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
@@ -0,0 +1,87 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"vnf-id",
+"vnf-name",
+"service-model-uuid",
+"vnf-customization-uuid"
+})
+public class ConfigDeployPropertiesForVnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnf-name")
+ private String vnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
+
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
new file mode 100644
index 0000000000..4635008d3f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
@@ -0,0 +1,46 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-deploy-properties",
+"resolution-key"
+})
+public class ConfigDeployRequestPnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+
+ @JsonProperty("config-deploy-properties")
+ private ConfigDeployPropertiesForPnf configDeployPropertiesForPnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigDeployPropertiesForPnf getConfigDeployPropertiesForPnf() {
+ return configDeployPropertiesForPnf;
+ }
+
+ public void setConfigDeployPropertiesForPnf(ConfigDeployPropertiesForPnf configDeployPropertiesForPnf) {
+ this.configDeployPropertiesForPnf = configDeployPropertiesForPnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
new file mode 100644
index 0000000000..53b956d3c4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
@@ -0,0 +1,46 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-deploy-properties",
+"resolution-key"
+})
+public class ConfigDeployRequestVnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+
+ @JsonProperty("config-deploy-properties")
+ private ConfigDeployPropertiesForVnf configDeployPropertiesForVnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigDeployPropertiesForVnf getConfigDeployPropertiesForVnf() {
+ return configDeployPropertiesForVnf;
+ }
+
+ public void setConfigDeployPropertiesForVnf(ConfigDeployPropertiesForVnf configDeployPropertiesForVnf) {
+ this.configDeployPropertiesForVnf = configDeployPropertiesForVnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
index 1967e5a1ce..d1888b17df 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
@@ -30,6 +30,7 @@ public class CDSPropertiesImpl implements CDSProperties {
private static final String ENDPOINT = "cds.endpoint";
private static final String PORT = "cds.port";
private static final String AUTH = "cds.auth";
+ private static final String TIMEOUT = "cds.timeout";
public CDSPropertiesImpl() {
// Needed for service loader
@@ -74,4 +75,9 @@ public class CDSPropertiesImpl implements CDSProperties {
public boolean mapNotFoundToEmpty() {
return false;
}
+
+ @Override
+ public int getTimeout() {
+ return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT)));
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
new file mode 100644
index 0000000000..b2812d9bfb
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.mockito.InjectMocks;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+
+@RunWith(JUnit4.class)
+public class AbstractCDSProcessingBBUtilsTest {
+ @InjectMocks
+ private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils = new AbstractCDSProcessingBBUtils();
+ @InjectMocks
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ @Test
+ public void preProcessRequestTest() throws Exception {
+ String requestObject = "{\"config-assign-request\":{\"resolution-key\":\"resolutionKey\", \"config-assign-properties\":{\"service-instance-id\":\"serviceInstanceId\", \"vnf-id\":\"vnfId\", \"vnf-name\":\"vnfName\", \"service-model-uuid\":\"serviceModelUuid\", \"vnf-customization-uuid\":\"vnfCustomizationUuid\",\"Instance1\":\"Instance1Value\",\"Instance2\":\"Instance2Value\",\"Param3\":\"Param3Value\"}}}";
+ String blueprintName = "blueprintName";
+ String blueprintVersion = "blueprintVersion";
+ String actionName = "actionName";
+ String mode = "mode";
+ String requestId = "123456";
+ String originatorId = "originatorId";
+ String subRequestId = UUID.randomUUID().toString();
+
+ abstractCDSPropertiesBean.setActionName(actionName);
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setMode(mode);
+ abstractCDSPropertiesBean.setOriginatorId(originatorId);
+ abstractCDSPropertiesBean.setRequestId(requestId);
+ abstractCDSPropertiesBean.setRequestObject(requestObject);
+ abstractCDSPropertiesBean.setSubRequestId(subRequestId);
+
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
+
+ abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);
+ assertTrue(true);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
new file mode 100644
index 0000000000..c294124e69
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
@@ -0,0 +1,70 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignPropertiesForPnfTest {
+ ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String serviceInstanceId;
+ private String pnfId;
+ private String pnfName;
+ private String serviceModelUuid;
+ private String pnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForPnfTest() {
+ userParam.put("Instance1", "instance1value");
+ userParam.put("Instance2", "instance2value");
+ configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configAssignPropertiesForPnf.setPnfId("pnf-id");
+ configAssignPropertiesForPnf.setPnfName("pnf-name");
+ configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForPnf.setUserParam("Instance1", "instance1value");
+ configAssignPropertiesForPnf.setUserParam("Instance2", "instance2value");
+
+ assertNotNull(configAssignPropertiesForPnf.getPnfCustomizationUuid());
+ assertNotNull(configAssignPropertiesForPnf.getPnfId());
+ assertNotNull(configAssignPropertiesForPnf.getPnfName());
+ assertNotNull(configAssignPropertiesForPnf.getServiceInstanceId());
+ assertNotNull(configAssignPropertiesForPnf.getServiceModelUuid());
+ assertNotNull(configAssignPropertiesForPnf.getUserParam());
+
+ assertEquals("service-instance-id", configAssignPropertiesForPnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configAssignPropertiesForPnf.getServiceModelUuid());
+ assertEquals("pnf-customization-uuid", configAssignPropertiesForPnf.getPnfCustomizationUuid());
+ assertEquals("pnf-id", configAssignPropertiesForPnf.getPnfId());
+ assertEquals("pnf-name", configAssignPropertiesForPnf.getPnfName());
+ assertEquals(userParam, configAssignPropertiesForPnf.getUserParam());
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configAssignPropertiesForPnf.toString());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
new file mode 100644
index 0000000000..8b732af6d0
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
@@ -0,0 +1,68 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignPropertiesForVnfTest {
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String serviceInstanceId;
+ private String vnfId;
+ private String vnfName;
+ private String serviceModelUuid;
+ private String vnfCustomizationUuid;
+
+ @Test
+ public final void testConfigAssignPropertiesForVnfTest() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configAssignPropertiesForVnf.setVnfId("vnf-id");
+ configAssignPropertiesForVnf.setVnfName("vnf-name");
+ configAssignPropertiesForVnf.setUserParam("Instance1", "instance1value");
+
+ assertNotNull(configAssignPropertiesForVnf.getServiceInstanceId());
+ assertNotNull(configAssignPropertiesForVnf.getServiceModelUuid());
+ assertNotNull(configAssignPropertiesForVnf.getVnfCustomizationUuid());
+ assertNotNull(configAssignPropertiesForVnf.getVnfId());
+ assertNotNull(configAssignPropertiesForVnf.getVnfName());
+ assertNotNull(configAssignPropertiesForVnf.getUserParam());
+
+ assertEquals("service-instance-id", configAssignPropertiesForVnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configAssignPropertiesForVnf.getServiceModelUuid());
+ assertEquals("vnf-customization-uuid", configAssignPropertiesForVnf.getVnfCustomizationUuid());
+ assertEquals("vnf-id", configAssignPropertiesForVnf.getVnfId());
+ assertEquals("vnf-name", configAssignPropertiesForVnf.getVnfName());
+ assertEquals(userParam, configAssignPropertiesForVnf.getUserParam());
+
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configAssignPropertiesForVnf.toString());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
new file mode 100644
index 0000000000..e4f062ad05
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
@@ -0,0 +1,48 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignRequestPnfTest {
+ ConfigAssignRequestPnf configAssignRequestPnf = new ConfigAssignRequestPnf();
+ ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String resolutionKey;
+
+ @Test
+ public final void testConfigAssignRequestPnfTest() {
+ configAssignRequestPnf.setResolutionKey("resolution-key");
+ configAssignRequestPnf.setConfigAssignPropertiesForPnf(configAssignPropertiesForPnf);
+ assertNotNull(configAssignRequestPnf.getResolutionKey());
+ assertNotNull(configAssignRequestPnf.getConfigAssignPropertiesForPnf());
+
+ assertEquals("resolution-key", configAssignRequestPnf.getResolutionKey());
+ assertEquals(configAssignPropertiesForPnf, configAssignRequestPnf.getConfigAssignPropertiesForPnf());
+ }
+
+ @Test
+ public void testtoString() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configAssignPropertiesForPnf.setPnfId("pnf-id");
+ configAssignPropertiesForPnf.setPnfName("pnf-name");
+ configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForPnf.setUserParam("user_params", userParam);
+ configAssignRequestPnf.setConfigAssignPropertiesForPnf(configAssignPropertiesForPnf);
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configAssignRequestPnf.toString());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
new file mode 100644
index 0000000000..ad3af47453
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
@@ -0,0 +1,51 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignRequestVnfTest {
+ ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ private String resolutionKey;
+
+ @Test
+ public final void testConfigAssignRequestVnf() {
+ configAssignRequestVnf.setResolutionKey("resolution-key");
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+ assertNotNull(configAssignRequestVnf.getResolutionKey());
+ assertNotNull(configAssignRequestVnf.getConfigAssignPropertiesForVnf());
+
+ assertEquals("resolution-key", configAssignRequestVnf.getResolutionKey());
+ assertEquals(configAssignPropertiesForVnf, configAssignRequestVnf.getConfigAssignPropertiesForVnf());
+
+ }
+
+ @Test
+ public void testtoString() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForVnf.setUserParam("user_params", userParam);
+ configAssignPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configAssignPropertiesForVnf.setVnfId("vnf-id");
+ configAssignPropertiesForVnf.setVnfName("vnf-name");
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configAssignRequestVnf.toString());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
new file mode 100644
index 0000000000..1d771c86d5
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
@@ -0,0 +1,50 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployPropertiesForPnfTest {
+ ConfigDeployPropertiesForPnf configDeployPropertiesForPnf = new ConfigDeployPropertiesForPnf();
+ private String serviceInstanceId;
+ private String pnfId;
+ private String pnfName;
+ private String serviceModelUuid;
+ private String pnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForPnfTest() {
+ configDeployPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configDeployPropertiesForPnf.setPnfId("pnf-id");
+ configDeployPropertiesForPnf.setPnfName("pnf-name");
+ assertNotNull(configDeployPropertiesForPnf.getServiceInstanceId());
+ assertNotNull(configDeployPropertiesForPnf.getServiceModelUuid());
+ assertNotNull(configDeployPropertiesForPnf.getPnfCustomizationUuid());
+ assertNotNull(configDeployPropertiesForPnf.getPnfId());
+ assertNotNull(configDeployPropertiesForPnf.getPnfName());
+
+ assertEquals("service-instance-id", configDeployPropertiesForPnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configDeployPropertiesForPnf.getServiceModelUuid());
+ assertEquals("pnf-customization-uuid", configDeployPropertiesForPnf.getPnfCustomizationUuid());
+ assertEquals("pnf-id", configDeployPropertiesForPnf.getPnfId());
+ assertEquals("pnf-name", configDeployPropertiesForPnf.getPnfName());
+
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configDeployPropertiesForPnf.toString());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
new file mode 100644
index 0000000000..47c59b93e9
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
@@ -0,0 +1,49 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployPropertiesForVnfTest {
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+ private String serviceInstanceId;
+ private String vnfId;
+ private String vnfName;
+ private String serviceModelUuid;
+ private String vnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForVnf() {
+ configDeployPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configDeployPropertiesForVnf.setVnfId("vnf-id");
+ configDeployPropertiesForVnf.setVnfName("vnf-name");
+ assertNotNull(configDeployPropertiesForVnf.getServiceInstanceId());
+ assertNotNull(configDeployPropertiesForVnf.getServiceModelUuid());
+ assertNotNull(configDeployPropertiesForVnf.getVnfCustomizationUuid());
+ assertNotNull(configDeployPropertiesForVnf.getVnfId());
+ assertNotNull(configDeployPropertiesForVnf.getVnfName());
+
+ assertEquals("service-instance-id", configDeployPropertiesForVnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configDeployPropertiesForVnf.getServiceModelUuid());
+ assertEquals("vnf-customization-uuid", configDeployPropertiesForVnf.getVnfCustomizationUuid());
+ assertEquals("vnf-id", configDeployPropertiesForVnf.getVnfId());
+ assertEquals("vnf-name", configDeployPropertiesForVnf.getVnfName());
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configDeployPropertiesForVnf.toString());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
new file mode 100644
index 0000000000..df41bf23b8
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
@@ -0,0 +1,41 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployRequestPnfTest {
+ ConfigDeployRequestPnf configDeployRequestPnf = new ConfigDeployRequestPnf();
+ private String resolutionKey;
+ ConfigDeployPropertiesForPnf configDeployPropertiesForPnf = new ConfigDeployPropertiesForPnf();
+
+ @Test
+ public final void testConfigDeployRequestVnf() {
+ configDeployRequestPnf.setResolutionKey("resolution-key");
+ configDeployRequestPnf.setConfigDeployPropertiesForPnf(configDeployPropertiesForPnf);
+ assertNotNull(configDeployRequestPnf.getResolutionKey());
+ assertNotNull(configDeployRequestPnf.getConfigDeployPropertiesForPnf());
+ assertEquals("resolution-key", configDeployRequestPnf.getResolutionKey());
+ assertEquals(configDeployPropertiesForPnf, configDeployRequestPnf.getConfigDeployPropertiesForPnf());
+ }
+
+ @Test
+ public void testtoString() {
+ configDeployPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configDeployPropertiesForPnf.setPnfId("pnf-id");
+ configDeployPropertiesForPnf.setPnfName("pnf-name");
+ configDeployRequestPnf.setConfigDeployPropertiesForPnf(configDeployPropertiesForPnf);
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configDeployRequestPnf.toString());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
new file mode 100644
index 0000000000..f771710f8b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
@@ -0,0 +1,42 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployRequestVnfTest {
+
+ ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
+ private String resolutionKey;
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+
+ @Test
+ public final void testConfigDeployRequestVnf() {
+ configDeployRequestVnf.setResolutionKey("resolution-key");
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+ assertNotNull(configDeployRequestVnf.getResolutionKey());
+ assertNotNull(configDeployRequestVnf.getConfigDeployPropertiesForVnf());
+ assertEquals("resolution-key", configDeployRequestVnf.getResolutionKey());
+ assertEquals(configDeployPropertiesForVnf, configDeployRequestVnf.getConfigDeployPropertiesForVnf());
+ }
+
+ @Test
+ public void testtoString() {
+ configDeployPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configDeployPropertiesForVnf.setVnfId("vnf-id");
+ configDeployPropertiesForVnf.setVnfName("vnf-name");
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configDeployRequestVnf.toString());
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn
new file mode 100644
index 0000000000..4fcf13d98d
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1l7m222" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.1">
+ <bpmn:process id="AbstractCDSProcessingBB" name="Abstract CDS Processing BB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_02v5z4h</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_02v5z4h" sourceRef="StartEvent_1" targetRef="Task_06n9c9v" />
+ <bpmn:sequenceFlow id="SequenceFlow_0gksy4i" sourceRef="Task_06n9c9v" targetRef="Task_0kjfr5o" />
+ <bpmn:sequenceFlow id="SequenceFlow_161g9uz" sourceRef="Task_0kjfr5o" targetRef="EndEvent_1h3epjc" />
+ <bpmn:endEvent id="EndEvent_1h3epjc">
+ <bpmn:incoming>SequenceFlow_161g9uz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="Task_06n9c9v" name="Get Required data to call CDS Client" camunda:expression="${AbstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution)}">
+ <bpmn:incoming>SequenceFlow_02v5z4h</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0gksy4i</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_0kjfr5o" name="CDS&#10;(Call SelfServiceAPI)&#10;" camunda:expression="${AbstractCDSProcessingBBUtils.sendRequestToCDSClient(execution)}">
+ <bpmn:incoming>SequenceFlow_0gksy4i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_161g9uz</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AbstractCDSProcessingBB">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="124" y="264" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_02v5z4h_di" bpmnElement="SequenceFlow_02v5z4h">
+ <di:waypoint x="160" y="282" />
+ <di:waypoint x="223" y="282" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gksy4i_di" bpmnElement="SequenceFlow_0gksy4i">
+ <di:waypoint x="323" y="282" />
+ <di:waypoint x="385" y="282" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_161g9uz_di" bpmnElement="SequenceFlow_161g9uz">
+ <di:waypoint x="485" y="282" />
+ <di:waypoint x="578" y="282" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1h3epjc_di" bpmnElement="EndEvent_1h3epjc">
+ <dc:Bounds x="578" y="264" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_16es7z5_di" bpmnElement="Task_06n9c9v">
+ <dc:Bounds x="223" y="242" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_18soa9e_di" bpmnElement="Task_0kjfr5o">
+ <dc:Bounds x="385" y="242" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
new file mode 100644
index 0000000000..9892fbdd91
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1ahlzqg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.1">
+ <bpmn:process id="ConfigAssignVnfBB" name="ConfigAssignVnfBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0gmfit3</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0gmfit3" sourceRef="StartEvent_1" targetRef="Task_0bhf6tp" />
+ <bpmn:endEvent id="EndEvent_0lgvk82">
+ <bpmn:incoming>SequenceFlow_1mkhog2</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1mkhog2" sourceRef="Task_1hs1mn0" targetRef="EndEvent_0lgvk82" />
+ <bpmn:callActivity id="CallActivity_1gfzi2g" name="Abstract CDS&#10;(CDS Call)&#10;" calledElement="AbstractCDSProcessingBB">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:in source="executionObject" target="executionObject" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_05qembo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cvsnuu</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:serviceTask id="Task_1hs1mn0" name="Update AAI&#10;(VNF)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusConfigAssignedVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_07tqu82</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1mkhog2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05qembo" sourceRef="Task_0bhf6tp" targetRef="CallActivity_1gfzi2g" />
+ <bpmn:serviceTask id="Task_0bhf6tp" name="PreProcess Abstract CDS Processing" camunda:expression="${ConfigAssignVnf.PreProcessAbstractCDSProcessing(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0gmfit3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05qembo</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_13q340y" default="SequenceFlow_15gxql1">
+ <bpmn:incoming>SequenceFlow_0cvsnuu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07tqu82</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_15gxql1</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0cvsnuu" sourceRef="CallActivity_1gfzi2g" targetRef="ExclusiveGateway_13q340y" />
+ <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0mnaj50">
+ <bpmn:incoming>SequenceFlow_15gxql1</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1s1hqgm" errorRef="Error_0aovtfv" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_15gxql1" sourceRef="ExclusiveGateway_13q340y" targetRef="EndEvent_0mnaj50" />
+ </bpmn:process>
+ <bpmn:error id="Error_0aovtfv" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfigAssignVnfBB">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="507" y="187" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gmfit3_di" bpmnElement="SequenceFlow_0gmfit3">
+ <di:waypoint x="543" y="205" />
+ <di:waypoint x="614" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
+ <dc:Bounds x="1307" y="187" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mkhog2_di" bpmnElement="SequenceFlow_1mkhog2">
+ <di:waypoint x="1218" y="205" />
+ <di:waypoint x="1307" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1gfzi2g_di" bpmnElement="CallActivity_1gfzi2g">
+ <dc:Bounds x="788" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
+ <dc:Bounds x="1118" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
+ <di:waypoint x="714" y="205" />
+ <di:waypoint x="788" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_01mv1si_di" bpmnElement="Task_0bhf6tp">
+ <dc:Bounds x="614" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_13q340y_di" bpmnElement="ExclusiveGateway_13q340y" isMarkerVisible="true">
+ <dc:Bounds x="978" y="180" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cvsnuu_di" bpmnElement="SequenceFlow_0cvsnuu">
+ <di:waypoint x="888" y="205" />
+ <di:waypoint x="978" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07tqu82_di" bpmnElement="SequenceFlow_07tqu82">
+ <di:waypoint x="1028" y="205" />
+ <di:waypoint x="1118" y="205" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1053" y="187" width="41" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0mnaj50_di" bpmnElement="EndEvent_0mnaj50">
+ <dc:Bounds x="985" y="327" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15gxql1_di" bpmnElement="SequenceFlow_15gxql1">
+ <di:waypoint x="1003" y="230" />
+ <di:waypoint x="1003" y="327" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
new file mode 100644
index 0000000000..9b98620f78
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+ <bpmn:process id="EtsiVnfInstantiateBB" name="&#10;EtsiVnfInstantiateBB" isExecutable="true">
+ <bpmn:serviceTask id="ServiceTask_02e82t2" name="Create &#10;CreateVnfRequest&#10;" camunda:expression="${VnfmAdapterCreateVnfTask.buildCreateVnfRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_016sgof</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0f0vsnv</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:startEvent id="StartEvent_0ru3x55">
+ <bpmn:outgoing>SequenceFlow_016sgof</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="ServiceTask_02e82t2" />
+ <bpmn:endEvent id="EndEvent_001k15i">
+ <bpmn:incoming>SequenceFlow_0cik89t</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0f0vsnv" sourceRef="ServiceTask_02e82t2" targetRef="ServiceTask_06ao4xu" />
+ <bpmn:serviceTask id="ServiceTask_06ao4xu" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${VnfmAdapterCreateVnfTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0f0vsnv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cik89t</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cik89t" sourceRef="ServiceTask_06ao4xu" targetRef="EndEvent_001k15i" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfInstantiateBB">
+ <bpmndi:BPMNShape id="ServiceTask_02e82t1_di" bpmnElement="ServiceTask_02e82t2">
+ <dc:Bounds x="353" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0ru3x55_di" bpmnElement="StartEvent_0ru3x55">
+ <dc:Bounds x="232" y="249" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_016sgof_di" bpmnElement="SequenceFlow_016sgof">
+ <di:waypoint x="268" y="267" />
+ <di:waypoint x="353" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i">
+ <dc:Bounds x="703" y="249" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0f0vsnv_di" bpmnElement="SequenceFlow_0f0vsnv">
+ <di:waypoint x="453" y="267" />
+ <di:waypoint x="522" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_06ao4xu_di" bpmnElement="ServiceTask_06ao4xu">
+ <dc:Bounds x="522" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cik89t_di" bpmnElement="SequenceFlow_0cik89t">
+ <di:waypoint x="622" y="267" />
+ <di:waypoint x="703" y="267" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index 0243ce8ae6..ce1cdd5068 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -1,150 +1,160 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>so-bpmn-tasks</artifactId>
- <packaging>jar</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>default-test</id>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <includes>
- <include>**/UnitTestSuite.java</include>
- </includes>
- </configuration>
- </execution>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <includes>
- <include>**/IntegrationTestSuite.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.3.1</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${project.basedir}/src/main/resources/naming-service/swagger.json</inputSpec>
- <apiPackage>org.onap.namingservice.api</apiPackage>
- <modelPackage>org.onap.namingservice.model</modelPackage>
- <invokerPackage>org.onap.namingservice.invoker</invokerPackage>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <inputSpec>${project.basedir}/src/main/resources/swagger.json</inputSpec>
- <language>java</language>
- <configOptions>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <serializableModel>true</serializableModel>
- </configOptions>
- <output>${project.build.directory}/generated-sources</output>
- <generateApis>false</generateApis>
- <library>jersey2</library>
- <generateSupportingFiles>false</generateSupportingFiles>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <!-- Import dependency management from Spring Boot -->
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${springboot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.camunda.bpm.springboot</groupId>
- <artifactId>camunda-bpm-spring-boot-starter</artifactId>
- <version>${camunda.springboot.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-contract-wiremock</artifactId>
- <version>1.2.4.RELEASE</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.camunda.bpm.extension.mockito</groupId>
- <artifactId>camunda-bpm-mockito</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>MSOCommonBPMN</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>so-bpmn-infrastructure-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapter-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>generic-resource-api-client</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>ch.vorburger.mariaDB4j</groupId>
- <artifactId>mariaDB4j</artifactId>
- <version>2.2.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- </dependencies>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>bpmn</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>so-bpmn-tasks</artifactId>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/UnitTestSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/IntegrationTestSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${project.basedir}/src/main/resources/naming-service/swagger.json</inputSpec>
+ <apiPackage>org.onap.namingservice.api</apiPackage>
+ <modelPackage>org.onap.namingservice.model</modelPackage>
+ <invokerPackage>org.onap.namingservice.invoker</invokerPackage>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <inputSpec>${project.basedir}/src/main/resources/swagger.json</inputSpec>
+ <language>java</language>
+ <configOptions>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <serializableModel>true</serializableModel>
+ </configOptions>
+ <output>${project.build.directory}/generated-sources</output>
+ <generateApis>false</generateApis>
+ <library>jersey2</library>
+ <generateSupportingFiles>false</generateSupportingFiles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- Import dependency management from Spring Boot -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter</artifactId>
+ <version>${camunda.springboot.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-contract-wiremock</artifactId>
+ <version>1.2.4.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.bpm.extension.mockito</groupId>
+ <artifactId>camunda-bpm-mockito</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCommonBPMN</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-bpmn-infrastructure-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-adapter-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdnc.northbound</groupId>
+ <artifactId>generic-resource-api-client</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
</project>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index a618606d41..bc6770cc81 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -530,4 +530,12 @@ public class AAIUpdateTasks {
}
}
+ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
new file mode 100644
index 0000000000..d03173d0ac
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -0,0 +1,40 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class Constants {
+
+ public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
+ public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
+
+ public static final String DOT = ".";
+ public static final String UNDERSCORE = "_";
+ public static final String SPACE = "\\s+";
+
+ public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
+ public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
+
+
+ private Constants() {}
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
new file mode 100644
index 0000000000..23ddb6f3f7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
@@ -0,0 +1,150 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_REQUEST_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DOT;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.SPACE;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.UNDERSCORE;
+import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.Tenant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.common.base.Optional;
+
+/**
+ * This class is executed from EtsiVnfInstantiateBB building block and it sends the create request
+ * to the VNFM adapter
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Component
+public class VnfmAdapterCreateVnfTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterCreateVnfTask.class);
+
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionUtil;
+ private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+
+ @Autowired
+ public VnfmAdapterCreateVnfTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
+ final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) {
+ this.exceptionUtil = exceptionUtil;
+ this.extractPojosForBB = extractPojosForBB;
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ }
+
+ /**
+ * Create {@link CreateVnfRequest} object with required fields and store it in
+ * {@link org.camunda.bpm.engine.delegate.DelegateExecution}
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void buildCreateVnfRequest(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing buildCreateVnfRequest ...");
+
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ final CloudRegion cloudRegion = buildingBlock.getCloudRegion();
+
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ final ModelInfoGenericVnf modelInfoGenericVnf = vnf.getModelInfoGenericVnf();
+
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+
+ createVnfRequest.setName(getName(vnf.getVnfName(), modelInfoGenericVnf.getModelInstanceName()));
+ createVnfRequest.setTenant(getTenant(cloudRegion));
+
+ LOGGER.info("CreateVnfRequest : {}", createVnfRequest);
+
+ execution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, createVnfRequest);
+
+ LOGGER.debug("Finished executing buildCreateVnfRequest ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to execute buildCreateVnfRequest", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1200, exception);
+ }
+ }
+
+ /**
+ * Invoke VNFM adapter to create and instantiate VNF
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void invokeVnfmAdapter(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing invokeVnfmAdapter ...");
+ final CreateVnfRequest request = execution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+
+ final Optional<CreateVnfResponse> response =
+ vnfmAdapterServiceProvider.invokeCreateInstantiationRequest(vnf.getVnfId(), request);
+
+ if (!response.isPresent()) {
+ final String errorMessage = "Unexpected error while processing create and instantiation request";
+ LOGGER.error(errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1201, errorMessage);
+ }
+
+ final CreateVnfResponse vnfResponse = response.get();
+
+ LOGGER.debug("Vnf instantiation response: {}", vnfResponse);
+ execution.setVariable(CREATE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
+
+ LOGGER.debug("Finished executing invokeVnfmAdapter ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke create and instantiation request", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1202, exception);
+ }
+ }
+
+ private Tenant getTenant(final CloudRegion cloudRegion) {
+ final Tenant tenant = new Tenant();
+ tenant.setCloudOwner(cloudRegion.getCloudOwner());
+ tenant.setRegionName(cloudRegion.getLcpCloudRegionId());
+ tenant.setTenantId(cloudRegion.getTenantId());
+ return tenant;
+ }
+
+ private String getName(final String vnfName, final String modelInstanceName) {
+ if (modelInstanceName != null) {
+ return (vnfName + DOT + modelInstanceName).replaceAll(SPACE, UNDERSCORE);
+ }
+ return vnfName != null ? vnfName.replaceAll(SPACE, UNDERSCORE) : vnfName;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
new file mode 100644
index 0000000000..1046b6bf26
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * Provides {@link org.onap.so.rest.service.VnfmAdapterServiceProvider} configuration for
+ * {@link VnfmAdapterCreateVnfTask}
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Configuration
+public class VnfmAdapterCreateVnfTaskConfiguration {
+
+ @Bean
+ public HttpRestServiceProvider databaseHttpRestServiceProvider(
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
+ @Autowired final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(etsiVnfmAdapter.getAuth()));
+ }
+
+ private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
+ final HttpHeadersProvider httpHeadersProvider) {
+ return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
new file mode 100644
index 0000000000..02303ef09d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
@@ -0,0 +1,38 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * Provide a service which interacts with VNFM adapter for instantiating, monitoring VNF
+ *
+ * @author waqas.ikram@est.tech
+ */
+public interface VnfmAdapterServiceProvider {
+
+ Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request);
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
new file mode 100644
index 0000000000..afdcccfd36
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -0,0 +1,89 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import com.google.common.base.Optional;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@Service
+public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+
+ private final VnfmAdapterUrlProvider urlProvider;
+ private final HttpRestServiceProvider httpServiceProvider;
+
+ @Autowired
+ public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider,
+ final HttpRestServiceProvider httpServiceProvider) {
+ this.urlProvider = urlProvider;
+ this.httpServiceProvider = httpServiceProvider;
+ }
+
+ @Override
+ public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId,
+ final CreateVnfRequest request) {
+ try {
+ final String url = urlProvider.getCreateInstantiateUrl(vnfId);
+
+ final ResponseEntity<CreateVnfResponse> response =
+ httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+
+ final CreateVnfResponse createVnfResponse = response.getBody();
+
+ if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
+ LOGGER.error("Received invalid instantiation response: {}", response);
+ return Optional.absent();
+ }
+
+ return Optional.of(createVnfResponse);
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException);
+ return Optional.absent();
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
new file mode 100644
index 0000000000..03ee0712e7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import java.net.URI;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.util.UriComponentsBuilder;
+
+/**
+ *
+ * Provides VNFM adapter {@link java.net.URL}
+ *
+ * @author waqas.ikram@est.tech
+ *
+ */
+@Service
+public class VnfmAdapterUrlProvider {
+
+ private final URI baseUri;
+
+ @Autowired
+ public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri();
+ }
+
+ /**
+ * Get VNFM create and instantiate URL
+ *
+ * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in
+ * AAI.
+ * @return VNFM create and instantiate URL
+ */
+ public String getCreateInstantiateUrl(final String vnfId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
new file mode 100644
index 0000000000..c9b1ad1ce1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_AUTH;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_URL;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Provides VNFM adapter {@link java.net.URI} and basic authorization values
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Configuration
+@ConfigurationProperties(prefix = "so.vnfm.adapter")
+public class VnfmBasicHttpConfigProvider {
+
+ private String url = VNFM_ADAPTER_DEFAULT_URL;
+
+ private String auth = VNFM_ADAPTER_DEFAULT_AUTH;
+
+ /**
+ * @return the url
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * @param url the url to set
+ */
+ public void setUrl(final String url) {
+ this.url = url;
+ }
+
+ /**
+ * @return the auth
+ */
+ public String getAuth() {
+ return auth;
+ }
+
+ /**
+ * @param auth the auth to set
+ */
+ public void setAuth(final String auth) {
+ this.auth = auth;
+ }
+
+ @Override
+ public String toString() {
+ return "EtsiVnfmAdapter [url=" + url + ", auth=" + auth + "]";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
new file mode 100644
index 0000000000..242135adb8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf;
+import org.onap.so.client.cds.beans.ConfigAssignRequestVnf;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * Get vnf related data and config assign
+ *
+ */
+@Component
+public class ConfigAssignVnf {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConfigAssignVnf.class);
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String ACTION_NAME = "config-assign";
+ private static final String MODE = "sync";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ /**
+ * Getting the vnf data, blueprint name, blueprint version etc and setting them
+ * in execution object and calling the subprocess.
+ *
+ * @param execution
+ */
+ public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
+ logger.info("Start preProcessAbstractCDSProcessing ");
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ Map<String, Object> userParams = execution.getGeneralBuildingBlock().getRequestContext().getUserParams();
+
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ configAssignPropertiesForVnf
+ .setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ configAssignPropertiesForVnf
+ .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configAssignPropertiesForVnf.setVnfId(vnf.getVnfId());
+ configAssignPropertiesForVnf.setVnfName(vnf.getVnfName());
+
+ for (Map.Entry<String, Object> entry : userParams.entrySet()) {
+ configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue());
+ }
+
+ ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
+ configAssignRequestVnf.setResolutionKey(vnf.getVnfName());
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+
+ String blueprintName = vnf.getBlueprintName();
+ String blueprintVersion = vnf.getBlueprintVersion();
+
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setRequestObject(configAssignRequestVnf.toString());
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(ACTION_NAME);
+ abstractCDSPropertiesBean.setMode(MODE);
+ execution.setVariable("executionObject", abstractCDSPropertiesBean);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
new file mode 100644
index 0000000000..5451d4442f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmBasicHttpConfigProvider;
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class TestConstants {
+
+ public static final String DUMMY_GENERIC_VND_ID = "5956a99d-9736-11e8-8caf-022ac9304eeb";
+ public static final String DUMMY_BASIC_AUTH = "Basic 123abc";
+ public static final String DUMMY_URL = "http://localhost:30406/so/vnfm-adapter/v1/";
+ public static final String EXPECTED_URL = DUMMY_URL + "vnfs/" + DUMMY_GENERIC_VND_ID;
+
+ public static VnfmBasicHttpConfigProvider getVnfmBasicHttpConfigProvider() {
+ return getVnfmBasicHttpConfigProvider(DUMMY_URL, DUMMY_BASIC_AUTH);
+ }
+
+ public static VnfmBasicHttpConfigProvider getVnfmBasicHttpConfigProvider(final String url, final String auth) {
+ final VnfmBasicHttpConfigProvider vnfmBasicHttpConfigProvider = new VnfmBasicHttpConfigProvider();
+ vnfmBasicHttpConfigProvider.setUrl(url);
+ vnfmBasicHttpConfigProvider.setAuth(auth);
+ return vnfmBasicHttpConfigProvider;
+ }
+
+ private TestConstants() {}
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
new file mode 100644
index 0000000000..5aaebea76e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterCreateVnfTaskConfiguration;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VnfmAdapterCreateVnfTaskConfigurationTest {
+
+ @Mock
+ private RestTemplate restTemplate;
+
+ @Test
+ public void test_databaseHttpRestServiceProvider_httpRestServiceProviderNotNull() {
+ final VnfmAdapterCreateVnfTaskConfiguration objUnderTest = new VnfmAdapterCreateVnfTaskConfiguration();
+
+ final HttpRestServiceProvider actual =
+ objUnderTest.databaseHttpRestServiceProvider(restTemplate, getVnfmBasicHttpConfigProvider());
+ assertNotNull(actual);
+
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
new file mode 100644
index 0000000000..ddfc08e08f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
@@ -0,0 +1,248 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_REQUEST_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterCreateVnfTask;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterServiceProvider;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.Tenant;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class VnfmAdapterCreateVnfTaskTest extends BaseTaskTest {
+
+ private static final String MODEL_INSTANCE_NAME = "MODEL_INSTANCE_NAME";
+
+ private static final String CLOUD_OWNER = "CLOUD_OWNER";
+
+ private static final String LCP_CLOUD_REGIONID = "RegionOnce";
+
+ private static final String TENANT_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_NAME = "VNF_NAME";
+
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Test
+ public void testBuildCreateVnfRequest_withValidValues_storesRequestInExecution() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ objUnderTest.buildCreateVnfRequest(stubbedxecution);
+
+ final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+ assertNotNull(actual);
+ assertEquals(VNF_NAME + "." + MODEL_INSTANCE_NAME, actual.getName());
+
+ final Tenant actualTenant = actual.getTenant();
+ assertEquals(CLOUD_OWNER, actualTenant.getCloudOwner());
+ assertEquals(LCP_CLOUD_REGIONID, actualTenant.getRegionName());
+ assertEquals(TENANT_ID, actualTenant.getTenantId());
+
+ }
+
+ @Test
+ public void testBuildCreateVnfRequest_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+
+ objUnderTest.buildCreateVnfRequest(stubbedxecution);
+
+ final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+
+ assertNull(actual);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1200),
+ any(Exception.class));
+
+ }
+
+ @Test
+ public void testInvokeVnfmAdapter_validValues_storesResponseInExecution() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
+ .thenReturn(getCreateVnfResponse());
+
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+
+ assertNotNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ }
+
+ @Test
+ public void testInvokeVnfmAdapter_invalidValues_storesResponseInExecution() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
+ .thenReturn(Optional.absent());
+
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
+ any(Exception.class));
+ }
+
+
+ @Test
+ public void testInvokeVnfmAdapter_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
+ any(Exception.class));
+
+ }
+
+ private Optional<CreateVnfResponse> getCreateVnfResponse() {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(JOB_ID);
+ return Optional.of(response);
+ }
+
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf());
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+
+ private ModelInfoGenericVnf getModelInfoGenericVnf() {
+ final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME);
+ return modelInfoGenericVnf;
+ }
+
+ private VnfmAdapterCreateVnfTask getEtsiVnfInstantiateTask() {
+ return new VnfmAdapterCreateVnfTask(exceptionUtil, extractPojosForBB, mockedVnfmAdapterServiceProvider);
+ }
+
+ private class StubbedBuildingBlockExecution implements BuildingBlockExecution {
+
+ private final Map<String, Serializable> execution = new HashMap<>();
+ private final GeneralBuildingBlock generalBuildingBlock;
+
+ StubbedBuildingBlockExecution() {
+ generalBuildingBlock = getGeneralBuildingBlockValue();
+ }
+
+ @Override
+ public GeneralBuildingBlock getGeneralBuildingBlock() {
+ return generalBuildingBlock;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getVariable(final String key) {
+ return (T) execution.get(key);
+ }
+
+ @Override
+ public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
+ return null;
+ }
+
+ @Override
+ public void setVariable(final String key, final Serializable value) {
+ execution.put(key, value);
+ }
+
+ @Override
+ public Map<ResourceKey, String> getLookupMap() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public String getFlowToBeCalled() {
+ return null;
+ }
+
+ private GeneralBuildingBlock getGeneralBuildingBlockValue() {
+ final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock();
+ buildingBlock.setCloudRegion(getCloudRegion());
+ return buildingBlock;
+ }
+
+ private CloudRegion getCloudRegion() {
+ final CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner(CLOUD_OWNER);
+ cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGIONID);
+ cloudRegion.setTenantId(TENANT_ID);
+ return cloudRegion;
+ }
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
new file mode 100644
index 0000000000..0f443916c4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
@@ -0,0 +1,167 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
+
+import java.util.UUID;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterServiceProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterServiceProviderImpl;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterUrlProvider;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VnfmAdapterServiceProviderImplTest {
+
+ private static final String EMPTY_JOB_ID = "";
+
+ private static final CreateVnfRequest CREATE_VNF_REQUEST = new CreateVnfRequest();
+
+ private static final String DUMMY_JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private HttpRestServiceProvider mockedHttpServiceProvider;
+
+ @Mock
+ private ResponseEntity<CreateVnfResponse> mockedResponseEntity;
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBody_validResponse() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(DUMMY_JOB_ID);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertTrue(actual.isPresent());
+ assertEquals(actual.get(), response);
+
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.ACCEPTED);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusNotOkWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.UNAUTHORIZED);
+ }
+
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBodyWithInvalidJobId_noResponse() {
+ assertWithJobId(null);
+ assertWithJobId(EMPTY_JOB_ID);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderThrowException_httpRestServiceProviderNotNull() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenThrow(RestProcessingException.class);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+
+ }
+
+
+ private void assertWithJobId(final String jobId) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(jobId);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
+
+ private void assertWithStatuCode(final HttpStatus status) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(status);
+ when(mockedResponseEntity.hasBody()).thenReturn(false);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
+
+
+
+ private CreateVnfResponse getCreateVnfResponse(final String jobId) {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(jobId);
+ return response;
+ }
+
+
+ private VnfmAdapterUrlProvider getVnfmAdapterUrlProvider() {
+ return new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
new file mode 100644
index 0000000000..cb93adca69
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXPECTED_URL;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
+
+import org.junit.Test;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterUrlProvider;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class VnfmAdapterUrlProviderTest {
+
+
+ @Test
+ public void test_getCreateInstantiateUrl_returnValidCreationInstantiationRequest() {
+ final VnfmAdapterUrlProvider objUnderTest = new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+
+ final String actual = objUnderTest.getCreateInstantiateUrl(DUMMY_GENERIC_VND_ID);
+
+ assertEquals(EXPECTED_URL, actual);
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
new file mode 100644
index 0000000000..07983ccd50
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+public class ConfigAssignVnfTest extends BaseTaskTest {
+ @InjectMocks
+ private ConfigAssignVnf configAssignVnf = new ConfigAssignVnf();
+
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ serviceInstance = setServiceInstance();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+
+ @Test
+ public void preProcessAbstractCDSProcessingTest() throws Exception {
+
+ configAssignVnf.preProcessAbstractCDSProcessing(execution);
+
+ assertTrue(true);
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
index 14556f1211..34ad6ef758 100644
--- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
+++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
@@ -20,7 +20,10 @@
package org.onap.so.client;
+import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
@@ -30,11 +33,28 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
- @Bean
- public RestTemplate restTemplate() {
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
- return restTemplate;
- }
+ public static final String CONFIGURABLE_REST_TEMPLATE = "configurableRestTemplate";
+
+ @Autowired
+ private HttpComponentsClientConfiguration httpComponentsClientConfiguration;
+
+ @Bean
+ public RestTemplate restTemplate() {
+ final RestTemplate restTemplate = new RestTemplate();
+ restTemplate
+ .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
+ restTemplate.getInterceptors().add(new SpringClientFilter());
+ return restTemplate;
+ }
+
+ @Bean
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ public RestTemplate configurableRestTemplate() {
+ final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory =
+ httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory();
+ final RestTemplate restTemplate =
+ new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
+ restTemplate.getInterceptors().add(new SpringClientFilter());
+ return restTemplate;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
index 42a4b47aa2..59c64e0459 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 Bell Canada.
- * ================================================================================
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
-
package org.onap.so.client.cds;
import org.onap.so.client.RestProperties;
@@ -30,4 +25,6 @@ public interface CDSProperties extends RestProperties {
int getPort();
String getBasicAuth();
+
+ int getTimeout();
}
diff --git a/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java b/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java
new file mode 100644
index 0000000000..7606f3a8d3
--- /dev/null
+++ b/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.configuration.rest;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class BasicHttpHeadersProvider implements HttpHeadersProvider {
+
+ public static final String AUTHORIZATION_HEADER = "Authorization";
+
+ private final HttpHeaders headers = new HttpHeaders();
+
+ public BasicHttpHeadersProvider(final String authorization) {
+ headers.add(AUTHORIZATION_HEADER, authorization);
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ }
+
+ public BasicHttpHeadersProvider() {
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ }
+
+ @Override
+ public HttpHeaders getHttpHeaders() {
+ return headers;
+ }
+
+ @Override
+ public String toString() {
+ return "BasicHttpHeadersProvider [headers=" + headers + "]";
+ }
+
+}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpClientConnectionConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
index 1260e535a1..a5a4cb7d53 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpClientConnectionConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
@@ -1,29 +1,36 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.monitoring.configuration.rest;
+
+package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+/**
+ * This class is used configure the parameters needed for
+ * {@link org.apache.http.impl.client.CloseableHttpClient}
+ *
+ * @author waqas.ikram@est.tech
+ */
@Service
public class HttpClientConnectionConfiguration {
@@ -43,45 +50,38 @@ public class HttpClientConnectionConfiguration {
private int maxConnectionsPerRoute;
/**
- * @return the socketTimeOut
+ * @return the socket connection time out in milliseconds
*/
public int getSocketTimeOutInMiliSeconds() {
return (int) TimeUnit.SECONDS.toMillis(socketTimeOutInSeconds);
}
/**
- * @return the maxConnections
+ * @return the maximum total connection value.
*/
public int getMaxConnections() {
return maxConnections;
}
/**
- * @return the maxConnectionsPerRoute
+ * @return the maximum connection per route value.
*/
public int getMaxConnectionsPerRoute() {
return maxConnectionsPerRoute;
}
/**
- * @return the connectionTimeOut
+ * @return the connect time out value in milliseconds.
*/
public int getConnectionTimeOutInMilliSeconds() {
return (int) TimeUnit.SECONDS.toMillis(connectionTimeOutInSeconds);
}
/**
- * @return the timeToLive
+ * @return the connection time to live value in mintues.
*/
public int getTimeToLiveInMins() {
return (int) TimeUnit.SECONDS.toMinutes(timeToLiveInSeconds);
}
- @Override
- public String toString() {
- return "HttpClientConnectionConfiguration [connectionTimeOutInSeconds=" + connectionTimeOutInSeconds
- + ", socketTimeOutInSeconds=" + socketTimeOutInSeconds + ", timeToLiveInSeconds=" + timeToLiveInSeconds
- + ", maxConnections=" + maxConnections + ", maxConnectionsPerRoute=" + maxConnectionsPerRoute + "]";
- }
-
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/RestTemplateConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
index f8f0f687cf..e943aef159 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/RestTemplateConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
@@ -17,8 +17,8 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
-package org.onap.so.monitoring.configuration.rest;
+
+package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
@@ -27,35 +27,23 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.web.client.RestTemplate;
/**
- * @author waqas.ikram@ericsson.com
+ * Allow user to configure {@link org.apache.http.client.HttpClient}
+ *
+ * @author waqas.ikram@est.tech
*/
@Configuration
-public class RestTemplateConfiguration {
+public class HttpComponentsClientConfiguration {
- public static final String DATABASE_REST_TEMPLATE = "databaseRestTemplate";
-
- public static final String CAMUNDA_REST_TEMPLATE = "camundaRestTemplate";
+ private final HttpClientConnectionConfiguration clientConnectionConfiguration;
@Autowired
- private HttpClientConnectionConfiguration clientConnectionConfiguration;
-
- @Bean
- @Qualifier(CAMUNDA_REST_TEMPLATE)
- public RestTemplate camundaRestTemplate() {
- return new RestTemplate(httpComponentsClientHttpRequestFactory());
- }
-
- @Bean
- @Qualifier(DATABASE_REST_TEMPLATE)
- public RestTemplate dataBasecamundaRestTemplate() {
- return new RestTemplate(httpComponentsClientHttpRequestFactory());
+ public HttpComponentsClientConfiguration(final HttpClientConnectionConfiguration clientConnectionConfiguration) {
+ this.clientConnectionConfiguration = clientConnectionConfiguration;
}
@Bean
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java
index 4606c04e05..0cff7b4ba0 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProvider.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java
@@ -1,33 +1,35 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.monitoring.rest.service;
-import com.google.common.base.Optional;
+package org.onap.so.configuration.rest;
+
+import org.springframework.http.HttpHeaders;
/**
- * @author waqas.ikram@ericsson.com
+ * Providers {@link org.springframework.http.HttpHeaders} for HTTP requests
+ *
+ * @author waqas.ikram@est.tech
+ *
*/
-public interface HttpRestServiceProvider {
-
- public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz);
+public interface HttpHeadersProvider {
- public <T> Optional<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
+ HttpHeaders getHttpHeaders();
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
index cecef1945b..ed63a706a2 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
@@ -57,6 +57,7 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor {
}
private void processRequest(HttpRequest request, byte[] body) throws IOException {
+ setInvocationId();
setupHeaders(request);
setupMDC(request);
if (log.isDebugEnabled()) {
@@ -89,7 +90,6 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor {
MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString());
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- setInvocationId();
MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY,extractTargetEntity(clientRequest));
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/InvalidRestRequestException.java b/common/src/main/java/org/onap/so/rest/exceptions/InvalidRestRequestException.java
index 4d3c489fa9..2a9799315e 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/InvalidRestRequestException.java
+++ b/common/src/main/java/org/onap/so/rest/exceptions/InvalidRestRequestException.java
@@ -1,26 +1,27 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.monitoring.exception;
+
+package org.onap.so.rest.exceptions;
/**
- * @author waqas.ikram@ericsson.com
+ * @author waqas.ikram@est.tech
*
*/
public class InvalidRestRequestException extends RuntimeException {
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/RestProcessingException.java b/common/src/main/java/org/onap/so/rest/exceptions/RestProcessingException.java
index ab25854542..e8ce00c7e5 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/RestProcessingException.java
+++ b/common/src/main/java/org/onap/so/rest/exceptions/RestProcessingException.java
@@ -1,26 +1,26 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.monitoring.exception;
+package org.onap.so.rest.exceptions;
/**
- * @author waqas.ikram@ericsson.com
+ * @author waqas.ikram@est.tech
*
*/
public class RestProcessingException extends RuntimeException {
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
new file mode 100644
index 0000000000..43b2fb4292
--- /dev/null
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
@@ -0,0 +1,72 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.service;
+
+import org.springframework.http.ResponseEntity;
+
+import com.google.common.base.Optional;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public interface HttpRestServiceProvider {
+
+ /**
+ * Execute the HTTP GET to the given URI template
+ *
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the body of this entity.
+ */
+ public <T> Optional<T> get(final String url, final Class<T> clazz);
+
+ /**
+ * Execute the HTTP GET to the given URI template
+ *
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz);
+
+
+ /**
+ * Execute the HTTP POST to the given URI template
+ *
+ * @param object the entity (i.e. body) to write to the request
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the body of this entity.
+ */
+ public <T> Optional<T> post(final Object object, final String url, final Class<T> clazz);
+
+ /**
+ * Execute the HTTP POST to the given URI template
+ *
+ * @param object the entity (i.e. body) to write to the request
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
+
+
+}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
index 82a54c10a2..032df84a98 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProviderImpl.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
@@ -1,27 +1,33 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.monitoring.rest.service;
-import org.onap.so.monitoring.exception.InvalidRestRequestException;
-import org.onap.so.monitoring.exception.RestProcessingException;
+package org.onap.so.rest.service;
+
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -31,39 +37,54 @@ import org.springframework.web.client.RestTemplate;
import com.google.common.base.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
- * @author waqas.ikram@ericsson.com
+ * A Service to perform HTTP requests
+ *
+ * @author waqas.ikram@est.tech
*/
public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestServiceProviderImpl.class);
private final RestTemplate restTemplate;
+ private final HttpHeadersProvider httpHeadersProvider;
public HttpRestServiceProviderImpl(final RestTemplate restTemplate) {
this.restTemplate = restTemplate;
+ this.httpHeadersProvider = new BasicHttpHeadersProvider();
+ }
+
+ public HttpRestServiceProviderImpl(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) {
+ this.restTemplate = restTemplate;
+ this.httpHeadersProvider = httpHeadersProvider;
+ }
+
+ @Override
+ public <T> Optional<T> get(final String url, final Class<T> clazz) {
+ final ResponseEntity<T> response = getHttpResponse(url, clazz);
+ if (!response.getStatusCode().equals(HttpStatus.OK)) {
+ final String message =
+ "Unable to invoke HTTP GET using URL: " + url + ", Response Code: " + response.getStatusCode();
+ LOGGER.error(message);
+ return Optional.absent();
+ }
+
+ if (response.hasBody()) {
+ return Optional.of(response.getBody());
+ }
+ return Optional.absent();
}
+
@Override
- public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz) {
- LOGGER.trace("Will invoke HTTP GET using URL: " + url);
+ public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz) {
+ LOGGER.trace("Will invoke HTTP GET using URL: {}", url);
try {
- final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.GET, null, clazz);
- if (!response.getStatusCode().equals(HttpStatus.OK)) {
- final String message = "Unable to invoke HTTP GET using URL: " + url +
- ", Response Code: " + response.getStatusCode();
- LOGGER.error(message);
- return Optional.absent();
- }
+ final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
+ return restTemplate.exchange(url, HttpMethod.GET, request, clazz);
- if (response.hasBody()) {
- return Optional.of(response.getBody());
- }
} catch (final HttpClientErrorException httpClientErrorException) {
- final String message = "Unable to invoke HTTP GET using url: " + url + ", Response: " +
- httpClientErrorException.getRawStatusCode();
+ final String message = "Unable to invoke HTTP GET using url: " + url + ", Response: "
+ + httpClientErrorException.getRawStatusCode();
LOGGER.error(message, httpClientErrorException);
final int rawStatusCode = httpClientErrorException.getRawStatusCode();
if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) {
@@ -72,48 +93,52 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url);
} catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP GET using url: " + url, restClientException);
- throw new RestProcessingException("Unable to invoke HTTP GET using URL: " +
- url, restClientException);
+ LOGGER.error("Unable to invoke HTTP GET using url: {}", url, restClientException);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException);
+ }
+ }
+
+ @Override
+ public <T> Optional<T> post(final Object object, final String url, final Class<T> clazz) {
+ final ResponseEntity<T> response = postHttpRequest(object, url, clazz);
+ if (!response.getStatusCode().equals(HttpStatus.OK)) {
+ final String message =
+ "Unable to invoke HTTP GET using URL: " + url + ", Response Code: " + response.getStatusCode();
+ LOGGER.error(message);
+ return Optional.absent();
+ }
+
+ if (response.hasBody()) {
+ return Optional.of(response.getBody());
}
return Optional.absent();
}
+
@Override
- public <T> Optional<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) {
+ public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) {
try {
- final HttpEntity<?> request = new HttpEntity<>(object);
- final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.POST, request, clazz);
- if (!response.getStatusCode().equals(HttpStatus.OK)) {
- final String message = "Unable to invoke HTTP GET using URL: " + url +
- ", Response Code: " + response.getStatusCode();
- LOGGER.error(message);
- return Optional.absent();
- }
-
- if (response.hasBody()) {
- return Optional.of(response.getBody());
- }
+ final HttpEntity<?> request = new HttpEntity<>(object, getHttpHeaders());
+ return restTemplate.exchange(url, HttpMethod.POST, request, clazz);
} catch (final HttpClientErrorException httpClientErrorException) {
- final String message = "Unable to invoke HTTP POST using url: " + url +
- ", Response: " + httpClientErrorException.getRawStatusCode();
+ final String message = "Unable to invoke HTTP POST using url: " + url + ", Response: "
+ + httpClientErrorException.getRawStatusCode();
LOGGER.error(message, httpClientErrorException);
final int rawStatusCode = httpClientErrorException.getRawStatusCode();
if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) {
throw new InvalidRestRequestException("No result found for given url: " + url);
}
- throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url);
} catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP POST using url: " + url, restClientException);
- throw new RestProcessingException("Unable to invoke HTTP POST using URL: "
- + url, restClientException);
+ LOGGER.error("Unable to invoke HTTP POST using url: {}", url, restClientException);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException);
}
-
- return Optional.absent();
}
-
+ private HttpHeaders getHttpHeaders() {
+ return httpHeadersProvider.getHttpHeaders();
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
index 514c595100..b0e67090ff 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 Bell Canada.
- * ================================================================================
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
-
package org.onap.so.client.cds;
import java.net.MalformedURLException;
@@ -68,4 +63,9 @@ public class TestCDSPropertiesImpl implements CDSProperties {
public boolean mapNotFoundToEmpty() {
return false;
}
+
+ @Override
+ public int getTimeout() {
+ return 60;
+ }
}
diff --git a/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java b/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java
new file mode 100644
index 0000000000..3e762cfbe7
--- /dev/null
+++ b/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.configuration.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class BasicHttpHeadersProviderTest {
+
+ private static final String BASIC_AUTH_VALUE = "Basic AuthValue";
+
+ @Test
+ public void test_getHttpHeaders_ContentTypeIsJson() {
+ final HttpHeadersProvider objUnderTest = new BasicHttpHeadersProvider();
+ final HttpHeaders actualHttpHeaders = objUnderTest.getHttpHeaders();
+ assertNull(actualHttpHeaders.get(AUTHORIZATION_HEADER));
+ assertEquals(MediaType.APPLICATION_JSON, actualHttpHeaders.getContentType());
+ }
+
+ @Test
+ public void test_getHttpHeaders_ContainAuthorizationHeader() {
+ final HttpHeadersProvider objUnderTest = new BasicHttpHeadersProvider(BASIC_AUTH_VALUE);
+ final HttpHeaders actualHttpHeaders = objUnderTest.getHttpHeaders();
+ assertEquals(Arrays.asList(BASIC_AUTH_VALUE), actualHttpHeaders.get(AUTHORIZATION_HEADER));
+ assertEquals(MediaType.APPLICATION_JSON, actualHttpHeaders.getContentType());
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java b/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java
new file mode 100644
index 0000000000..5084acc934
--- /dev/null
+++ b/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.configuration.rest;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class HttpComponentsClientConfigurationTest {
+
+ @Test
+ public void test_httpComponentsClientHttpRequestFactory_HttpComponentsClientHttpRequestFactoryNotNull() {
+ final HttpClientConnectionConfiguration clientConnectionConfiguration = new HttpClientConnectionConfiguration();
+ final HttpComponentsClientConfiguration objUnderTest =
+ new HttpComponentsClientConfiguration(clientConnectionConfiguration);
+
+ final HttpComponentsClientHttpRequestFactory factory = objUnderTest.httpComponentsClientHttpRequestFactory();
+ assertNotNull(factory);
+ assertNotNull(factory.getHttpClient());
+
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java b/common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java
new file mode 100644
index 0000000000..a738afe565
--- /dev/null
+++ b/common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java
@@ -0,0 +1,252 @@
+/*-
+ * ============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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.service;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class HttpRestServiceProviderImplTest {
+
+ private static final String BODY = "{}";
+ private static final String DUMMY_URL = "http://localhost:9000/dummy/url";
+
+ @Mock
+ private RestTemplate mockRestTemplate;
+
+ @Mock
+ private ResponseEntity<String> mockEntity;
+
+ @Test
+ public void test_get_returnOptionalPresentIfResponseIsOKAndHasBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(true);
+ when(mockEntity.getBody()).thenReturn(BODY);
+
+ final Optional<String> actual = objUnderTest.get(DUMMY_URL, String.class);
+
+ assertTrue(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test
+ public void test_get_returnOptionalPresentIfResponseIsNotOK() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
+
+ final Optional<String> actual = objUnderTest.get(DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test
+ public void test_get_returnOptionalPresentIfResponseIsOKAndNoBody() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(false);
+
+ final Optional<String> actual = objUnderTest.get(DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusBadRequest() {
+ assertGetErrorScenario(HttpStatus.BAD_REQUEST);
+
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusNotFoundHttpStatus() {
+ assertGetErrorScenario(HttpStatus.NOT_FOUND);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(HttpClientErrorException.class);
+
+ objUnderTest.get(DUMMY_URL, String.class);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifRestProcessingExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(RestClientException.class);
+
+ objUnderTest.get(DUMMY_URL, String.class);
+ }
+
+ @Test
+ public void test_post_returnOptionalPresentIfResponseIsOKAndHasBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(true);
+ when(mockEntity.getBody()).thenReturn(BODY);
+
+ final Optional<String> actual = objUnderTest.post(BODY, DUMMY_URL, String.class);
+
+ assertTrue(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test
+ public void test_post_returnOptionalPresentIfResponseIsOKAndHasNoBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(false);
+
+ final Optional<String> actual = objUnderTest.post(BODY, DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+
+ @Test
+ public void test_post_returnOptionalPresentIfResponseIsNotOKAndHasBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.PARTIAL_CONTENT);
+
+ final Optional<String> actual = objUnderTest.post(BODY, DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusBadRequest() {
+ assertPostErrorScenario(HttpStatus.BAD_REQUEST);
+
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusNotFoundHttpStatus() {
+ assertPostErrorScenario(HttpStatus.NOT_FOUND);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(HttpClientErrorException.class);
+
+ objUnderTest.post(BODY, DUMMY_URL, String.class);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifRestProcessingExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(RestClientException.class);
+
+ objUnderTest.post(BODY, DUMMY_URL, String.class);
+ }
+
+ private void assertPostErrorScenario(final HttpStatus status) {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ final HttpClientErrorException errorException = new HttpClientErrorException(status);
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(errorException);
+
+ objUnderTest.post(BODY, DUMMY_URL, String.class);
+ }
+
+ private void assertGetErrorScenario(final HttpStatus status) {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ final HttpClientErrorException errorException = new HttpClientErrorException(status);
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(errorException);
+
+ objUnderTest.get(DUMMY_URL, String.class);
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
index b893cec0f2..6902d8f36a 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
@@ -29,7 +29,8 @@ public enum OrchestrationStatus {
PENDING_ACTIVATION("PendingActivation", "pending.?activation"),
PENDING_CREATE("PendingCreate", "pending.?create"),
PENDING_DELETE("PendingDelete", "pending.?delete"),
- PRECREATED("PreCreated", "pre.?created");
+ PRECREATED("PreCreated", "pre.?created"),
+ CONFIGASSIGNED("ConfigAssigned", "config.?assigned");
private final String name;
private final String fuzzyMatcher;
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java
deleted file mode 100644
index 34afd825cb..0000000000
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.so.monitoring.configuration.rest;
-
-import java.io.IOException;
-
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-
-/**
- * @author waqas.ikram@ericsson.com
- *
- */
-public class BasicAuthorizationHttpRequestInterceptor implements ClientHttpRequestInterceptor {
-
- private final String authorization;
-
- public BasicAuthorizationHttpRequestInterceptor(final String authorization) {
- this.authorization = authorization;
- }
-
- @Override
- public ClientHttpResponse intercept(final HttpRequest request, final byte[] body,
- final ClientHttpRequestExecution execution) throws IOException {
- final HttpHeaders headers = request.getHeaders();
- headers.add("Authorization", authorization);
- return execution.execute(request, body);
- }
-}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java
index a590d7908f..11c4d1b4f4 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java
@@ -19,17 +19,17 @@
*/
package org.onap.so.monitoring.configuration.rest;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.CAMUNDA_REST_TEMPLATE;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.DATABASE_REST_TEMPLATE;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProviderImpl;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.web.client.RestTemplate;
/**
@@ -45,28 +45,22 @@ public class HttpServiceProviderConfiguration {
@Bean
@Qualifier(CAMUNDA_HTTP_REST_SERVICE_PROVIDER)
public HttpRestServiceProvider camundaHttpRestServiceProvider(
- @Qualifier(CAMUNDA_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Value(value = "${camunda.rest.api.auth:#{null}}") final String authorization) {
- return getHttpRestServiceProvider(restTemplate, authorization);
+ return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(authorization));
}
@Bean
@Qualifier(DATABASE_HTTP_REST_SERVICE_PROVIDER)
public HttpRestServiceProvider databaseHttpRestServiceProvider(
- @Qualifier(DATABASE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Value(value = "${mso.database.rest.api.auth:#{null}}") final String authorization) {
-
- return getHttpRestServiceProvider(restTemplate, authorization);
+ return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(authorization));
}
private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final String authorization) {
- if (authorization != null && !authorization.isEmpty()) {
- final ClientHttpRequestInterceptor authorizationInterceptor =
- new BasicAuthorizationHttpRequestInterceptor(authorization);
- restTemplate.getInterceptors().add(authorizationInterceptor);
- }
- return new HttpRestServiceProviderImpl(restTemplate);
+ final HttpHeadersProvider httpHeadersProvider) {
+ return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java
index 6be6367302..49e3d4f92f 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java
@@ -30,7 +30,7 @@ import org.onap.so.monitoring.camunda.model.SoActiveInfraRequests;
import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider;
import org.onap.so.monitoring.model.SoInfraRequest;
import org.onap.so.monitoring.model.SoInfraRequestBuilder;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
@@ -60,7 +60,7 @@ public class DatabaseServiceProviderImpl implements DatabaseServiceProvider {
final String url = urlProvider.getSearchUrl(startTime, endTime, maxResult);
final Optional<SoActiveInfraRequests[]> optionalRequests =
- httpRestServiceProvider.postHttpRequest(filters, url, SoActiveInfraRequests[].class);
+ httpRestServiceProvider.post(filters, url, SoActiveInfraRequests[].class);
if (optionalRequests.isPresent()) {
return getSoInfraRequest(optionalRequests.get());
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java
index e6fbb68456..b7a439fc28 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java
@@ -35,15 +35,15 @@ import org.onap.so.monitoring.model.ProcessDefinitionDetail;
import org.onap.so.monitoring.model.ProcessInstanceDetail;
import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.google.common.base.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* @author waqas.ikram@ericsson.com
*/
@@ -64,13 +64,12 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
@Override
public Optional<ProcessInstanceIdDetail> getProcessInstanceIdDetail(final String requestId) {
final String url = urlProvider.getHistoryProcessInstanceUrl(requestId);
- final Optional<ProcessInstance[]> processInstances =
- httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class);
+ final Optional<ProcessInstance[]> processInstances = httpRestServiceProvider.get(url, ProcessInstance[].class);
if (processInstances.isPresent()) {
final ProcessInstance[] instances = processInstances.get();
- final String message = "found process instance for request id: " + requestId +
- ", result size: " + instances.length;
+ final String message =
+ "found process instance for request id: " + requestId + ", result size: " + instances.length;
LOGGER.debug(message);
if (instances.length > 0) {
@@ -79,8 +78,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
if (processInstance.getSuperProcessInstanceId() == null) {
return Optional.of(new ProcessInstanceIdDetail(processInstance.getId()));
}
- LOGGER.debug("found sub process instance id with super process instanceId: " +
- processInstance.getSuperProcessInstanceId());
+ LOGGER.debug("found sub process instance id with super process instanceId: "
+ + processInstance.getSuperProcessInstanceId());
}
}
}
@@ -91,8 +90,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
@Override
public Optional<ProcessInstanceDetail> getSingleProcessInstanceDetail(final String processInstanceId) {
final String url = urlProvider.getSingleProcessInstanceUrl(processInstanceId);
- final Optional<ProcessInstance> processInstances =
- httpRestServiceProvider.getHttpResponse(url, ProcessInstance.class);
+ final Optional<ProcessInstance> processInstances = httpRestServiceProvider.get(url, ProcessInstance.class);
if (processInstances.isPresent()) {
final ProcessInstance processInstance = processInstances.get();
@@ -111,8 +109,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
@Override
public Optional<ProcessDefinitionDetail> getProcessDefinition(final String processDefinitionId) {
final String url = urlProvider.getProcessDefinitionUrl(processDefinitionId);
- final Optional<ProcessDefinition> response =
- httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class);
+ final Optional<ProcessDefinition> response = httpRestServiceProvider.get(url, ProcessDefinition.class);
if (response.isPresent()) {
final ProcessDefinition processDefinition = response.get();
final String xmlDefinition = processDefinition.getBpmn20Xml();
@@ -120,16 +117,14 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
return Optional.of(new ProcessDefinitionDetail(processDefinitionId, xmlDefinition));
}
}
- LOGGER.error("Unable to find process definition for processDefinitionId: " +
- processDefinitionId);
+ LOGGER.error("Unable to find process definition for processDefinitionId: " + processDefinitionId);
return Optional.absent();
}
@Override
public List<ActivityInstanceDetail> getActivityInstance(final String processInstanceId) {
final String url = urlProvider.getActivityInstanceUrl(processInstanceId);
- final Optional<ActivityInstance[]> response =
- httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class);
+ final Optional<ActivityInstance[]> response = httpRestServiceProvider.get(url, ActivityInstance[].class);
if (response.isPresent()) {
final ActivityInstance[] activityInstances = response.get();
final List<ActivityInstanceDetail> activityInstanceDetails = new ArrayList<>(activityInstances.length);
@@ -148,8 +143,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
}
return activityInstanceDetails;
}
- LOGGER.error("Unable to find activity intance detail for process instance id: " +
- processInstanceId);
+ LOGGER.error("Unable to find activity intance detail for process instance id: " + processInstanceId);
return Collections.emptyList();
}
@@ -157,7 +151,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
public List<ProcessInstanceVariableDetail> getProcessInstanceVariable(final String processInstanceId) {
final String url = urlProvider.getProcessInstanceVariablesUrl(processInstanceId);
final Optional<ProcessInstanceVariable[]> response =
- httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class);
+ httpRestServiceProvider.get(url, ProcessInstanceVariable[].class);
if (response.isPresent()) {
final ProcessInstanceVariable[] instanceVariables = response.get();
final List<ProcessInstanceVariableDetail> instanceVariableDetails =
@@ -171,8 +165,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
}
return instanceVariableDetails;
}
- LOGGER.error("Unable to find process intance variable details for process instance id: "
- + processInstanceId);
+ LOGGER.error("Unable to find process intance variable details for process instance id: " + processInstanceId);
return Collections.emptyList();
}
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
index 1b3e168c12..9df24c1921 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.onap.so.monitoring.configuration.rest.HttpServiceProviderConfiguration;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import org.springframework.web.client.RestTemplate;
/**
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
index 58666671a7..3a7ce18bf7 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
@@ -38,7 +38,7 @@ import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider;
import org.onap.so.monitoring.db.service.DatabaseServiceProvider;
import org.onap.so.monitoring.db.service.DatabaseServiceProviderImpl;
import org.onap.so.monitoring.model.SoInfraRequest;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import com.google.common.base.Optional;
@@ -57,8 +57,8 @@ public class DatabaseServiceProviderTest {
final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null);
final Optional<SoActiveInfraRequests[]> response = Optional.of(new SoActiveInfraRequests[] {});
- when(mockServiceProvider.postHttpRequest(eq(Collections.emptyMap()), eq(searchUrl),
- eq(SoActiveInfraRequests[].class))).thenReturn(response);
+ when(mockServiceProvider.post(eq(Collections.emptyMap()), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
+ .thenReturn(response);
final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider);
@@ -71,8 +71,8 @@ public class DatabaseServiceProviderTest {
final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null);
final Optional<SoActiveInfraRequests[]> response = Optional.absent();
- when(mockServiceProvider.postHttpRequest(eq(Collections.emptyMap()), eq(searchUrl),
- eq(SoActiveInfraRequests[].class))).thenReturn(response);
+ when(mockServiceProvider.post(eq(Collections.emptyMap()), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
+ .thenReturn(response);
final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider);
@@ -94,7 +94,7 @@ public class DatabaseServiceProviderTest {
final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class);
- when(mockServiceProvider.postHttpRequest(eq(filters), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
+ when(mockServiceProvider.post(eq(filters), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
.thenReturn(response);
final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider);
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
index c3930df196..d21cf6d02b 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
@@ -38,6 +38,7 @@ import org.onap.so.monitoring.model.ActivityInstanceDetail;
import org.onap.so.monitoring.model.ProcessDefinitionDetail;
import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import com.google.common.base.Optional;
@@ -65,7 +66,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessInstanceDetail_EmptyResponse() {
final Optional<ProcessInstance[]> response = Optional.<ProcessInstance[]>absent();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -77,7 +78,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNull() {
final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance());
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -92,7 +93,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNotNull() {
final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance(SUPER_PROCESS_ID));
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -105,7 +106,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessDefinition_EmptyResponse() {
final Optional<ProcessDefinition> response = Optional.<ProcessDefinition>absent();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + ID + "/xml";
- when(httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessDefinition.class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -117,7 +118,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessDefinition_NonEmptyResponse() {
final Optional<ProcessDefinition> response = getProcessDefinition();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + PROCESS_ID + "/xml";
- when(httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessDefinition.class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -132,7 +133,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ActivityInstance[]> response = Optional.<ActivityInstance[]>absent();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID
+ "&sortBy=startTime&sortOrder=asc";
- when(httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ActivityInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -146,7 +147,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ActivityInstance[]> response = getActivityInstance();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID
+ "&sortBy=startTime&sortOrder=asc";
- when(httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ActivityInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -164,7 +165,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ProcessInstanceVariable[]> response = Optional.<ProcessInstanceVariable[]>absent();
final String url =
CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstanceVariable[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -178,7 +179,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ProcessInstanceVariable[]> response = getProcessInstanceVariable();
final String url =
CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstanceVariable[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
index 155b4e65a4..d2fa08fdfd 100644
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
@@ -33,8 +33,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.onap.so.monitoring.db.service.DatabaseServiceProvider;
-import org.onap.so.monitoring.exception.InvalidRestRequestException;
-import org.onap.so.monitoring.exception.RestProcessingException;
import org.onap.so.monitoring.model.ActivityInstanceDetail;
import org.onap.so.monitoring.model.ProcessDefinitionDetail;
import org.onap.so.monitoring.model.ProcessInstanceDetail;
@@ -42,14 +40,15 @@ import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
import org.onap.so.monitoring.model.SoInfraRequest;
import org.onap.so.monitoring.rest.service.CamundaProcessDataServiceProvider;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.base.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* @author waqas.ikram@ericsson.com
*/
@@ -134,8 +133,7 @@ public class SoMonitoringController {
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getProcessDefinitionXml(final @PathParam("processDefinitionId") String processDefinitionId) {
if (processDefinitionId == null || processDefinitionId.isEmpty()) {
- return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " +
- processDefinitionId)
+ return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " + processDefinitionId)
.build();
}
try {
@@ -145,18 +143,15 @@ public class SoMonitoringController {
final ProcessDefinitionDetail definitionDetail = response.get();
return Response.status(Status.OK).entity(definitionDetail).build();
}
- LOGGER.error("Unable to find process definition xml for processDefinitionId: " +
- processDefinitionId);
+ LOGGER.error("Unable to find process definition xml for processDefinitionId: " + processDefinitionId);
return Response.status(Status.NO_CONTENT).build();
} catch (final InvalidRestRequestException extensions) {
final String message =
- "Unable to find process definition xml for processDefinitionId: {}" +
- processDefinitionId;
+ "Unable to find process definition xml for processDefinitionId: {}" + processDefinitionId;
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to get process definition xml for id: " +
- processDefinitionId;
+ final String message = "Unable to get process definition xml for id: " + processDefinitionId;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
@@ -175,13 +170,11 @@ public class SoMonitoringController {
camundaProcessDataServiceProvider.getActivityInstance(processInstanceId);
return Response.status(Status.OK).entity(activityInstanceDetails).build();
} catch (final InvalidRestRequestException extensions) {
- final String message = "Unable to find activity instance for processInstanceId: " +
- processInstanceId;
+ final String message = "Unable to find activity instance for processInstanceId: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to get activity instance detail for id: " +
- processInstanceId;
+ final String message = "Unable to get activity instance detail for id: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
@@ -201,13 +194,11 @@ public class SoMonitoringController {
return Response.status(Status.OK).entity(processInstanceVariable).build();
} catch (final InvalidRestRequestException extensions) {
final String message =
- "Unable to find process instance variables for processInstanceId: " +
- processInstanceId;
+ "Unable to find process instance variables for processInstanceId: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to get process instance variables for id: " +
- processInstanceId;
+ final String message = "Unable to get process instance variables for id: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
@@ -230,13 +221,13 @@ public class SoMonitoringController {
return Response.status(Status.OK).entity(requests).build();
} catch (final InvalidRestRequestException extensions) {
- final String message = "Unable to search request for filters: " + filters + ", from: " +
- startTime + ", to: " + endTime + ", maxResult: " + maxResult;
+ final String message = "Unable to search request for filters: " + filters + ", from: " + startTime
+ + ", to: " + endTime + ", maxResult: " + maxResult;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to search request for filters: " + filters + ", from: " +
- startTime + ", to: " + endTime + ", maxResult: " + maxResult;
+ final String message = "Unable to search request for filters: " + filters + ", from: " + startTime
+ + ", to: " + endTime + ", maxResult: " + maxResult;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
diff --git a/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
index 3ca184ebaa..2c4d036397 100644
--- a/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
+++ b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
@@ -22,8 +22,8 @@ package org.onap.so.monitoring.rest.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.CAMUNDA_REST_TEMPLATE;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.DATABASE_REST_TEMPLATE;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
import static org.onap.so.monitoring.rest.api.Constants.ACTIVITY_INSTANCE_RESPONSE_JSON_FILE;
import static org.onap.so.monitoring.rest.api.Constants.EMPTY_ARRAY_RESPONSE;
import static org.onap.so.monitoring.rest.api.Constants.EMPTY_STRING;
@@ -37,6 +37,7 @@ import static org.onap.so.monitoring.rest.api.Constants.PROCRESS_DEF_ID;
import static org.onap.so.monitoring.rest.api.Constants.SEARCH_RESULT_RESPONSE_JSON_FILE;
import static org.onap.so.monitoring.rest.api.Constants.SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE;
import static org.onap.so.monitoring.rest.api.Constants.START_TIME_IN_MS;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.header;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@@ -81,14 +82,14 @@ import org.springframework.web.client.RestTemplate;
@ActiveProfiles("test")
@SpringBootTest
public class SoMonitoringControllerTest {
+ private static final String CAMUNDA_BASIC_AUTH =
+ "Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==";
- @Autowired
- @Qualifier(CAMUNDA_REST_TEMPLATE)
- private RestTemplate restTemplate;
+ private static final String DATABASE_BASIC_AUTH = "Basic YnBlbDpwYXNzd29yZDEk";
@Autowired
- @Qualifier(DATABASE_REST_TEMPLATE)
- private RestTemplate dataBaseRestTemplate;
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ private RestTemplate restTemplate;
@Autowired
private CamundaRestUrlProvider urlProvider;
@@ -96,23 +97,22 @@ public class SoMonitoringControllerTest {
@Autowired
private DatabaseUrlProvider databaseUrlProvider;
- private MockRestServiceServer camundaMockServer;
+ private MockRestServiceServer mockRestServiceServer;
- private MockRestServiceServer databaseMockServer;
@Autowired
private SoMonitoringController objUnderTest;
@Before
public void setUp() throws Exception {
- camundaMockServer = MockRestServiceServer.bindTo(restTemplate).build();
- databaseMockServer = MockRestServiceServer.bindTo(dataBaseRestTemplate).build();
+ mockRestServiceServer = MockRestServiceServer.bindTo(restTemplate).build();
}
@Test
public void test_GetProcessInstance_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(PROCCESS_INSTANCE_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ .andExpect(header(AUTHORIZATION_HEADER, CAMUNDA_BASIC_AUTH))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -125,7 +125,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstance_SuccessResponseWithEmptyDataFromCamunda() throws Exception {
final String jsonString = EMPTY_ARRAY_RESPONSE;
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -135,7 +135,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstance_FailureResponseWithEmptyDataFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -144,7 +144,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstance_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -155,7 +155,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetSinlgeProcessInstance_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID);
@@ -171,7 +171,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetSingleProcessInstance_WithBadRequestResponseFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID);
@@ -181,7 +181,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetSingleProcessInstance_WithUnauthorizedRequestResponseFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID);
@@ -216,7 +216,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessDefinitionXml_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(PROCESS_DEF_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID);
@@ -228,7 +228,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessDefinitionXml_BadRequestResponseFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID);
@@ -238,7 +238,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessDefinitionXml_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID);
@@ -260,7 +260,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(ACTIVITY_INSTANCE_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -287,7 +287,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_SuccessResponseWithEmptyDataFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(EMPTY_ARRAY_RESPONSE, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -297,7 +297,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -307,7 +307,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_BadRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -329,7 +329,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -347,7 +347,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_SuccessResponseWithEmptyDataFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(EMPTY_ARRAY_RESPONSE, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -358,7 +358,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_BadRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -369,7 +369,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -396,8 +396,9 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetInfraActiveRequests_SuccessResponseWithSoInfraRequestList() throws Exception {
final String jsonString = getJsonResponse(SEARCH_RESULT_RESPONSE_JSON_FILE);
- this.databaseMockServer
+ this.mockRestServiceServer
.expect(requestTo(databaseUrlProvider.getSearchUrl(START_TIME_IN_MS, END_TIME_IN_MS, null)))
+ .andExpect(header(AUTHORIZATION_HEADER, DATABASE_BASIC_AUTH))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response =