summaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java56
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java24
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java87
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java68
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java35
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java19
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java232
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java117
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java12
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java37
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java26
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java243
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java86
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java151
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java117
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java34
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java96
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java12
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java719
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java62
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java74
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java313
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java206
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java113
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java104
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java1060
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java510
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java208
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java71
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java77
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java31
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java62
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java52
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java48
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java27
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java24
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java604
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java282
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java158
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java104
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java432
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java178
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java76
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java453
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java343
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java71
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java110
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java20
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java45
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java522
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java16
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java640
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java625
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java334
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java68
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java183
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java81
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java145
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java65
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java1008
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java257
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java197
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java600
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java98
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java63
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java4245
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java13
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java61
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java47
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java56
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java596
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java394
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java465
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java589
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java473
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java591
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java238
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java228
86 files changed, 10100 insertions, 10911 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java
index bf4c59ca09..1172d77c13 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java
@@ -28,9 +28,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -49,28 +51,24 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "responseCode",
- "responseMessage"
-}, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@XmlType(name = "", propOrder = {"requestId", "responseCode", "responseMessage"},
+ namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
@XmlRootElement(name = "CallbackHeader")
public class CallbackHeader {
- @XmlElement(name = "RequestId", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ @XmlElement(name = "RequestId", required = true, namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
protected String requestId;
- @XmlElement(name = "ResponseCode", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ @XmlElement(name = "ResponseCode", required = true, namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
protected String responseCode;
- @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ @XmlElement(name = "ResponseMessage", required = true,
+ namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
protected String responseMessage;
/**
* Gets the value of the requestId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getRequestId() {
return requestId;
@@ -79,10 +77,8 @@ public class CallbackHeader {
/**
* Sets the value of the requestId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setRequestId(String value) {
this.requestId = value;
@@ -91,10 +87,8 @@ public class CallbackHeader {
/**
* Gets the value of the responseCode property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getResponseCode() {
return responseCode;
@@ -103,10 +97,8 @@ public class CallbackHeader {
/**
* Sets the value of the responseCode property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setResponseCode(String value) {
this.responseCode = value;
@@ -115,10 +107,8 @@ public class CallbackHeader {
/**
* Gets the value of the responseMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getResponseMessage() {
return responseMessage;
@@ -127,10 +117,8 @@ public class CallbackHeader {
/**
* Sets the value of the responseMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setResponseMessage(String value) {
this.responseMessage = value;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java
index a72e23e57f..721bc1d4f3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java
@@ -24,17 +24,13 @@ import javax.xml.bind.annotation.XmlRegistry;
/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
+ * This object contains factory methods for each Java content interface and Java element interface generated in the
+ * org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
+ * <p>
+ * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content.
+ * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
+ * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
+ * this class.
*
*/
@XmlRegistry
@@ -42,11 +38,11 @@ public class ObjectFactory {
/**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
+ * org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
*
*/
- public ObjectFactory() {
- }
+ public ObjectFactory() {}
/**
* Create an instance of {@link RequestHeader }
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java
index 2c56a110db..58f5c468f5 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java
@@ -28,9 +28,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -52,14 +54,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "svcInstanceId",
- "svcAction",
- "svcOperation",
- "callbackUrl",
- "msoAction"
-})
+@XmlType(name = "", propOrder = {"requestId", "svcInstanceId", "svcAction", "svcOperation", "callbackUrl", "msoAction"})
@XmlRootElement(name = "RequestHeader")
public class RequestHeader {
@@ -79,10 +74,8 @@ public class RequestHeader {
/**
* Gets the value of the requestId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getRequestId() {
return requestId;
@@ -91,10 +84,8 @@ public class RequestHeader {
/**
* Sets the value of the requestId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setRequestId(String value) {
this.requestId = value;
@@ -103,10 +94,8 @@ public class RequestHeader {
/**
* Gets the value of the svcInstanceId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getSvcInstanceId() {
return svcInstanceId;
@@ -115,10 +104,8 @@ public class RequestHeader {
/**
* Sets the value of the svcInstanceId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setSvcInstanceId(String value) {
this.svcInstanceId = value;
@@ -127,10 +114,8 @@ public class RequestHeader {
/**
* Gets the value of the svcAction property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getSvcAction() {
return svcAction;
@@ -139,10 +124,8 @@ public class RequestHeader {
/**
* Sets the value of the svcAction property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setSvcAction(String value) {
this.svcAction = value;
@@ -151,10 +134,8 @@ public class RequestHeader {
/**
* Gets the value of the svcOperation property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getSvcOperation() {
return svcOperation;
@@ -163,10 +144,8 @@ public class RequestHeader {
/**
* Sets the value of the svcOperation property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setSvcOperation(String value) {
this.svcOperation = value;
@@ -175,10 +154,8 @@ public class RequestHeader {
/**
* Gets the value of the callbackUrl property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getCallbackUrl() {
return callbackUrl;
@@ -187,10 +164,8 @@ public class RequestHeader {
/**
* Sets the value of the callbackUrl property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setCallbackUrl(String value) {
this.callbackUrl = value;
@@ -199,10 +174,8 @@ public class RequestHeader {
/**
* Gets the value of the msoAction property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMsoAction() {
return msoAction;
@@ -211,10 +184,8 @@ public class RequestHeader {
/**
* Sets the value of the msoAction property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMsoAction(String value) {
this.msoAction = value;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java
index e77232510a..2b4b8cb90f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.common.adapter.sdnc;
import java.io.StringWriter;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -33,9 +32,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -53,25 +54,21 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1", propOrder = {
- "callbackHeader",
- "requestData"
-})
-@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@XmlType(name = "", namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1",
+ propOrder = {"callbackHeader", "requestData"})
+@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
public class SDNCAdapterCallbackRequest {
- @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ @XmlElement(name = "CallbackHeader", required = true, namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
protected CallbackHeader callbackHeader;
- @XmlElement(name = "RequestData", required=false, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ @XmlElement(name = "RequestData", required = false, namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
protected Object requestData;
/**
* Gets the value of the callbackHeader property.
*
- * @return
- * possible object is
- * {@link CallbackHeader }
- *
+ * @return possible object is {@link CallbackHeader }
+ *
*/
public CallbackHeader getCallbackHeader() {
return callbackHeader;
@@ -80,10 +77,8 @@ public class SDNCAdapterCallbackRequest {
/**
* Sets the value of the callbackHeader property.
*
- * @param value
- * allowed object is
- * {@link CallbackHeader }
- *
+ * @param value allowed object is {@link CallbackHeader }
+ *
*/
public void setCallbackHeader(CallbackHeader value) {
this.callbackHeader = value;
@@ -92,10 +87,8 @@ public class SDNCAdapterCallbackRequest {
/**
* Gets the value of the requestData property.
*
- * @return
- * possible object is
- * {@link Object }
- *
+ * @return possible object is {@link Object }
+ *
*/
public Object getRequestData() {
return requestData;
@@ -104,27 +97,24 @@ public class SDNCAdapterCallbackRequest {
/**
* Sets the value of the requestData property.
*
- * @param value
- * allowed object is
- * {@link Object }
- *
+ * @param value allowed object is {@link Object }
+ *
*/
public void setRequestData(Object value) {
this.requestData = value;
}
@Override
- public String toString() {
- StringWriter writer = new StringWriter();
- try {
- JAXBContext context = JAXBContext
- .newInstance(SDNCAdapterCallbackRequest.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(this, writer);
- return writer.getBuffer().toString();
- } catch (JAXBException e) {
- return "";
- }
- }
+ public String toString() {
+ StringWriter writer = new StringWriter();
+ try {
+ JAXBContext context = JAXBContext.newInstance(SDNCAdapterCallbackRequest.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(this, writer);
+ return writer.getBuffer().toString();
+ } catch (JAXBException e) {
+ return "";
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java
index 179776d95d..0ae5f7a614 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java
@@ -28,9 +28,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -48,10 +50,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestHeader",
- "requestData"
-})
+@XmlType(name = "", propOrder = {"requestHeader", "requestData"})
@XmlRootElement(name = "SDNCAdapterRequest")
public class SDNCAdapterRequest {
@@ -63,10 +62,8 @@ public class SDNCAdapterRequest {
/**
* Gets the value of the requestHeader property.
*
- * @return
- * possible object is
- * {@link RequestHeader }
- *
+ * @return possible object is {@link RequestHeader }
+ *
*/
public RequestHeader getRequestHeader() {
return requestHeader;
@@ -75,10 +72,8 @@ public class SDNCAdapterRequest {
/**
* Sets the value of the requestHeader property.
*
- * @param value
- * allowed object is
- * {@link RequestHeader }
- *
+ * @param value allowed object is {@link RequestHeader }
+ *
*/
public void setRequestHeader(RequestHeader value) {
this.requestHeader = value;
@@ -87,10 +82,8 @@ public class SDNCAdapterRequest {
/**
* Gets the value of the requestData property.
*
- * @return
- * possible object is
- * {@link Object }
- *
+ * @return possible object is {@link Object }
+ *
*/
public Object getRequestData() {
return requestData;
@@ -99,10 +92,8 @@ public class SDNCAdapterRequest {
/**
* Sets the value of the requestData property.
*
- * @param value
- * allowed object is
- * {@link Object }
- *
+ * @param value allowed object is {@link Object }
+ *
*/
public void setRequestData(Object value) {
this.requestData = value;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
index 3666cb56a6..332b3ebbbd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
@@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java
index eff70f5b12..887b1994d5 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java
@@ -28,12 +28,11 @@ import javax.jws.soap.SOAPBinding;
/**
- * This class was generated by the JAX-WS RI.
- * JAX-WS RI 2.2.4-b01
- * Generated source version: 2.2
+ * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.4-b01 Generated source version: 2.2
*
*/
-@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
+@WebService(name = "SDNCCallbackAdapterPortType",
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SDNCCallbackAdapterPortType {
@@ -41,13 +40,13 @@ public interface SDNCCallbackAdapterPortType {
/**
*
* @param sdncAdapterCallbackRequest
- * @return
- * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse
+ * @return returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse
*/
@WebMethod(operationName = "SDNCAdapterCallback")
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
- public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest);
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1",
+ partName = "SDNCAdapterCallbackResponse")
+ public SDNCAdapterResponse sdncAdapterCallback(@WebParam(name = "SDNCAdapterCallbackRequest",
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1",
+ partName = "SDNCAdapterCallbackRequest") SDNCAdapterCallbackRequest sdncAdapterCallbackRequest);
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java
index ec341d82b5..88be09ee85 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java
@@ -18,5 +18,6 @@
* ============LICENSE_END=========================================================
*/
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1",
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.onap.so.bpmn.common.adapter.sdnc;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java
index aa348c7765..e1cb6fd38e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.adapter.vnf;
import java.util.ArrayList;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -30,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for createVnfNotification complex type.
+ * <p>
+ * Java class for createVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="createVnfNotification">
@@ -76,15 +77,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "createVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfId",
- "outputs",
- "rollback"
-})
+@XmlType(name = "createVnfNotification1",
+ propOrder = {"messageId", "completed", "exception", "errorMessage", "vnfId", "outputs", "rollback"})
public class CreateVnfNotification {
@XmlElement(required = true)
@@ -99,10 +93,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -111,10 +103,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -139,10 +129,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -151,10 +139,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -163,10 +149,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -175,10 +159,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
@@ -187,10 +169,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the vnfId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getVnfId() {
return vnfId;
@@ -199,10 +179,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the vnfId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setVnfId(String value) {
this.vnfId = value;
@@ -211,10 +189,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the outputs property.
*
- * @return
- * possible object is
- * {@link CreateVnfNotification.Outputs }
- *
+ * @return possible object is {@link CreateVnfNotification.Outputs }
+ *
*/
public CreateVnfNotification.Outputs getOutputs() {
return outputs;
@@ -223,10 +199,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the outputs property.
*
- * @param value
- * allowed object is
- * {@link CreateVnfNotification.Outputs }
- *
+ * @param value allowed object is {@link CreateVnfNotification.Outputs }
+ *
*/
public void setOutputs(CreateVnfNotification.Outputs value) {
this.outputs = value;
@@ -235,10 +209,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the rollback property.
*
- * @return
- * possible object is
- * {@link VnfRollback }
- *
+ * @return possible object is {@link VnfRollback }
+ *
*/
public VnfRollback getRollback() {
return rollback;
@@ -247,10 +219,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the rollback property.
*
- * @param value
- * allowed object is
- * {@link VnfRollback }
- *
+ * @param value allowed object is {@link VnfRollback }
+ *
*/
public void setRollback(VnfRollback value) {
this.rollback = value;
@@ -258,9 +228,11 @@ public class CreateVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -288,32 +260,29 @@ public class CreateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
+ @XmlType(name = "", propOrder = {"entry"})
public static class Outputs {
protected List<CreateVnfNotification.Outputs.Entry> entry;
-
+
/**
* Gets the value of the entry property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you
+ * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
+ * method for the entry property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getEntry().add(newItem);
+ * getEntry().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link CreateVnfNotification.Outputs.Entry }
+ * Objects of the following type(s) are allowed in the list {@link CreateVnfNotification.Outputs.Entry }
*
*
*/
@@ -325,24 +294,26 @@ public class CreateVnfNotification {
}
// Not a generated method
- @Override
+ @Override
public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
}
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -360,10 +331,7 @@ public class CreateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
+ @XmlType(name = "", propOrder = {"key", "value"})
public static class Entry {
protected String key;
@@ -372,10 +340,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the key property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getKey() {
return key;
@@ -384,10 +350,8 @@ public class CreateVnfNotification {
/**
* Sets the value of the key property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setKey(String value) {
this.key = value;
@@ -396,10 +360,8 @@ public class CreateVnfNotification {
/**
* Gets the value of the value property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getValue() {
return value;
@@ -408,55 +370,45 @@ public class CreateVnfNotification {
/**
* Sets the value of the value property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setValue(String value) {
this.value = value;
-
+
}
-
+
// Not a generated method
@Override
public String toString() {
- String entrystr;
- entrystr =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entrystr;
+ String entrystr;
+ entrystr = "<entry>" + '\n' + " <key>" + key + "</key>" + '\n' + " <value>" + value + "</value>"
+ + '\n' + "</entry>";
+ return entrystr;
}
}
}
- // Not a generated method
- @Override
- public String toString() {
- String createVnfNotification;
- if (exception==null) {
- createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <rollback>"+rollback+"</rollback>" + '\n' +
- "</ns2:createVnfNotification>";
- } else {
- createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:createVnfNotification>";
- }
- return createVnfNotification;
- }
+ // Not a generated method
+ @Override
+ public String toString() {
+ String createVnfNotification;
+ if (exception == null) {
+ createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <vnfId>" + vnfId + "</vnfId>" + '\n' + (outputs == null ? "" : outputs.toString() + '\n')
+ + " <rollback>" + rollback + "</rollback>" + '\n' + "</ns2:createVnfNotification>";
+ } else {
+ createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + (outputs == null ? "" : outputs.toString() + '\n') + " <exception>" + exception + "</exception>"
+ + '\n' + " <errorMessage>" + errorMessage + "</errorMessage>" + '\n'
+ + "</ns2:createVnfNotification>";
+ }
+ return createVnfNotification;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
index 3ad217306d..cd4257ec60 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
@@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for deleteVnfNotification complex type.
+ * <p>
+ * Java class for deleteVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="deleteVnfNotification">
@@ -49,12 +51,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
+@XmlType(name = "deleteVnfNotification1", propOrder = {"messageId", "completed", "exception", "errorMessage"})
public class DeleteVnfNotification {
@XmlElement(required = true)
@@ -66,10 +63,8 @@ public class DeleteVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -78,10 +73,8 @@ public class DeleteVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -106,10 +99,8 @@ public class DeleteVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -118,10 +109,8 @@ public class DeleteVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -130,10 +119,8 @@ public class DeleteVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -142,57 +129,43 @@ public class DeleteVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
}
/**
- * Overrides toString() method
+ * Overrides toString() method
+ *
* @return String type (deleteVnfNotification)
*/
-
+
@Override
- public String toString() {
- String deleteVnfNotification;
- if (exception == null) {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:deleteVnfNotification>";
- } else {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:deleteVnfNotification>";
- }
- return deleteVnfNotification;
- }
-
-/*
- public String toString() {
- StringWriter writer = new StringWriter();
- try {
- JAXBContext context = JAXBContext
- .newInstance(DeleteVnfNotification.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(this, writer);
- //System.out.println("toString() - " + writer.getBuffer().toString());
- return writer.getBuffer().toString();
- } catch (JAXBException e) {
- //System.out.println("JAXBException - " + e.getStackTrace());
- return "";
- }
- }
-*/
-
+ public String toString() {
+ String deleteVnfNotification;
+ if (exception == null) {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + "</ns2:deleteVnfNotification>";
+ } else {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <exception>" + exception + "</exception>" + '\n' + " <errorMessage>" + errorMessage
+ + "</errorMessage>" + '\n' + "</ns2:deleteVnfNotification>";
+ }
+ return deleteVnfNotification;
+ }
+
+ /*
+ * public String toString() { StringWriter writer = new StringWriter(); try { JAXBContext context = JAXBContext
+ * .newInstance(DeleteVnfNotification.class); Marshaller m = context.createMarshaller();
+ * m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(this, writer);
+ * //System.out.println("toString() - " + writer.getBuffer().toString()); return writer.getBuffer().toString(); }
+ * catch (JAXBException e) { //System.out.println("JAXBException - " + e.getStackTrace()); return ""; } }
+ */
+
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java
index e4c95e82cd..aae624dde1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java
@@ -25,10 +25,13 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for msoExceptionCategory.
+ * <p>
+ * Java class for msoExceptionCategory.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
* <p>
+ * The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ *
* <pre>
* &lt;simpleType name="msoExceptionCategory">
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
@@ -45,10 +48,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlEnum
public enum MsoExceptionCategory {
- OPENSTACK,
- IO,
- INTERNAL,
- USERDATA;
+ OPENSTACK, IO, INTERNAL, USERDATA;
public String value() {
return name();
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java
index 6830109097..3db5ca159a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java
@@ -26,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for msoRequest complex type.
+ * <p>
+ * Java class for msoRequest complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="msoRequest">
@@ -46,10 +48,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "msoRequest", propOrder = {
- "requestId",
- "serviceInstanceId"
-})
+@XmlType(name = "msoRequest", propOrder = {"requestId", "serviceInstanceId"})
public class MsoRequest {
protected String requestId;
@@ -58,10 +57,8 @@ public class MsoRequest {
/**
* Gets the value of the requestId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getRequestId() {
return requestId;
@@ -70,10 +67,8 @@ public class MsoRequest {
/**
* Sets the value of the requestId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setRequestId(String value) {
this.requestId = value;
@@ -82,10 +77,8 @@ public class MsoRequest {
/**
* Gets the value of the serviceInstanceId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getServiceInstanceId() {
return serviceInstanceId;
@@ -94,10 +87,8 @@ public class MsoRequest {
/**
* Sets the value of the serviceInstanceId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setServiceInstanceId(String value) {
this.serviceInstanceId = value;
@@ -106,7 +97,7 @@ public class MsoRequest {
@Override
public String toString() {
return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId
- + "</serviceInstanceId>";
+ + "</serviceInstanceId>";
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java
index 21bd08fae7..c84a9356b8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java
@@ -27,22 +27,18 @@ import javax.xml.namespace.QName;
/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.onap.so.adapters.vnf.async.client package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
+ * This object contains factory methods for each Java content interface and Java element interface generated in the
+ * org.onap.so.adapters.vnf.async.client package.
+ * <p>
+ * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content.
+ * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
+ * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
+ * this class.
*
*/
@XmlRegistry
public class ObjectFactory {
- private static final String VNF_NOTIFY = "http://org.onap.so/vnfNotify";
+ private static final String VNF_NOTIFY = "http://org.onap.so/vnfNotify";
private static final QName _RollbackVnfNotification_QNAME = new QName(VNF_NOTIFY, "rollbackVnfNotification");
private static final QName _DeleteVnfNotification_QNAME = new QName(VNF_NOTIFY, "deleteVnfNotification");
private static final QName _CreateVnfNotification_QNAME = new QName(VNF_NOTIFY, "createVnfNotification");
@@ -50,11 +46,11 @@ public class ObjectFactory {
private static final QName _QueryVnfNotification_QNAME = new QName(VNF_NOTIFY, "queryVnfNotification");
/**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.vnf.async.client
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
+ * org.onap.so.adapters.vnf.async.client
*
*/
- public ObjectFactory() {
- }
+ public ObjectFactory() {}
/**
* Create an instance of {@link UpdateVnfNotification }
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java
index e7496b8028..d3ac2439c1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.adapter.vnf;
import java.util.ArrayList;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -30,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for queryVnfNotification complex type.
+ * <p>
+ * Java class for queryVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="queryVnfNotification">
@@ -77,16 +78,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfExists",
- "vnfId",
- "status",
- "outputs"
-})
+@XmlType(name = "queryVnfNotification1",
+ propOrder = {"messageId", "completed", "exception", "errorMessage", "vnfExists", "vnfId", "status", "outputs"})
public class QueryVnfNotification {
@XmlElement(required = true)
@@ -102,10 +95,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -114,10 +105,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -142,10 +131,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -154,10 +141,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -166,10 +151,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -178,10 +161,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
@@ -190,10 +171,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the vnfExists property.
*
- * @return
- * possible object is
- * {@link Boolean }
- *
+ * @return possible object is {@link Boolean }
+ *
*/
public Boolean isVnfExists() {
return vnfExists;
@@ -202,10 +181,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the vnfExists property.
*
- * @param value
- * allowed object is
- * {@link Boolean }
- *
+ * @param value allowed object is {@link Boolean }
+ *
*/
public void setVnfExists(Boolean value) {
this.vnfExists = value;
@@ -214,10 +191,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the vnfId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getVnfId() {
return vnfId;
@@ -226,10 +201,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the vnfId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setVnfId(String value) {
this.vnfId = value;
@@ -238,10 +211,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the status property.
*
- * @return
- * possible object is
- * {@link VnfStatus }
- *
+ * @return possible object is {@link VnfStatus }
+ *
*/
public VnfStatus getStatus() {
return status;
@@ -250,10 +221,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the status property.
*
- * @param value
- * allowed object is
- * {@link VnfStatus }
- *
+ * @param value allowed object is {@link VnfStatus }
+ *
*/
public void setStatus(VnfStatus value) {
this.status = value;
@@ -262,10 +231,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the outputs property.
*
- * @return
- * possible object is
- * {@link QueryVnfNotification.Outputs }
- *
+ * @return possible object is {@link QueryVnfNotification.Outputs }
+ *
*/
public QueryVnfNotification.Outputs getOutputs() {
return outputs;
@@ -274,10 +241,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the outputs property.
*
- * @param value
- * allowed object is
- * {@link QueryVnfNotification.Outputs }
- *
+ * @param value allowed object is {@link QueryVnfNotification.Outputs }
+ *
*/
public void setOutputs(QueryVnfNotification.Outputs value) {
this.outputs = value;
@@ -285,9 +250,11 @@ public class QueryVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -315,9 +282,7 @@ public class QueryVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
+ @XmlType(name = "", propOrder = {"entry"})
public static class Outputs {
protected List<QueryVnfNotification.Outputs.Entry> entry;
@@ -326,21 +291,20 @@ public class QueryVnfNotification {
* Gets the value of the entry property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you
+ * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
+ * method for the entry property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getEntry().add(newItem);
+ * getEntry().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link QueryVnfNotification.Outputs.Entry }
+ * Objects of the following type(s) are allowed in the list {@link QueryVnfNotification.Outputs.Entry }
*
*
*/
@@ -350,26 +314,28 @@ public class QueryVnfNotification {
}
return this.entry;
}
-
+
// Not a generated method
public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
}
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -387,10 +353,7 @@ public class QueryVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
+ @XmlType(name = "", propOrder = {"key", "value"})
public static class Entry {
protected String key;
@@ -399,10 +362,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the key property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getKey() {
return key;
@@ -411,10 +372,8 @@ public class QueryVnfNotification {
/**
* Sets the value of the key property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setKey(String value) {
this.key = value;
@@ -423,10 +382,8 @@ public class QueryVnfNotification {
/**
* Gets the value of the value property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getValue() {
return value;
@@ -435,54 +392,44 @@ public class QueryVnfNotification {
/**
* Sets the value of the value property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setValue(String value) {
this.value = value;
}
-
+
// Not a generated method
public String toString() {
- String entry = "";
- entry =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entry;
+ String entry = "";
+ entry = "<entry>" + '\n' + " <key>" + key + "</key>" + '\n' + " <value>" + value + "</value>" + '\n'
+ + "</entry>";
+ return entry;
}
}
}
-
- // Not a generated method
- public String toString() {
- String queryVnfNotification = "";
- if (exception==null) {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- " <status>"+status+"</status>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- "</ns2:queryVnfNotification>";
- } else {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:queryVnfNotification>";
- }
- return queryVnfNotification;
- }
+
+ // Not a generated method
+ public String toString() {
+ String queryVnfNotification = "";
+ if (exception == null) {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <vnfExists>" + vnfExists + "</vnfExists>" + '\n' + " <vnfId>" + vnfId + "</vnfId>" + '\n'
+ + " <status>" + status + "</status>" + '\n' + (outputs == null ? "" : outputs.toString() + '\n')
+ + "</ns2:queryVnfNotification>";
+ } else {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + (outputs == null ? "" : outputs.toString() + '\n') + " <exception>" + exception + "</exception>"
+ + '\n' + " <errorMessage>" + errorMessage + "</errorMessage>" + '\n'
+ + "</ns2:queryVnfNotification>";
+ }
+ return queryVnfNotification;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java
index 6b143a2494..70e8199e95 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java
@@ -27,9 +27,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for rollbackVnfNotification complex type.
+ * <p>
+ * Java class for rollbackVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="rollbackVnfNotification">
@@ -49,12 +51,7 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "rollbackVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
+@XmlType(name = "rollbackVnfNotification1", propOrder = {"messageId", "completed", "exception", "errorMessage"})
public class RollbackVnfNotification {
@XmlElement(required = true)
@@ -66,10 +63,8 @@ public class RollbackVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getMessageId() {
return messageId;
@@ -78,10 +73,8 @@ public class RollbackVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setMessageId(String value) {
this.messageId = value;
@@ -106,10 +99,8 @@ public class RollbackVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
+ * @return possible object is {@link MsoExceptionCategory }
+ *
*/
public MsoExceptionCategory getException() {
return exception;
@@ -118,10 +109,8 @@ public class RollbackVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
+ * @param value allowed object is {@link MsoExceptionCategory }
+ *
*/
public void setException(MsoExceptionCategory value) {
this.exception = value;
@@ -130,10 +119,8 @@ public class RollbackVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getErrorMessage() {
return errorMessage;
@@ -142,34 +129,29 @@ public class RollbackVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setErrorMessage(String value) {
this.errorMessage = value;
}
-
+
public String toString() {
- String rollbackVnfNotification = "";
- if (exception==null) {
- rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:rollbackVnfNotification>";
- } else {
- rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:rollbackVnfNotification>";
- }
- return rollbackVnfNotification;
+ String rollbackVnfNotification = "";
+ if (exception == null) {
+ rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + "</ns2:rollbackVnfNotification>";
+ } else {
+ rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <exception>" + exception + "</exception>" + '\n' + " <errorMessage>" + errorMessage
+ + "</errorMessage>" + '\n' + "</ns2:rollbackVnfNotification>";
+ }
+ return rollbackVnfNotification;
}
-
- }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java
index b89135b865..dd86f340a2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.adapter.vnf;
import java.util.ArrayList;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -30,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for updateVnfNotification complex type.
+ * <p>
+ * Java class for updateVnfNotification complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="updateVnfNotification">
@@ -75,14 +76,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "updateVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "outputs",
- "rollback"
-})
+@XmlType(name = "updateVnfNotification1",
+ propOrder = {"messageId", "completed", "exception", "errorMessage", "outputs", "rollback"})
public class UpdateVnfNotification {
@XmlElement(required = true)
@@ -96,9 +91,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the messageId property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getMessageId() {
@@ -108,9 +101,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the messageId property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setMessageId(String value) {
@@ -136,9 +127,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the exception property.
*
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
+ * @return possible object is {@link MsoExceptionCategory }
*
*/
public MsoExceptionCategory getException() {
@@ -148,9 +137,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the exception property.
*
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
+ * @param value allowed object is {@link MsoExceptionCategory }
*
*/
public void setException(MsoExceptionCategory value) {
@@ -160,9 +147,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the errorMessage property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getErrorMessage() {
@@ -172,9 +157,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the errorMessage property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setErrorMessage(String value) {
@@ -184,9 +167,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the outputs property.
*
- * @return
- * possible object is
- * {@link UpdateVnfNotification.Outputs }
+ * @return possible object is {@link UpdateVnfNotification.Outputs }
*
*/
public UpdateVnfNotification.Outputs getOutputs() {
@@ -196,9 +177,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the outputs property.
*
- * @param value
- * allowed object is
- * {@link UpdateVnfNotification.Outputs }
+ * @param value allowed object is {@link UpdateVnfNotification.Outputs }
*
*/
public void setOutputs(UpdateVnfNotification.Outputs value) {
@@ -208,9 +187,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the rollback property.
*
- * @return
- * possible object is
- * {@link VnfRollback }
+ * @return possible object is {@link VnfRollback }
*
*/
public VnfRollback getRollback() {
@@ -220,9 +197,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the rollback property.
*
- * @param value
- * allowed object is
- * {@link VnfRollback }
+ * @param value allowed object is {@link VnfRollback }
*
*/
public void setRollback(VnfRollback value) {
@@ -231,9 +206,11 @@ public class UpdateVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -261,9 +238,7 @@ public class UpdateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
+ @XmlType(name = "", propOrder = {"entry"})
public static class Outputs {
protected List<UpdateVnfNotification.Outputs.Entry> entry;
@@ -272,21 +247,20 @@ public class UpdateVnfNotification {
* Gets the value of the entry property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you
+ * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
+ * method for the entry property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getEntry().add(newItem);
+ * getEntry().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link UpdateVnfNotification.Outputs.Entry }
+ * Objects of the following type(s) are allowed in the list {@link UpdateVnfNotification.Outputs.Entry }
*
*
*/
@@ -299,9 +273,11 @@ public class UpdateVnfNotification {
/**
- * <p>Java class for anonymous complex type.
+ * <p>
+ * Java class for anonymous complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
@@ -319,10 +295,7 @@ public class UpdateVnfNotification {
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
+ @XmlType(name = "", propOrder = {"key", "value"})
public static class Entry {
protected String key;
@@ -331,9 +304,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the key property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getKey() {
@@ -343,9 +314,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the key property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setKey(String value) {
@@ -355,9 +324,7 @@ public class UpdateVnfNotification {
/**
* Gets the value of the value property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getValue() {
@@ -367,9 +334,7 @@ public class UpdateVnfNotification {
/**
* Sets the value of the value property.
*
- * @param value
- * allowed object is
- * {@link String }
+ * @param value allowed object is {@link String }
*
*/
public void setValue(String value) {
@@ -377,36 +342,30 @@ public class UpdateVnfNotification {
}
public String toString() {
- String entry = "";
- entry =
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>";
- return entry;
+ String entry = "";
+ entry = " <key>" + key + "</key>" + '\n' + " <value>" + value + "</value>";
+ return entry;
}
}
}
- public String toString(){
- String updateVnfNotification = "";
- if (exception==null) {
- updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <rollback>"+rollback+"</rollback>" + '\n' +
- "</ns2:updateVnfNotification>";
- } else {
- updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:updateVnfNotification>";
- }
-
- return updateVnfNotification;
+ public String toString() {
+ String updateVnfNotification = "";
+ if (exception == null) {
+ updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <rollback>" + rollback + "</rollback>" + '\n' + "</ns2:updateVnfNotification>";
+ } else {
+ updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n'
+ + " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + " <messageId>"
+ + messageId + "</messageId>" + '\n' + " <completed>" + completed + "</completed>" + '\n'
+ + " <exception>" + exception + "</exception>" + '\n' + " <errorMessage>" + errorMessage
+ + "</errorMessage>" + '\n' + "</ns2:updateVnfNotification>";
+ }
+
+ return updateVnfNotification;
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java
index adedca9ac5..1390b82c50 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java
@@ -30,15 +30,11 @@ import javax.xml.ws.RequestWrapper;
/**
- * This class was generated by the JAX-WS RI.
- * JAX-WS RI 2.2.8
- * Generated source version: 2.2
+ * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.8 Generated source version: 2.2
*
*/
@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
-@XmlSeeAlso({
- ObjectFactory.class
-})
+@XmlSeeAlso({ObjectFactory.class})
public interface VnfAdapterNotify {
@@ -51,17 +47,13 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
+ @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
- public void rollbackVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage);
+ public void rollbackVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage);
/**
*
@@ -76,25 +68,17 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
+ @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
- public void queryVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfExists", targetNamespace = "")
- Boolean vnfExists,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "status", targetNamespace = "")
- VnfStatus status,
- @WebParam(name = "outputs", targetNamespace = "")
- org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs);
+ public void queryVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
+ @WebParam(name = "vnfExists", targetNamespace = "") Boolean vnfExists,
+ @WebParam(name = "vnfId", targetNamespace = "") String vnfId,
+ @WebParam(name = "status", targetNamespace = "") VnfStatus status, @WebParam(name = "outputs",
+ targetNamespace = "") org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs);
/**
*
@@ -108,23 +92,17 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
+ @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
- public void createVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "outputs", targetNamespace = "")
- org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback);
+ public void createVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
+ @WebParam(name = "vnfId", targetNamespace = "") String vnfId,
+ @WebParam(name = "outputs",
+ targetNamespace = "") org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback);
/**
*
@@ -137,21 +115,16 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
+ @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
- public void updateVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "outputs", targetNamespace = "")
- org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback);
+ public void updateVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
+ @WebParam(name = "outputs",
+ targetNamespace = "") org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback);
/**
*
@@ -162,16 +135,12 @@ public interface VnfAdapterNotify {
*/
@WebMethod
@Oneway
- @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
+ @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
- public void deleteVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage);
+ public void deleteVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage);
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java
index 667545d855..531b6d572e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java
@@ -30,24 +30,24 @@ import javax.xml.ws.WebServiceFeature;
/**
- * This class was generated by the JAX-WS RI.
- * JAX-WS RI 2.2.8
- * Generated source version: 2.2
+ * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.8 Generated source version: 2.2
*
*/
-@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl")
-public class VnfAdapterNotify_Service extends Service
-{
+@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify",
+ wsdlLocation = "/VnfAdapterNotify.wsdl")
+public class VnfAdapterNotify_Service extends Service {
private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION;
private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION;
private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify");
static {
- VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl");
+ VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class
+ .getResource("/VnfAdapterNotify.wsdl");
WebServiceException e = null;
if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) {
- e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath.");
+ e = new WebServiceException(
+ "Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath.");
}
VNFADAPTERNOTIFY_EXCEPTION = e;
}
@@ -78,28 +78,28 @@ public class VnfAdapterNotify_Service extends Service
/**
*
- * @return
- * returns VnfAdapterNotify
+ * @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class);
+ return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
+ VnfAdapterNotify.class);
}
/**
*
- * @param features
- * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
- * @return
- * returns VnfAdapterNotify
+ * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features
+ * not in the <code>features</code> parameter will have their default values.
+ * @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features);
+ return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
+ VnfAdapterNotify.class, features);
}
private static URL __getWsdlLocation() {
- if (VNFADAPTERNOTIFY_EXCEPTION!= null) {
+ if (VNFADAPTERNOTIFY_EXCEPTION != null) {
throw VNFADAPTERNOTIFY_EXCEPTION;
}
return VNFADAPTERNOTIFY_WSDL_LOCATION;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
index 9fd3bc596f..1e02c0d07c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
@@ -26,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for vnfRollback complex type.
+ * <p>
+ * Java class for vnfRollback complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="vnfRollback">
@@ -51,15 +53,8 @@ import javax.xml.bind.annotation.XmlType;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "vnfRollback", propOrder = {
- "cloudSiteId",
- "cloudOwner",
- "msoRequest",
- "tenantCreated",
- "tenantId",
- "vnfCreated",
- "vnfId"
-})
+@XmlType(name = "vnfRollback",
+ propOrder = {"cloudSiteId", "cloudOwner", "msoRequest", "tenantCreated", "tenantId", "vnfCreated", "vnfId"})
public class VnfRollback {
protected String cloudSiteId;
@@ -73,10 +68,8 @@ public class VnfRollback {
/**
* Gets the value of the cloudSiteId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getCloudSiteId() {
return cloudSiteId;
@@ -85,10 +78,8 @@ public class VnfRollback {
/**
* Sets the value of the cloudSiteId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setCloudSiteId(String value) {
this.cloudSiteId = value;
@@ -97,10 +88,8 @@ public class VnfRollback {
/**
* Gets the value of the cloudOwner property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getCloudOwner() {
return cloudOwner;
@@ -109,10 +98,8 @@ public class VnfRollback {
/**
* Sets the value of the cloudOwner property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setCloudOwner(String value) {
this.cloudOwner = value;
@@ -121,10 +108,8 @@ public class VnfRollback {
/**
* Gets the value of the msoRequest property.
*
- * @return
- * possible object is
- * {@link MsoRequest }
- *
+ * @return possible object is {@link MsoRequest }
+ *
*/
public MsoRequest getMsoRequest() {
return msoRequest;
@@ -133,10 +118,8 @@ public class VnfRollback {
/**
* Sets the value of the msoRequest property.
*
- * @param value
- * allowed object is
- * {@link MsoRequest }
- *
+ * @param value allowed object is {@link MsoRequest }
+ *
*/
public void setMsoRequest(MsoRequest value) {
this.msoRequest = value;
@@ -161,10 +144,8 @@ public class VnfRollback {
/**
* Gets the value of the tenantId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getTenantId() {
return tenantId;
@@ -173,10 +154,8 @@ public class VnfRollback {
/**
* Sets the value of the tenantId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setTenantId(String value) {
this.tenantId = value;
@@ -201,10 +180,8 @@ public class VnfRollback {
/**
* Gets the value of the vnfId property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public String getVnfId() {
return vnfId;
@@ -213,26 +190,19 @@ public class VnfRollback {
/**
* Sets the value of the vnfId property.
*
- * @param value
- * allowed object is
- * {@link String }
- *
+ * @param value allowed object is {@link String }
+ *
*/
public void setVnfId(String value) {
this.vnfId = value;
}
-
+
public String toString() {
- String msoRequestElement = msoRequest == null ? ""
- : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n';
-
- return
- "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' +
- "<cloudOwner>"+cloudOwner+"</cloudOwner>" + '\n' +
- msoRequestElement +
- "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' +
- "<tenantId>"+tenantId+"</tenantId>" + '\n' +
- "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' +
- "<vnfId>"+vnfId+"</vnfId>";
+ String msoRequestElement = msoRequest == null ? "" : "<msoRequest>" + msoRequest + "</msoRequest>" + '\n';
+
+ return "<cloudSiteId>" + cloudSiteId + "</cloudSiteId>" + '\n' + "<cloudOwner>" + cloudOwner + "</cloudOwner>"
+ + '\n' + msoRequestElement + "<tenantCreated>" + tenantCreated + "</tenantCreated>" + '\n'
+ + "<tenantId>" + tenantId + "</tenantId>" + '\n' + "<vnfCreated>" + vnfCreated + "</vnfCreated>" + '\n'
+ + "<vnfId>" + vnfId + "</vnfId>";
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java
index d093f79e03..007b5ab487 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java
@@ -25,10 +25,13 @@ import javax.xml.bind.annotation.XmlType;
/**
- * <p>Java class for vnfStatus.
+ * <p>
+ * Java class for vnfStatus.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
* <p>
+ * The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ *
* <pre>
* &lt;simpleType name="vnfStatus">
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
@@ -45,10 +48,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlEnum
public enum VnfStatus {
- ACTIVE,
- FAILED,
- NOTFOUND,
- UNKNOWN;
+ ACTIVE, FAILED, NOTFOUND, UNKNOWN;
public String value() {
return name();
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
index 46a6fa3ef3..7c0c2f20b3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
import org.camunda.bpm.engine.OptimisticLockingException;
import org.camunda.bpm.engine.RuntimeService;
@@ -46,372 +45,354 @@ import org.springframework.stereotype.Service;
*/
@Service
public class CallbackHandlerService {
- public static final long DEFAULT_TIMEOUT_SECONDS = 60;
- public static final long FAST_POLL_DUR_SECONDS = 5;
- public static final long FAST_POLL_INT_MS = 100;
- public static final long SLOW_POLL_INT_MS = 1000;
-
- private static final Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class);
-
- private RuntimeService runtimeService;
-
- @Autowired
- public CallbackHandlerService(RuntimeService runtimeService) {
- this.runtimeService = runtimeService;
- }
-
- /**
- * Parameterized callback handler.
- */
- @Async
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker) {
-
- return handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker, null);
- }
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker, Map<String, Object> injectedVariables) {
-
- long startTime = System.currentTimeMillis();
-
- logger.debug(logMarker + " " + method + " received message: "
- + (message == null ? "" : System.lineSeparator()) + message);
-
- try {
- Map<String, Object> variables = new HashMap<>();
-
- if (injectedVariables != null) {
- variables.putAll(injectedVariables);
- }
-
- variables.put(correlationVariable, correlationValue);
- variables.put(messageVariable, message == null ? null : message.toString());
-
- boolean ok = correlate(messageEventName, correlationVariable,
- correlationValue, variables, logMarker);
-
- if (!ok) {
- String msg = "No process is waiting for " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
-
- logCallbackSuccess(method, startTime);
- return new CallbackSuccess();
- } catch (Exception e) {
- logger.debug("Exception :",e);
- String msg = "Caught " + e.getClass().getSimpleName()
- + " processing " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
- }
-
- /**
- * Performs message correlation. Waits a limited amount of time for
- * a process to become ready for correlation. The return value indicates
- * whether or not a process was found to receive the message. Due to the
- * synchronous nature of message injection in Camunda, by the time this
- * method returns, one of 3 things will have happened: (1) the process
- * received the message and ended, (2) the process received the message
- * and reached an activity that suspended, or (3) an exception occurred
- * during correlation or while the process was executing. Correlation
- * exceptions are handled differently from process execution exceptions.
- * Correlation exceptions are thrown so the client knows something went
- * wrong with the delivery of the message. Process execution exceptions
- * are logged but not thrown.
- * @param messageEventName the message event name
- * @param correlationVariable the process variable used as the correlator
- * @param correlationValue the correlation value
- * @param variables variables to inject into the process
- * @param logMarker a marker for debug logging
- * @return true if a process could be found, false if not
- */
- protected boolean correlate(String messageEventName, String correlationVariable,
- String correlationValue, Map<String, Object> variables, String logMarker) {
- try{
- logger.debug(logMarker + " Attempting to find process waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'");
-
-
-
- long timeout = DEFAULT_TIMEOUT_SECONDS;
-
- // The code is here in case we ever need to change the default.
- String correlationTimemout = UrnPropertiesReader.getVariable("mso.correlation.timeout");
- if (correlationTimemout != null) {
- try {
- timeout = Long.parseLong(correlationTimemout);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- long now = System.currentTimeMillis();
- long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
- long endTime = now + (timeout * 1000);
- long sleep = FAST_POLL_INT_MS;
-
- List<Execution> waitingProcesses = null;
- Exception queryException = null;
- int queryCount = 0;
- int queryFailCount = 0;
-
- while (true) {
- try {
- ++queryCount;
- waitingProcesses = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName(messageEventName)
- .processVariableValueEquals(correlationVariable, correlationValue)
- .list();
- } catch (Exception e) {
- ++queryFailCount;
- queryException = e;
- }
-
- if (waitingProcesses != null && waitingProcesses.size() > 0) {
- break;
- }
-
- if (now > endTime - sleep) {
- break;
- }
-
- Thread.sleep(sleep);
- now = System.currentTimeMillis();
-
- if (now > fastPollEndTime) {
- sleep = SLOW_POLL_INT_MS;
- }
- }
-
- if (waitingProcesses == null) {
- waitingProcesses = new ArrayList<Execution>(0);
- }
-
- int count = waitingProcesses.size();
-
- List<ExecInfo> execInfoList = new ArrayList<>(count);
- for (Execution execution : waitingProcesses) {
- execInfoList.add(new ExecInfo(execution));
- }
-
- logger.debug(logMarker + " Found " + count + " process(es) waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "': " + execInfoList);
-
- if (count == 0) {
- if (queryFailCount > 0) {
- String msg = queryFailCount + "/" + queryCount
- + " execution queries failed attempting to correlate "
- + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'; last exception was:"
- + queryException;
- logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), msg, queryException);
- }
-
- return false;
- }
-
- if (count > 1) {
- // Only one process should be waiting. Throw an exception back to the client.
- throw new MismatchingMessageCorrelationException(messageEventName,
- "more than 1 process is waiting with " + correlationVariable
- + " = '" + correlationValue + "'");
- }
-
- // We prototyped an asynchronous solution, i.e. resuming the process
- // flow in a separate thread, but this affected too many existing tests,
- // and we went back to the synchronous solution. The synchronous solution
- // has some troublesome characteristics though. For example, the
- // resumed flow may send request #2 to a remote system before MSO has
- // acknowledged the notification associated with request #1.
-
- try {
- logger.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
- + messageEventName + " with " + correlationVariable + " = '"
- + correlationValue + "'");
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
-
- } catch (MismatchingMessageCorrelationException e) {
- // A correlation exception occurred even after we identified
- // one waiting process. Throw it back to the client.
- throw e;
- } catch (OptimisticLockingException ole) {
-
- String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + ole;
- logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- ErrorCode.UnknownError.getValue(), msg, ole);
-
- //Retry for OptimisticLocking Exceptions
- int retryCount = 0;
- String retryStr = UrnPropertiesReader.getVariable("mso.bpmn.optimisticlockingexception.retrycount");
- if (retryStr != null) {
- try {
- retryCount = Integer.parseInt(retryStr);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- logger.debug("Retry correlate for OptimisticLockingException, retryCount:{}", retryCount);
-
- for (; retryCount >0 ; retryCount--) {
-
- try{
- Thread.sleep(SLOW_POLL_INT_MS);
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
- retryCount = 0;
- logger.debug("OptimisticLockingException retry was successful, seting retryCount: {}", retryCount);
- } catch (OptimisticLockingException olex) {
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
- logger.debug(strMsg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), strMsg, olex);
- } catch (Exception excep) {
- retryCount = 0;
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
- logger.debug(strMsg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), strMsg, excep);
- }
-
- }
-
- }catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " running "
- + execInfoList.get(0) + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), msg, e);
- }
- } catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- ErrorCode.UnknownError.getValue(), msg, e);
- }
-
- return true;
- }
-
- /**
- * Records audit and metric events in the log for a callback success.
- * @param method the method name
- * @param startTime the request start time
- */
- protected void logCallbackSuccess(String method, long startTime) {
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- */
- protected void logCallbackError(String method, long startTime, String msg) {
- logCallbackError(method, startTime, msg, null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- * @param e the exception
- */
- protected void logCallbackError(String method, long startTime, String msg, Exception e) {
- if (e == null) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), msg);
- } else {
- logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
- ErrorCode.UnknownError.getValue(), msg, e);
- }
- }
-
- /**
- * Abstract callback result object.
- */
- protected abstract class CallbackResult {
- }
-
- /**
- * Indicates that callback handling was successful.
- */
- protected class CallbackSuccess extends CallbackResult {
- }
-
- /**
- * Indicates that callback handling failed.
- */
- protected class CallbackError extends CallbackResult {
- private final String errorMessage;
-
- public CallbackError(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- /**
- * Gets the error message.
- */
- public String getErrorMessage() {
- return errorMessage;
- }
- }
-
- private static class ExecInfo {
- private final Execution execution;
-
- public ExecInfo(Execution execution) {
- this.execution = execution;
- }
-
- @Override
- public String toString() {
- return "Process[" + execution.getProcessInstanceId()
- + ":" + execution.getId() + "]";
- }
- }
+ public static final long DEFAULT_TIMEOUT_SECONDS = 60;
+ public static final long FAST_POLL_DUR_SECONDS = 5;
+ public static final long FAST_POLL_INT_MS = 100;
+ public static final long SLOW_POLL_INT_MS = 1000;
+
+ private static final Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class);
+
+ private RuntimeService runtimeService;
+
+ @Autowired
+ public CallbackHandlerService(RuntimeService runtimeService) {
+ this.runtimeService = runtimeService;
+ }
+
+ /**
+ * Parameterized callback handler.
+ */
+ @Async
+ protected CallbackResult handleCallback(String method, Object message, String messageEventName,
+ String messageVariable, String correlationVariable, String correlationValue, String logMarker) {
+
+ return handleCallback(method, message, messageEventName, messageVariable, correlationVariable, correlationValue,
+ logMarker, null);
+ }
+
+ /**
+ * Parameterized callback handler.
+ */
+ protected CallbackResult handleCallback(String method, Object message, String messageEventName,
+ String messageVariable, String correlationVariable, String correlationValue, String logMarker,
+ Map<String, Object> injectedVariables) {
+
+ long startTime = System.currentTimeMillis();
+
+ logger.debug(logMarker + " " + method + " received message: " + (message == null ? "" : System.lineSeparator())
+ + message);
+
+ try {
+ Map<String, Object> variables = new HashMap<>();
+
+ if (injectedVariables != null) {
+ variables.putAll(injectedVariables);
+ }
+
+ variables.put(correlationVariable, correlationValue);
+ variables.put(messageVariable, message == null ? null : message.toString());
+
+ boolean ok = correlate(messageEventName, correlationVariable, correlationValue, variables, logMarker);
+
+ if (!ok) {
+ String msg = "No process is waiting for " + messageEventName + " with " + correlationVariable + " = '"
+ + correlationValue + "'";
+ logCallbackError(method, startTime, msg);
+ return new CallbackError(msg);
+ }
+
+ logCallbackSuccess(method, startTime);
+ return new CallbackSuccess();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ String msg = "Caught " + e.getClass().getSimpleName() + " processing " + messageEventName + " with "
+ + correlationVariable + " = '" + correlationValue + "'";
+ logCallbackError(method, startTime, msg);
+ return new CallbackError(msg);
+ }
+ }
+
+ /**
+ * Performs message correlation. Waits a limited amount of time for a process to become ready for correlation. The
+ * return value indicates whether or not a process was found to receive the message. Due to the synchronous nature
+ * of message injection in Camunda, by the time this method returns, one of 3 things will have happened: (1) the
+ * process received the message and ended, (2) the process received the message and reached an activity that
+ * suspended, or (3) an exception occurred during correlation or while the process was executing. Correlation
+ * exceptions are handled differently from process execution exceptions. Correlation exceptions are thrown so the
+ * client knows something went wrong with the delivery of the message. Process execution exceptions are logged but
+ * not thrown.
+ *
+ * @param messageEventName the message event name
+ * @param correlationVariable the process variable used as the correlator
+ * @param correlationValue the correlation value
+ * @param variables variables to inject into the process
+ * @param logMarker a marker for debug logging
+ * @return true if a process could be found, false if not
+ */
+ protected boolean correlate(String messageEventName, String correlationVariable, String correlationValue,
+ Map<String, Object> variables, String logMarker) {
+ try {
+ logger.debug(logMarker + " Attempting to find process waiting" + " for " + messageEventName + " with "
+ + correlationVariable + " = '" + correlationValue + "'");
+
+
+
+ long timeout = DEFAULT_TIMEOUT_SECONDS;
+
+ // The code is here in case we ever need to change the default.
+ String correlationTimemout = UrnPropertiesReader.getVariable("mso.correlation.timeout");
+ if (correlationTimemout != null) {
+ try {
+ timeout = Long.parseLong(correlationTimemout);
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+
+ long now = System.currentTimeMillis();
+ long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
+ long endTime = now + (timeout * 1000);
+ long sleep = FAST_POLL_INT_MS;
+
+ List<Execution> waitingProcesses = null;
+ Exception queryException = null;
+ int queryCount = 0;
+ int queryFailCount = 0;
+
+ while (true) {
+ try {
+ ++queryCount;
+ waitingProcesses =
+ runtimeService.createExecutionQuery().messageEventSubscriptionName(messageEventName)
+ .processVariableValueEquals(correlationVariable, correlationValue).list();
+ } catch (Exception e) {
+ ++queryFailCount;
+ queryException = e;
+ }
+
+ if (waitingProcesses != null && waitingProcesses.size() > 0) {
+ break;
+ }
+
+ if (now > endTime - sleep) {
+ break;
+ }
+
+ Thread.sleep(sleep);
+ now = System.currentTimeMillis();
+
+ if (now > fastPollEndTime) {
+ sleep = SLOW_POLL_INT_MS;
+ }
+ }
+
+ if (waitingProcesses == null) {
+ waitingProcesses = new ArrayList<Execution>(0);
+ }
+
+ int count = waitingProcesses.size();
+
+ List<ExecInfo> execInfoList = new ArrayList<>(count);
+ for (Execution execution : waitingProcesses) {
+ execInfoList.add(new ExecInfo(execution));
+ }
+
+ logger.debug(logMarker + " Found " + count + " process(es) waiting" + " for " + messageEventName + " with "
+ + correlationVariable + " = '" + correlationValue + "': " + execInfoList);
+
+ if (count == 0) {
+ if (queryFailCount > 0) {
+ String msg =
+ queryFailCount + "/" + queryCount + " execution queries failed attempting to correlate "
+ + messageEventName + " with " + correlationVariable + " = '" + correlationValue
+ + "'; last exception was:" + queryException;
+ logger.debug(msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), msg, queryException);
+ }
+
+ return false;
+ }
+
+ if (count > 1) {
+ // Only one process should be waiting. Throw an exception back to the client.
+ throw new MismatchingMessageCorrelationException(messageEventName,
+ "more than 1 process is waiting with " + correlationVariable + " = '" + correlationValue + "'");
+ }
+
+ // We prototyped an asynchronous solution, i.e. resuming the process
+ // flow in a separate thread, but this affected too many existing tests,
+ // and we went back to the synchronous solution. The synchronous solution
+ // has some troublesome characteristics though. For example, the
+ // resumed flow may send request #2 to a remote system before MSO has
+ // acknowledged the notification associated with request #1.
+
+ try {
+ logger.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue + "'");
+
+ @SuppressWarnings("unused")
+ MessageCorrelationResult result = runtimeService.createMessageCorrelation(messageEventName)
+ .setVariables(variables).processInstanceVariableEquals(correlationVariable, correlationValue)
+ .correlateWithResult();
+
+ } catch (MismatchingMessageCorrelationException e) {
+ // A correlation exception occurred even after we identified
+ // one waiting process. Throw it back to the client.
+ throw e;
+ } catch (OptimisticLockingException ole) {
+
+ String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue + "': " + ole;
+ logger.debug(msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ ErrorCode.UnknownError.getValue(), msg, ole);
+
+ // Retry for OptimisticLocking Exceptions
+ int retryCount = 0;
+ String retryStr = UrnPropertiesReader.getVariable("mso.bpmn.optimisticlockingexception.retrycount");
+ if (retryStr != null) {
+ try {
+ retryCount = Integer.parseInt(retryStr);
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+
+ logger.debug("Retry correlate for OptimisticLockingException, retryCount:{}", retryCount);
+
+ for (; retryCount > 0; retryCount--) {
+
+ try {
+ Thread.sleep(SLOW_POLL_INT_MS);
+
+ @SuppressWarnings("unused")
+ MessageCorrelationResult result =
+ runtimeService.createMessageCorrelation(messageEventName).setVariables(variables)
+ .processInstanceVariableEquals(correlationVariable, correlationValue)
+ .correlateWithResult();
+ retryCount = 0;
+ logger.debug("OptimisticLockingException retry was successful, seting retryCount: {}",
+ retryCount);
+ } catch (OptimisticLockingException olex) {
+ // oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
+ String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:"
+ + retryCount + " | exception returned: " + olex;
+ logger.debug(strMsg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), strMsg, olex);
+ } catch (Exception excep) {
+ retryCount = 0;
+ // oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
+ String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:"
+ + retryCount + " | exception returned: " + excep;
+ logger.debug(strMsg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), strMsg, excep);
+ }
+
+ }
+
+ } catch (Exception e) {
+ // This must be an exception from the flow itself. Log it, but don't
+ // report it back to the client.
+ String msg = "Caught " + e.getClass().getSimpleName() + " running " + execInfoList.get(0)
+ + " after receiving " + messageEventName + " with " + correlationVariable + " = '"
+ + correlationValue + "': " + e;
+ logger.debug(msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), msg, e);
+ }
+ } catch (Exception e) {
+ // This must be an exception from the flow itself. Log it, but don't
+ // report it back to the client.
+ String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with "
+ + correlationVariable + " = '" + correlationValue + "': " + e;
+ logger.debug(msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ ErrorCode.UnknownError.getValue(), msg, e);
+ }
+
+ return true;
+ }
+
+ /**
+ * Records audit and metric events in the log for a callback success.
+ *
+ * @param method the method name
+ * @param startTime the request start time
+ */
+ protected void logCallbackSuccess(String method, long startTime) {}
+
+ /**
+ * Records error, audit and metric events in the log for a callback internal error.
+ *
+ * @param method the method name
+ * @param startTime the request start time
+ * @param msg the error message
+ */
+ protected void logCallbackError(String method, long startTime, String msg) {
+ logCallbackError(method, startTime, msg, null);
+ }
+
+ /**
+ * Records error, audit and metric events in the log for a callback internal error.
+ *
+ * @param method the method name
+ * @param startTime the request start time
+ * @param msg the error message
+ * @param e the exception
+ */
+ protected void logCallbackError(String method, long startTime, String msg, Exception e) {
+ if (e == null) {
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), msg);
+ } else {
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
+ ErrorCode.UnknownError.getValue(), msg, e);
+ }
+ }
+
+ /**
+ * Abstract callback result object.
+ */
+ protected abstract class CallbackResult {
+ }
+
+ /**
+ * Indicates that callback handling was successful.
+ */
+ protected class CallbackSuccess extends CallbackResult {
+ }
+
+ /**
+ * Indicates that callback handling failed.
+ */
+ protected class CallbackError extends CallbackResult {
+ private final String errorMessage;
+
+ public CallbackError(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ * Gets the error message.
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+ }
+
+ private static class ExecInfo {
+ private final Execution execution;
+
+ public ExecInfo(Execution execution) {
+ this.execution = execution;
+ }
+
+ @Override
+ public String toString() {
+ return "Process[" + execution.getProcessInstanceId() + ":" + execution.getId() + "]";
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
index 8ceb1c1277..1134bc052b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
@@ -22,45 +22,45 @@
package org.onap.so.bpmn.common.workflow.service;
import java.util.Optional;
-
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.ProcessEngines;
import org.springframework.stereotype.Service;
/**
- * Base class for services that must be process-engine aware. The only
- * process engine currently supported is the "default" process engine.
+ * Base class for services that must be process-engine aware. The only process engine currently supported is the
+ * "default" process engine.
*/
@Service
public class ProcessEngineAwareService {
-
- private final String processEngineName = "default";
- private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty();
-
- /**
- * Gets the process engine name.
- * @return the process engine name
- */
- public String getProcessEngineName() {
- return processEngineName;
- }
- /**
- * Gets process engine services.
- * @return process engine services
- */
- public ProcessEngineServices getProcessEngineServices() {
- return pes4junit.orElse(ProcessEngines.getProcessEngine(
- getProcessEngineName()));
- }
+ private final String processEngineName = "default";
+ private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty();
+
+ /**
+ * Gets the process engine name.
+ *
+ * @return the process engine name
+ */
+ public String getProcessEngineName() {
+ return processEngineName;
+ }
+
+ /**
+ * Gets process engine services.
+ *
+ * @return process engine services
+ */
+ public ProcessEngineServices getProcessEngineServices() {
+ return pes4junit.orElse(ProcessEngines.getProcessEngine(getProcessEngineName()));
+ }
- /**
- * Allows a particular process engine to be specified, overriding the
- * usual process engine lookup by name. Intended primarily for the
- * unit test environment.
- * @param pes process engine services
- */
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = Optional.ofNullable(pes);
- }
+ /**
+ * Allows a particular process engine to be specified, overriding the usual process engine lookup by name. Intended
+ * primarily for the unit test environment.
+ *
+ * @param pes process engine services
+ */
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = Optional.ofNullable(pes);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
index a74bdfc649..b81506ead9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
@@ -28,7 +28,6 @@ import javax.jws.WebResult;
import javax.jws.WebService;
import javax.ws.rs.core.Context;
import javax.xml.ws.WebServiceContext;
-
import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
@@ -40,50 +39,53 @@ import org.springframework.stereotype.Service;
/**
* Implementation of SDNCAdapterCallbackService.
*/
-@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@WebService(serviceName = "SDNCAdapterCallbackService",
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
@Service
public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService implements SDNCCallbackAdapterPortType {
- private final static String logMarker = "[SDNC-CALLBACK]";
+ private final static String logMarker = "[SDNC-CALLBACK]";
+
+ @Context
+ WebServiceContext wsContext;
- @Context WebServiceContext wsContext;
-
- @Autowired
- CallbackHandlerService callback;
+ @Autowired
+ CallbackHandlerService callback;
- @WebMethod(operationName = "SDNCAdapterCallback")
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
- public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
+ @WebMethod(operationName = "SDNCAdapterCallback")
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1",
+ partName = "SDNCAdapterCallbackResponse")
+ public SDNCAdapterResponse sdncAdapterCallback(@WebParam(name = "SDNCAdapterCallbackRequest",
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1",
+ partName = "SDNCAdapterCallbackRequest") SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
- String method = "sdncAdapterCallback";
- Object message = sdncAdapterCallbackRequest;
- String messageEventName = "sdncAdapterCallbackRequest";
- String messageVariable = "sdncAdapterCallbackRequest";
- String correlationVariable = "SDNCA_requestId";
- String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
+ String method = "sdncAdapterCallback";
+ Object message = sdncAdapterCallbackRequest;
+ String messageEventName = "sdncAdapterCallbackRequest";
+ String messageVariable = "sdncAdapterCallbackRequest";
+ String correlationVariable = "SDNCA_requestId";
+ String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- CallbackResult result = callback.handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, logMarker);
+ CallbackResult result = callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
- if (result instanceof CallbackError) {
- return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
- } else {
- return new SDNCAdapterResponse();
- }
- }
+ if (result instanceof CallbackError) {
+ return new SDNCAdapterErrorResponse(((CallbackError) result).getErrorMessage());
+ } else {
+ return new SDNCAdapterResponse();
+ }
+ }
- // This subclass allows unit tests to extract the error
- public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
- private String error;
+ // This subclass allows unit tests to extract the error
+ public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
+ private String error;
- public SDNCAdapterErrorResponse(String error) {
- this.error = error;
- }
+ public SDNCAdapterErrorResponse(String error) {
+ this.error = error;
+ }
- public String getError() {
- return error;
- }
- }
+ public String getError() {
+ return error;
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index ed524c115e..5f70ab5924 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -30,7 +30,6 @@ import javax.ws.rs.core.Context;
import javax.xml.ws.Action;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.WebServiceContext;
-
import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
@@ -48,195 +47,167 @@ import org.springframework.stereotype.Service;
*/
@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
@Service
-public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
+public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify {
+
+ private final String logMarker = "[VNF-NOTIFY]";
- private final String logMarker = "[VNF-NOTIFY]";
-
- @Autowired
- CallbackHandlerService callback;
+ @Autowired
+ CallbackHandlerService callback;
- @Context WebServiceContext wsContext;
+ @Context
+ WebServiceContext wsContext;
@WebMethod(operationName = "rollbackVnfNotification")
@Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
+ @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
- public void rollbackVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
-
- rollbackVnfNotification.setMessageId(messageId);
- rollbackVnfNotification.setCompleted(completed);
- rollbackVnfNotification.setException(exception);
- rollbackVnfNotification.setErrorMessage(errorMessage);
-
- String method = "rollbackVnfNotification";
- Object message = rollbackVnfNotification;
- String messageEventName = "rollbackVnfNotificationCallback";
- String messageVariable = "rollbackVnfNotificationCallback";
- String correlationVariable = "VNFRB_messageId";
- String correlationValue = messageId;
-
- callback.handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
+ public void rollbackVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage) {
+
+ RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
+
+ rollbackVnfNotification.setMessageId(messageId);
+ rollbackVnfNotification.setCompleted(completed);
+ rollbackVnfNotification.setException(exception);
+ rollbackVnfNotification.setErrorMessage(errorMessage);
+
+ String method = "rollbackVnfNotification";
+ Object message = rollbackVnfNotification;
+ String messageEventName = "rollbackVnfNotificationCallback";
+ String messageVariable = "rollbackVnfNotificationCallback";
+ String correlationVariable = "VNFRB_messageId";
+ String correlationValue = messageId;
+
+ callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
+ correlationValue, logMarker);
}
@WebMethod(operationName = "queryVnfNotification")
@Oneway
- @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
+ @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
- public void queryVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfExists", targetNamespace = "")
- Boolean vnfExists,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "status", targetNamespace = "")
- VnfStatus status,
- @WebParam(name = "outputs", targetNamespace = "")
- QueryVnfNotification.Outputs outputs){
-
- String method = "queryVnfNotification";
- String messageEventName = "queryVnfNotificationCallback";
- String messageVariable = "queryVnfNotificationCallback";
- String correlationVariable = "VNFQ_messageId";
- String correlationValue = messageId;
-
- QueryVnfNotification message = new QueryVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfExists(vnfExists);
- message.setVnfId(vnfId);
- message.setStatus(status);
- message.setOutputs(outputs);
-
- callback.handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
+ public void queryVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
+ @WebParam(name = "vnfExists", targetNamespace = "") Boolean vnfExists,
+ @WebParam(name = "vnfId", targetNamespace = "") String vnfId,
+ @WebParam(name = "status", targetNamespace = "") VnfStatus status,
+ @WebParam(name = "outputs", targetNamespace = "") QueryVnfNotification.Outputs outputs) {
+
+ String method = "queryVnfNotification";
+ String messageEventName = "queryVnfNotificationCallback";
+ String messageVariable = "queryVnfNotificationCallback";
+ String correlationVariable = "VNFQ_messageId";
+ String correlationValue = messageId;
+
+ QueryVnfNotification message = new QueryVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setVnfExists(vnfExists);
+ message.setVnfId(vnfId);
+ message.setStatus(status);
+ message.setOutputs(outputs);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
+ correlationValue, logMarker);
}
- @WebMethod(operationName = "createVnfNotification")
+ @WebMethod(operationName = "createVnfNotification")
@Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
+ @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
- public void createVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "outputs", targetNamespace = "")
- CreateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "createVnfNotification";
- String messageEventName = "createVnfNotificationCallback";
- String messageVariable = "createVnfNotificationCallback";
- String correlationVariable = "VNFC_messageId";
- String correlationValue = messageId;
-
- CreateVnfNotification message = new CreateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfId(vnfId);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- callback.handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "updateVnfNotification")
+ public void createVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
+ @WebParam(name = "vnfId", targetNamespace = "") String vnfId,
+ @WebParam(name = "outputs", targetNamespace = "") CreateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback) {
+
+ String method = "createVnfNotification";
+ String messageEventName = "createVnfNotificationCallback";
+ String messageVariable = "createVnfNotificationCallback";
+ String correlationVariable = "VNFC_messageId";
+ String correlationValue = messageId;
+
+ CreateVnfNotification message = new CreateVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setVnfId(vnfId);
+ message.setOutputs(outputs);
+ message.setRollback(rollback);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
+ correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "updateVnfNotification")
@Oneway
- @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
+ @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
- public void updateVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "outputs", targetNamespace = "")
- UpdateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "updateVnfNotification";
- String messageEventName = "updateVnfNotificationCallback";
- String messageVariable = "updateVnfNotificationCallback";
- String correlationVariable = "VNFU_messageId";
- String correlationValue = messageId;
-
- UpdateVnfNotification message = new UpdateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- callback.handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
+ public void updateVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
+ @WebParam(name = "outputs", targetNamespace = "") UpdateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback) {
+
+ String method = "updateVnfNotification";
+ String messageEventName = "updateVnfNotificationCallback";
+ String messageVariable = "updateVnfNotificationCallback";
+ String correlationVariable = "VNFU_messageId";
+ String correlationValue = messageId;
+
+ UpdateVnfNotification message = new UpdateVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setOutputs(outputs);
+ message.setRollback(rollback);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
+ correlationValue, logMarker);
+ }
@WebMethod(operationName = "deleteVnfNotification")
@Oneway
- @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
+ @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify",
+ className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
@Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
- public void deleteVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- String method = "deleteVnfNotification";
- String messageEventName = "deleteVnfACallback";
- String messageVariable = "deleteVnfACallback";
- String correlationVariable = "VNFDEL_uuid";
- String correlationValue = messageId;
-
- DeleteVnfNotification message = new DeleteVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
-
- callback.handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
+ public void deleteVnfNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
+ @WebParam(name = "completed", targetNamespace = "") boolean completed,
+ @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage) {
+
+ String method = "deleteVnfNotification";
+ String messageEventName = "deleteVnfACallback";
+ String messageVariable = "deleteVnfACallback";
+ String correlationVariable = "VNFDEL_uuid";
+ String correlationValue = messageId;
+
+ DeleteVnfNotification message = new DeleteVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
+ correlationValue, logMarker);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
index a9a3a63f2f..a534e57b3a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
@@ -26,8 +26,8 @@ import org.camunda.bpm.engine.ProcessEngines;
public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {
- @Override
+ @Override
public String getProcessEngineName() {
- return "default";
- }
+ return "default";
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
index f9f06447a7..e8e4b85cae 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -34,7 +33,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
-
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
@@ -47,20 +45,19 @@ import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
*
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
+ * @version 1.0 Asynchronous Workflow processing using JAX RS RESTeasy implementation Both Synchronous and Asynchronous
+ * BPMN process can benefit from this implementation since the workflow gets executed in the background and the
+ * server thread is freed up, server scales better to process more incoming requests
*
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
+ * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the
+ * response For asynchronous process - the activity may send a acknowledgement response and then proceed
+ * further on executing the process
*/
@Path("/async")
@Api(value = "/async", description = "Provides asynchronous starting of a bpmn process")
@@ -68,81 +65,79 @@ import io.swagger.annotations.ApiOperation;
@Component
public class WorkflowAsyncResource extends ProcessEngineAwareService {
- private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
-
- long workflowPollInterval=1000;
-
- @Autowired
- private WorkflowProcessor processor;
-
- @Autowired
- private WorkflowContextHolder workflowContext;
-
- public void setProcessor(WorkflowProcessor processor) {
- this.processor = processor;
- }
-
- protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class);
- protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time
-
- /**
- * Asynchronous JAX-RS method that starts a process instance.
- * @param processKey the process key
- * @param variableMap input variables to the process
- * @return
- */
-
- @POST
- @Path("/services/{processKey}")
- @ApiOperation(
- value = "Starts a new process with the appropriate process Key",
- notes = "Aysnc fall outs are only logged"
- )
- @Produces("application/json")
- @Consumes("application/json")
- public Response startProcessInstanceByKey (
- @PathParam("processKey") String processKey, VariableMapImpl variableMap){
- Map<String, Object> inputVariables = getInputVariables(variableMap);
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables));
- processor.startProcess(processKey, variableMap);
- WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
- return Response.status(202).entity(response).build();
- } catch (WorkflowProcessorException e) {
- WorkflowResponse response = e.getWorkflowResponse();
- return Response.status(500).entity(response).build();
- }catch (Exception e) {
- WorkflowResponse response = buildUnkownError(getRequestId(inputVariables),e.getMessage());
- return Response.status(500).entity(response).build();
- }
- }
-
- private WorkflowResponse waitForResponse(String requestId) throws Exception {
- long currentWaitTime = 0;
- while (DEFAULT_WAIT_TIME > currentWaitTime ) {
- Thread.sleep(workflowPollInterval);
- currentWaitTime = currentWaitTime + workflowPollInterval;
- WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId);
- if(foundContext!=null){
- contextHolder.remove(foundContext);
- return buildResponse(foundContext);
- }
- }
- throw new Exception("TimeOutOccured");
- }
-
- private WorkflowResponse buildUnkownError(String requestId,String error) {
- WorkflowResponse response = new WorkflowResponse();
- response.setMessage(error);
- response.setResponse("UnknownError, request id:" + requestId);
- response.setMessageCode(500);
- return response;
- }
-
- private WorkflowResponse buildResponse(WorkflowContext foundContext) {
- return foundContext.getWorkflowResponse();
- }
-
+ private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+
+ long workflowPollInterval = 1000;
+
+ @Autowired
+ private WorkflowProcessor processor;
+
+ @Autowired
+ private WorkflowContextHolder workflowContext;
+
+ public void setProcessor(WorkflowProcessor processor) {
+ this.processor = processor;
+ }
+
+ protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class);
+ protected static final long DEFAULT_WAIT_TIME = 60000; // default wait time
+
+ /**
+ * Asynchronous JAX-RS method that starts a process instance.
+ *
+ * @param processKey the process key
+ * @param variableMap input variables to the process
+ * @return
+ */
+
+ @POST
+ @Path("/services/{processKey}")
+ @ApiOperation(value = "Starts a new process with the appropriate process Key",
+ notes = "Aysnc fall outs are only logged")
+ @Produces("application/json")
+ @Consumes("application/json")
+ public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = getInputVariables(variableMap);
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables));
+ processor.startProcess(processKey, variableMap);
+ WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
+ return Response.status(202).entity(response).build();
+ } catch (WorkflowProcessorException e) {
+ WorkflowResponse response = e.getWorkflowResponse();
+ return Response.status(500).entity(response).build();
+ } catch (Exception e) {
+ WorkflowResponse response = buildUnkownError(getRequestId(inputVariables), e.getMessage());
+ return Response.status(500).entity(response).build();
+ }
+ }
+
+ private WorkflowResponse waitForResponse(String requestId) throws Exception {
+ long currentWaitTime = 0;
+ while (DEFAULT_WAIT_TIME > currentWaitTime) {
+ Thread.sleep(workflowPollInterval);
+ currentWaitTime = currentWaitTime + workflowPollInterval;
+ WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId);
+ if (foundContext != null) {
+ contextHolder.remove(foundContext);
+ return buildResponse(foundContext);
+ }
+ }
+ throw new Exception("TimeOutOccured");
+ }
+
+ private WorkflowResponse buildUnkownError(String requestId, String error) {
+ WorkflowResponse response = new WorkflowResponse();
+ response.setMessage(error);
+ response.setResponse("UnknownError, request id:" + requestId);
+ response.setMessageCode(500);
+ return response;
+ }
+
+ private WorkflowResponse buildResponse(WorkflowContext foundContext) {
+ return foundContext.getWorkflowResponse();
+ }
+
protected static String getOrCreate(Map<String, Object> inputVariables, String key) {
String value = Objects.toString(inputVariables.get(key), null);
if (value == null) {
@@ -152,27 +147,28 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
return value;
}
- protected static String getRequestId(Map<String, Object> inputVariables) {
+ protected static String getRequestId(Map<String, Object> inputVariables) {
return getOrCreate(inputVariables, "mso-request-id");
- }
-
- protected boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
- }
-
- protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
+ }
+
+ protected boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId)
+ .singleResult() == null;
+ }
+
+ protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
index 075102331c..1e9ebdf0b2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.common.workflow.service;
import java.util.HashMap;
import java.util.Map;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
@@ -33,7 +32,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
import org.onap.so.logger.ErrorCode;
@@ -42,13 +40,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
- * Generalized REST interface that injects a message event into a waiting BPMN process.
- * Examples:
+ * Generalized REST interface that injects a message event into a waiting BPMN process. Examples:
+ *
* <pre>
* /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
* /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
@@ -57,70 +54,62 @@ import io.swagger.annotations.ApiOperation;
@Path("/")
@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess")
@Component
-public class WorkflowMessageResource{
- private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class);
- private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
-
- @Autowired
- CallbackHandlerService callback;
-
- @POST
- @Path("/WorkflowMessage/{messageType}/{correlator}")
- @ApiOperation(
- value = "Workflow message correlator",
- notes = ""
- )
- @Consumes("*/*")
- @Produces(MediaType.TEXT_PLAIN)
- public Response deliver(
- @HeaderParam("Content-Type") String contentType,
- @PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator,
- String message) {
+public class WorkflowMessageResource {
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class);
+ private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
+
+ @Autowired
+ CallbackHandlerService callback;
+
+ @POST
+ @Path("/WorkflowMessage/{messageType}/{correlator}")
+ @ApiOperation(value = "Workflow message correlator", notes = "")
+ @Consumes("*/*")
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deliver(@HeaderParam("Content-Type") String contentType,
+ @PathParam("messageType") String messageType, @PathParam("correlator") String correlator, String message) {
- String method = "receiveWorkflowMessage";
+ String method = "receiveWorkflowMessage";
- logger.debug(LOGMARKER + " Received workflow message"
- + " type='" + messageType + "'"
- + " correlator='" + correlator + "'"
- + (contentType == null ? "" : " contentType='" + contentType + "'")
- + " message=" + System.lineSeparator() + message);
+ logger.debug(LOGMARKER + " Received workflow message" + " type='" + messageType + "'" + " correlator='"
+ + correlator + "'" + (contentType == null ? "" : " contentType='" + contentType + "'") + " message="
+ + System.lineSeparator() + message);
- if (messageType == null || messageType.isEmpty()) {
- String msg = "Missing message type";
- logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
+ if (messageType == null || messageType.isEmpty()) {
+ String msg = "Missing message type";
+ logger.debug(LOGMARKER + " " + msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
+ return Response.status(400).entity(msg).build();
+ }
- if (correlator == null || correlator.isEmpty()) {
- String msg = "Missing correlator";
- logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
+ if (correlator == null || correlator.isEmpty()) {
+ String msg = "Missing correlator";
+ logger.debug(LOGMARKER + " " + msg);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
+ return Response.status(400).entity(msg).build();
+ }
- String messageEventName = "WorkflowMessage";
- String messageVariable = messageType + "_MESSAGE";
- String correlationVariable = messageType + "_CORRELATOR";
- String correlationValue = correlator;
- String contentTypeVariable = messageType + "_CONTENT_TYPE";
+ String messageEventName = "WorkflowMessage";
+ String messageVariable = messageType + "_MESSAGE";
+ String correlationVariable = messageType + "_CORRELATOR";
+ String correlationValue = correlator;
+ String contentTypeVariable = messageType + "_CONTENT_TYPE";
- Map<String, Object> variables = new HashMap<>();
+ Map<String, Object> variables = new HashMap<>();
- if (contentType != null) {
- variables.put(contentTypeVariable, contentType);
- }
+ if (contentType != null) {
+ variables.put(contentTypeVariable, contentType);
+ }
- CallbackResult result = callback.handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
+ CallbackResult result = callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, LOGMARKER, variables);
- if (result instanceof CallbackError) {
- return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build();
- } else {
- return Response.status(204).build();
- }
- }
+ if (result instanceof CallbackError) {
+ return Response.status(500).entity(((CallbackError) result).getErrorMessage()).build();
+ } else {
+ return Response.status(204).build();
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index b1062962a6..4e9e9fdf0e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
-
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
@@ -39,65 +38,64 @@ import org.springframework.stereotype.Service;
@Service
public class WorkflowProcessor extends ProcessEngineAwareService {
-
- private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class);
- protected static final String logMarker = "[WRKFLOW-RESOURCE]";
-
- @Async
- public void startProcess( String processKey, VariableMapImpl variableMap)
- {
-
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
- String processInstanceId = null;
- try {
- inputVariables = getInputVariables(variableMap);
- // This variable indicates that the flow was invoked asynchronously
- inputVariables.put("isAsyncProcess", "true");
- // Note: this creates a random businessKey if it wasn't specified.
- String businessKey = getBusinessKey(inputVariables);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class);
+ protected static final String logMarker = "[WRKFLOW-RESOURCE]";
+
+ @Async
+ public void startProcess(String processKey, VariableMapImpl variableMap) {
+
+ long startTime = System.currentTimeMillis();
+ Map<String, Object> inputVariables = null;
+ String processInstanceId = null;
+ try {
+ inputVariables = getInputVariables(variableMap);
+ // This variable indicates that the flow was invoked asynchronously
+ inputVariables.put("isAsyncProcess", "true");
- logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey,
- inputVariables);
+ // Note: this creates a random businessKey if it wasn't specified.
+ String businessKey = getBusinessKey(inputVariables);
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey,
- inputVariables);
- processInstanceId = processInstance.getId();
+ logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey,
+ inputVariables);
- logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
- + (processInstance.isEnded() ? "ENDED" : "RUNNING"));
- } catch (Exception e) {
- WorkflowResponse workflowResponse = new WorkflowResponse();
- workflowResponse.setResponse("Error occurred while executing the process: " + e);
- workflowResponse.setProcessInstanceID(processInstanceId);
- workflowResponse.setMessageCode(500);
- workflowResponse.setMessage("Fail");
- throw new WorkflowProcessorException(workflowResponse);
- }
- }
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+ ProcessInstance processInstance =
+ runtimeService.startProcessInstanceByKey(processKey, businessKey, inputVariables);
+ processInstanceId = processInstance.getId();
+
+ logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
+ + (processInstance.isEnded() ? "ENDED" : "RUNNING"));
+ } catch (Exception e) {
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ workflowResponse.setResponse("Error occurred while executing the process: " + e);
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setMessageCode(500);
+ workflowResponse.setMessage("Fail");
+ throw new WorkflowProcessorException(workflowResponse);
+ }
+ }
- // Note: the business key is used to identify the process in unit tests
- protected static String getBusinessKey(Map<String, Object> inputVariables) {
+ // Note: the business key is used to identify the process in unit tests
+ protected static String getBusinessKey(Map<String, Object> inputVariables) {
return getOrCreate(inputVariables, "mso-business-key");
- }
+ }
+
+
+ protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
-
- protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
-
protected static String getOrCreate(Map<String, Object> inputVariables, String key) {
String value = Objects.toString(inputVariables.get(key), null);
if (value == null) {
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
index a5d479ae41..9d63e8eaf1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
@@ -28,7 +28,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -37,7 +36,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
-
import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.ProcessEngineServices;
@@ -56,7 +54,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -64,534 +61,531 @@ import io.swagger.annotations.ApiOperation;
@Api(value = "/workflow", description = "Root of workflow services")
@Component
public class WorkflowResource extends ProcessEngineAwareService {
-
- private static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
- private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
-
- private static final int DEFAULT_WAIT_TIME = 30000;
-
- @Context
- private UriInfo uriInfo = null;
-
- /**
- * Starts the process instance and responds to client synchronously
- * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
- * Note: value specified in mso-service-request-timeout is in seconds
- * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
- * returned to the client
- * @param processKey
- * @param variableMap
- * @return
- */
- @POST
- @Path("/services/{processKey}")
- @ApiOperation(
- value = "Starts a new process with the appropriate process synchronously",
- notes = "d"
- )
- @Produces("application/json")
- @Consumes("application/json")
- public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
- VariableMapImpl variableMap) {
-
- Map<String, Object> inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- WorkflowResponse workflowResponse = new WorkflowResponse();
- long startTime = System.currentTimeMillis();
- ProcessInstance processInstance = null;
-
- try {
- //Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey);
- thread.start();
-
- Map<String, Object> responseMap = null;
-
- //wait for process to be completed
- long waitTime = getWaitTime(inputVariables);
- long now = System.currentTimeMillis();
- long start = now;
- long endTime = start + waitTime;
- long pollingInterval = 500;
-
- // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
- // If this is a unit test (method is invoked directly), wait a max
- // of 5 seconds after process ended for a result. In production,
- // wait up to 60 seconds.
- long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
- AtomicLong timeProcessEnded = new AtomicLong(0);
- boolean endedWithNoResponse = false;
-
- while (now <= endTime) {
- Thread.sleep(pollingInterval);
-
- now = System.currentTimeMillis();
-
- // Increase the polling interval over time
-
- long elapsed = now - start;
-
- if (elapsed > 60000) {
- pollingInterval = 5000;
- } else if (elapsed > 10000) {
- pollingInterval = 1000;
- }
- Exception exception = thread.getException();
- if (exception != null) {
- throw new Exception(exception);
- }
-
- processInstance = thread.getProcessInstance();
-
- if (processInstance == null) {
- logger.debug("{} process has not been created yet", LOGMARKER + processKey );
- continue;
- }
-
- String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceID(processInstanceId);
-
- responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
-
- if (responseMap == null) {
- logger.debug("{} has not produced a response yet", LOGMARKER + processKey);
-
- if (timeProcessEnded.longValue() != 0) {
- long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
-
- if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
- endedWithNoResponse = true;
- break;
- }
- }
- } else {
- processResponseMap(workflowResponse, responseMap);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
- }
- }
-
- //if we dont get response after waiting then send timeout response
-
- String state;
- String processInstanceId;
-
- if (processInstance == null) {
- processInstanceId = "N/A";
- state = "NOT STARTED";
- } else {
- processInstanceId = processInstance.getProcessInstanceId();
- state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
- }
-
- workflowResponse.setMessage("Fail");
- if (endedWithNoResponse) {
- workflowResponse.setResponse("Process ended without producing a response");
- } else {
- workflowResponse.setResponse("Request timed out, process state: " + state);
- }
- workflowResponse.setProcessInstanceID(processInstanceId);
- recordEvents(processKey, workflowResponse, startTime);
- workflowResponse.setMessageCode(500);
- return Response.status(500).entity(workflowResponse).build();
- } catch (Exception ex) {
- logger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
- workflowResponse.setMessage("Fail" );
- workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
- if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
-
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
- ErrorCode.UnknownError.getValue(),
- LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: "
- + workflowResponse.getResponse());
-
- workflowResponse.setMessageCode(500);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(500).entity(workflowResponse).build();
- }
- }
-
- /**
- * Returns the wait time, this is used by the resource on how long it should wait to send a response
- * If none specified DEFAULT_WAIT_TIME is used
- * @param inputVariables
- * @return
- */
- private int getWaitTime(Map<String, Object> inputVariables)
- {
- String timeout = inputVariables.get("mso-service-request-timeout") == null
- ? null : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Integer.parseInt(timeout)*1000;
- } catch (NumberFormatException nex) {
- logger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
- }
-
- private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- }
-
- private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- Object value = inputVariables.get(key);
- if (value == null) {
- return "N/A";
- } else {
- return value.toString();
- }
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param processInstanceId the process instance ID
- * @return true if the process is ended
- */
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- try {
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
- } catch (Exception e) {
- logger.debug("Exception :",e);
- return true;
- }
- }
-
- private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
- Object object = responseMap.get("Response");
- String response = object == null ? null : String.valueOf(object);
- if(response == null){
- object = responseMap.get("WorkflowResponse");
- response = object == null ? null : String.valueOf(object);
- }
-
- workflowResponse.setResponse(response);
-
- object = responseMap.get("ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
-
- try {
- workflowResponse.setMessageCode(Integer.parseInt(responseCode));
- } catch(NumberFormatException nex) {
- logger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
- workflowResponse.setMessageCode(-1);
- }
-
- Object status = responseMap.get("Status");
-
- if ("Success".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Success");
- } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Fail");
- } else {
- logger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
- workflowResponse.setMessage("Fail");
- }
- }
-
- /**
- * @version 1.0
- * Triggers the workflow in a separate thread
- */
- private class ProcessThread extends Thread {
- private final Map<String,Object> inputVariables;
- private final String processKey;
- private final String businessKey;
- private ProcessInstance processInstance = null;
- private Exception exception = null;
-
- public ProcessThread(Map<String, Object> inputVariables, String processKey) {
- this.inputVariables = inputVariables;
- this.processKey = processKey;
- this.businessKey = UUID.randomUUID().toString();
- }
-
- /**
- * If an exception occurs when starting the process instance, it may
- * be obtained by calling this method. Note that exceptions are only
- * recorded while the process is executing in its original thread.
- * Once a process is suspended, exception recording stops.
- * @return the exception, or null if none has occurred
- */
- public Exception getException() {
- return exception;
- }
-
-
- public ProcessInstance getProcessInstance() {
- return this.processInstance;
- }
-
- /**
- * Sets the process instance exception.
- * @param exception the exception
- */
- private void setException(Exception exception) {
- this.exception = exception;
- }
-
- public void run() {
- setLogContext(processKey, inputVariables);
-
- long startTime = System.currentTimeMillis();
-
- try {
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- // Note that this method doesn't return until the process suspends
- // itself or finishes. We provide a business key so we can identify
- // the process instance immediately.
- processInstance = runtimeService.startProcessInstanceByKey(
- processKey, inputVariables);
-
- } catch (Exception e) {
- logger.debug(LOGMARKER + "ProcessThread caught an exception executing "
- + processKey + ": " + e);
- setException(e);
- }
- }
-
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- VariableMap inputVariables = Variables.createVariables();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String key : vMap.keySet()) { //variabe name vn
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
- inputVariables.putValueTyped(key, Variables
- .objectValue(valueMap.get("value"))
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create());
- }
- return inputVariables;
- }
-
- /**
- * Attempts to get a response map from the specified process instance.
- * @return the response map, or null if it is unavailable
- */
- private Map<String, Object> getResponseMap(ProcessInstance processInstance,
- String processKey, AtomicLong timeProcessEnded) {
-
- String responseMapVariable = processKey + "ResponseMap";
- String processInstanceId = processInstance.getId();
-
- // Query the runtime service to see if a response map is ready.
-
-/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- List<Execution> executions = runtimeService.createExecutionQuery()
- .processInstanceId(processInstanceId).list();
-
- for (Execution execution : executions) {
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromExecution(runtimeService, execution.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " execution "
- + execution.getId());
- return responseMap;
- }
- }
-*/
- //Querying history seem to return consistent results compared to querying the runtime service
-
- boolean alreadyEnded = timeProcessEnded.longValue() != 0;
-
- if (alreadyEnded || isProcessEnded(processInstance.getId())) {
- if (!alreadyEnded) {
- timeProcessEnded.set(System.currentTimeMillis());
- }
-
- // Query the history service to see if a response map exists.
-
- HistoryService historyService = getProcessEngineServices().getHistoryService();
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromHistory(historyService, processInstance.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- logger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " history");
- return responseMap;
- }
-
- // Query the history service for old-style response variables.
-
- String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
-
- if (prefix != null) {
-
- // Check for 'WorkflowResponse' variable
- Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
- String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
- logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
-
- if (workflowResponse != null) {
- Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("WorkflowResponse", workflowResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
-
- // Check for 'WorkflowException' variable
- WorkflowException workflowException = null;
- String workflowExceptionText = null;
-
- Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
- if(workflowExceptionObject != null) {
- if(workflowExceptionObject instanceof WorkflowException) {
- workflowException = (WorkflowException) workflowExceptionObject;
- workflowExceptionText = workflowException.toString();
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", workflowException.getErrorCode());
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- else if (workflowExceptionObject instanceof String) {
- Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- workflowExceptionText = (String) workflowExceptionObject;
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
-
- }
- logger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
- String response = object == null ? null : String.valueOf(object);
- logger.debug(LOGMARKER + processKey + "Response: " + response);
-
- if (response != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", response);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
- String errorResponse = object == null ? null : String.valueOf(object);
- logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
-
- if (errorResponse != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", errorResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- }
- }
- return null;
- }
-
- /**
- * Gets a variable value from the specified execution.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromExecution(RuntimeService runtimeService,
- String executionId, String variableName) {
- try {
- return runtimeService.getVariable(executionId, variableName);
- } catch (ProcessEngineException e) {
- // Most likely cause is that the execution no longer exists.
- logger.debug("Error retrieving execution " + executionId
- + " variable " + variableName + ": " + e);
- return null;
- }
- }
- /**
- * Gets a variable value from specified historical process instance.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromHistory(HistoryService historyService,
- String processInstanceId, String variableName) {
- try {
- HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
- .processInstanceId(processInstanceId).variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId,
- variableName, e);
- return null;
- }
- }
-
- @POST
- @Path("/services/{processKey}/{processInstanceId}")
- @Produces("application/json")
- @Consumes("application/json")
- @ApiOperation(
- value = "Allows for retrieval of the variables for a given process",
- notes = ""
- )
- public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
- //TODO filter only set of variables
- WorkflowResponse response = new WorkflowResponse();
-
- long startTime = System.currentTimeMillis();
- try {
- ProcessEngineServices engine = getProcessEngineServices();
- List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
- Map<String,String> variablesMap = new HashMap<>();
- for (HistoricVariableInstance variableInstance: variables) {
- variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
- }
-
- logger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " +
- variablesMap.toString());
-
- response.setVariables(variablesMap);
- response.setMessage("Success");
- response.setResponse("Successfully retrieved the variables");
- response.setProcessInstanceID(processInstanceId);
-
- logger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response
- .getResponse());
- } catch (Exception ex) {
- response.setMessage("Fail");
- response.setResponse("Failed to retrieve the variables," + ex.getMessage());
- response.setProcessInstanceID(processInstanceId);
-
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
- ErrorCode.UnknownError.getValue(),
- LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response
- .getResponse());
- logger.debug("Exception :",ex);
- }
- return response;
- }
+
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
+ private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
+
+ private static final int DEFAULT_WAIT_TIME = 30000;
+
+ @Context
+ private UriInfo uriInfo = null;
+
+ /**
+ * Starts the process instance and responds to client synchronously If the request does not contain
+ * mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME Note: value specified in
+ * mso-service-request-timeout is in seconds During polling time, if there is an exception encountered in the
+ * process execution then polling is stopped and the error response is returned to the client
+ *
+ * @param processKey
+ * @param variableMap
+ * @return
+ */
+ @POST
+ @Path("/services/{processKey}")
+ @ApiOperation(value = "Starts a new process with the appropriate process synchronously", notes = "d")
+ @Produces("application/json")
+ @Consumes("application/json")
+ public Response startProcessInstanceByKey(@PathParam("processKey") String processKey, VariableMapImpl variableMap) {
+
+ Map<String, Object> inputVariables = getInputVariables(variableMap);
+ setLogContext(processKey, inputVariables);
+
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ long startTime = System.currentTimeMillis();
+ ProcessInstance processInstance = null;
+
+ try {
+ // Kickoff the process
+ ProcessThread thread = new ProcessThread(inputVariables, processKey);
+ thread.start();
+
+ Map<String, Object> responseMap = null;
+
+ // wait for process to be completed
+ long waitTime = getWaitTime(inputVariables);
+ long now = System.currentTimeMillis();
+ long start = now;
+ long endTime = start + waitTime;
+ long pollingInterval = 500;
+
+ // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
+ // If this is a unit test (method is invoked directly), wait a max
+ // of 5 seconds after process ended for a result. In production,
+ // wait up to 60 seconds.
+ long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
+ AtomicLong timeProcessEnded = new AtomicLong(0);
+ boolean endedWithNoResponse = false;
+
+ while (now <= endTime) {
+ Thread.sleep(pollingInterval);
+
+ now = System.currentTimeMillis();
+
+ // Increase the polling interval over time
+
+ long elapsed = now - start;
+
+ if (elapsed > 60000) {
+ pollingInterval = 5000;
+ } else if (elapsed > 10000) {
+ pollingInterval = 1000;
+ }
+ Exception exception = thread.getException();
+ if (exception != null) {
+ throw new Exception(exception);
+ }
+
+ processInstance = thread.getProcessInstance();
+
+ if (processInstance == null) {
+ logger.debug("{} process has not been created yet", LOGMARKER + processKey);
+ continue;
+ }
+
+ String processInstanceId = processInstance.getId();
+ workflowResponse.setProcessInstanceID(processInstanceId);
+
+ responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
+
+ if (responseMap == null) {
+ logger.debug("{} has not produced a response yet", LOGMARKER + processKey);
+
+ if (timeProcessEnded.longValue() != 0) {
+ long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
+
+ if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
+ endedWithNoResponse = true;
+ break;
+ }
+ }
+ } else {
+ processResponseMap(workflowResponse, responseMap);
+ recordEvents(processKey, workflowResponse, startTime);
+ return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
+ }
+ }
+
+ // if we dont get response after waiting then send timeout response
+
+ String state;
+ String processInstanceId;
+
+ if (processInstance == null) {
+ processInstanceId = "N/A";
+ state = "NOT STARTED";
+ } else {
+ processInstanceId = processInstance.getProcessInstanceId();
+ state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
+ }
+
+ workflowResponse.setMessage("Fail");
+ if (endedWithNoResponse) {
+ workflowResponse.setResponse("Process ended without producing a response");
+ } else {
+ workflowResponse.setResponse("Request timed out, process state: " + state);
+ }
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ recordEvents(processKey, workflowResponse, startTime);
+ workflowResponse.setMessageCode(500);
+ return Response.status(500).entity(workflowResponse).build();
+ } catch (Exception ex) {
+ logger.debug(LOGMARKER + "Exception in startProcessInstance by key", ex);
+ workflowResponse.setMessage("Fail");
+ workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
+ if (processInstance != null)
+ workflowResponse.setProcessInstanceID(processInstance.getId());
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage()
+ + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
+
+ workflowResponse.setMessageCode(500);
+ recordEvents(processKey, workflowResponse, startTime);
+ return Response.status(500).entity(workflowResponse).build();
+ }
+ }
+
+ /**
+ * Returns the wait time, this is used by the resource on how long it should wait to send a response If none
+ * specified DEFAULT_WAIT_TIME is used
+ *
+ * @param inputVariables
+ * @return
+ */
+ private int getWaitTime(Map<String, Object> inputVariables) {
+ String timeout = inputVariables.get("mso-service-request-timeout") == null ? null
+ : inputVariables.get("mso-service-request-timeout").toString();
+
+ if (timeout != null) {
+ try {
+ return Integer.parseInt(timeout) * 1000;
+ } catch (NumberFormatException nex) {
+ logger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+ return DEFAULT_WAIT_TIME;
+ }
+
+ private void recordEvents(String processKey, WorkflowResponse response, long startTime) {}
+
+ private void setLogContext(String processKey, Map<String, Object> inputVariables) {}
+
+ private String getValueFromInputVariables(Map<String, Object> inputVariables, String key) {
+ Object value = inputVariables.get(key);
+ if (value == null) {
+ return "N/A";
+ } else {
+ return value.toString();
+ }
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @param processInstanceId the process instance ID
+ * @return true if the process is ended
+ */
+ private boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ try {
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId)
+ .singleResult() == null ? true : false;
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ return true;
+ }
+ }
+
+ private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
+ Object object = responseMap.get("Response");
+ String response = object == null ? null : String.valueOf(object);
+ if (response == null) {
+ object = responseMap.get("WorkflowResponse");
+ response = object == null ? null : String.valueOf(object);
+ }
+
+ workflowResponse.setResponse(response);
+
+ object = responseMap.get("ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+
+ try {
+ workflowResponse.setMessageCode(Integer.parseInt(responseCode));
+ } catch (NumberFormatException nex) {
+ logger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
+ workflowResponse.setMessageCode(-1);
+ }
+
+ Object status = responseMap.get("Status");
+
+ if ("Success".equalsIgnoreCase(String.valueOf(status))) {
+ workflowResponse.setMessage("Success");
+ } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
+ workflowResponse.setMessage("Fail");
+ } else {
+ logger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
+ workflowResponse.setMessage("Fail");
+ }
+ }
+
+ /**
+ * @version 1.0 Triggers the workflow in a separate thread
+ */
+ private class ProcessThread extends Thread {
+ private final Map<String, Object> inputVariables;
+ private final String processKey;
+ private final String businessKey;
+ private ProcessInstance processInstance = null;
+ private Exception exception = null;
+
+ public ProcessThread(Map<String, Object> inputVariables, String processKey) {
+ this.inputVariables = inputVariables;
+ this.processKey = processKey;
+ this.businessKey = UUID.randomUUID().toString();
+ }
+
+ /**
+ * If an exception occurs when starting the process instance, it may be obtained by calling this method. Note
+ * that exceptions are only recorded while the process is executing in its original thread. Once a process is
+ * suspended, exception recording stops.
+ *
+ * @return the exception, or null if none has occurred
+ */
+ public Exception getException() {
+ return exception;
+ }
+
+
+ public ProcessInstance getProcessInstance() {
+ return this.processInstance;
+ }
+
+ /**
+ * Sets the process instance exception.
+ *
+ * @param exception the exception
+ */
+ private void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ public void run() {
+ setLogContext(processKey, inputVariables);
+
+ long startTime = System.currentTimeMillis();
+
+ try {
+
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+
+ // Note that this method doesn't return until the process suspends
+ // itself or finishes. We provide a business key so we can identify
+ // the process instance immediately.
+ processInstance = runtimeService.startProcessInstanceByKey(processKey, inputVariables);
+
+ } catch (Exception e) {
+ logger.debug(LOGMARKER + "ProcessThread caught an exception executing " + processKey + ": " + e);
+ setException(e);
+ }
+ }
+
+ }
+
+ private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ VariableMap inputVariables = Variables.createVariables();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (String key : vMap.keySet()) { // variabe name vn
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) vMap.get(key); // value, type
+ inputVariables.putValueTyped(key,
+ Variables.objectValue(valueMap.get("value")).serializationDataFormat(SerializationDataFormats.JAVA) // tells
+ // the
+ // engine
+ // to
+ // use
+ // java
+ // serialization
+ // for
+ // persisting
+ // the
+ // value
+ .create());
+ }
+ return inputVariables;
+ }
+
+ /**
+ * Attempts to get a response map from the specified process instance.
+ *
+ * @return the response map, or null if it is unavailable
+ */
+ private Map<String, Object> getResponseMap(ProcessInstance processInstance, String processKey,
+ AtomicLong timeProcessEnded) {
+
+ String responseMapVariable = processKey + "ResponseMap";
+ String processInstanceId = processInstance.getId();
+
+ // Query the runtime service to see if a response map is ready.
+
+ /*
+ * RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); List<Execution> executions =
+ * runtimeService.createExecutionQuery() .processInstanceId(processInstanceId).list();
+ *
+ * for (Execution execution : executions) {
+ *
+ * @SuppressWarnings("unchecked") Map<String, Object> responseMap = (Map<String, Object>)
+ * getVariableFromExecution(runtimeService, execution.getId(), responseMapVariable);
+ *
+ * if (responseMap != null) { msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + " from process " +
+ * processInstanceId + " execution " + execution.getId()); return responseMap; } }
+ */
+ // Querying history seem to return consistent results compared to querying the runtime service
+
+ boolean alreadyEnded = timeProcessEnded.longValue() != 0;
+
+ if (alreadyEnded || isProcessEnded(processInstance.getId())) {
+ if (!alreadyEnded) {
+ timeProcessEnded.set(System.currentTimeMillis());
+ }
+
+ // Query the history service to see if a response map exists.
+
+ HistoryService historyService = getProcessEngineServices().getHistoryService();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> responseMap = (Map<String, Object>) getVariableFromHistory(historyService,
+ processInstance.getId(), responseMapVariable);
+
+ if (responseMap != null) {
+ logger.debug(LOGMARKER + "Obtained " + responseMapVariable + " from process " + processInstanceId
+ + " history");
+ return responseMap;
+ }
+
+ // Query the history service for old-style response variables.
+
+ String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
+
+ if (prefix != null) {
+
+ // Check for 'WorkflowResponse' variable
+ Object workflowResponseObject =
+ getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
+ String workflowResponse =
+ workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
+ logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
+
+ if (workflowResponse != null) {
+ Object responseCodeObject =
+ getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
+ logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<>();
+ responseMap.put("WorkflowResponse", workflowResponse);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Success");
+ return responseMap;
+ }
+
+
+ // Check for 'WorkflowException' variable
+ WorkflowException workflowException = null;
+ String workflowExceptionText = null;
+
+ Object workflowExceptionObject =
+ getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
+ if (workflowExceptionObject != null) {
+ if (workflowExceptionObject instanceof WorkflowException) {
+ workflowException = (WorkflowException) workflowExceptionObject;
+ workflowExceptionText = workflowException.toString();
+ responseMap = new HashMap<>();
+ responseMap.put("WorkflowException", workflowExceptionText);
+ responseMap.put("ResponseCode", workflowException.getErrorCode());
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ } else if (workflowExceptionObject instanceof String) {
+ Object object =
+ getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ workflowExceptionText = (String) workflowExceptionObject;
+ responseMap = new HashMap<>();
+ responseMap.put("WorkflowException", workflowExceptionText);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+
+ }
+ logger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
+
+ // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
+ Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
+ String response = object == null ? null : String.valueOf(object);
+ logger.debug(LOGMARKER + processKey + "Response: " + response);
+
+ if (response != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<>();
+ responseMap.put("Response", response);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Success");
+ return responseMap;
+ }
+
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
+ String errorResponse = object == null ? null : String.valueOf(object);
+ logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
+
+ if (errorResponse != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<>();
+ responseMap.put("Response", errorResponse);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+ // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets a variable value from the specified execution.
+ *
+ * @return the variable value, or null if the variable could not be obtained
+ */
+ private Object getVariableFromExecution(RuntimeService runtimeService, String executionId, String variableName) {
+ try {
+ return runtimeService.getVariable(executionId, variableName);
+ } catch (ProcessEngineException e) {
+ // Most likely cause is that the execution no longer exists.
+ logger.debug("Error retrieving execution " + executionId + " variable " + variableName + ": " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets a variable value from specified historical process instance.
+ *
+ * @return the variable value, or null if the variable could not be obtained
+ */
+ private Object getVariableFromHistory(HistoryService historyService, String processInstanceId,
+ String variableName) {
+ try {
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId, variableName, e);
+ return null;
+ }
+ }
+
+ @POST
+ @Path("/services/{processKey}/{processInstanceId}")
+ @Produces("application/json")
+ @Consumes("application/json")
+ @ApiOperation(value = "Allows for retrieval of the variables for a given process", notes = "")
+ public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey,
+ @PathParam("processInstanceId") String processInstanceId) {
+ // TODO filter only set of variables
+ WorkflowResponse response = new WorkflowResponse();
+
+ long startTime = System.currentTimeMillis();
+ try {
+ ProcessEngineServices engine = getProcessEngineServices();
+ List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).list();
+ Map<String, String> variablesMap = new HashMap<>();
+ for (HistoricVariableInstance variableInstance : variables) {
+ variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
+ }
+
+ logger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey
+ + " and variables: " + variablesMap.toString());
+
+ response.setVariables(variablesMap);
+ response.setMessage("Success");
+ response.setResponse("Successfully retrieved the variables");
+ response.setProcessInstanceID(processInstanceId);
+
+ logger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: "
+ + response.getResponse());
+ } catch (Exception ex) {
+ response.setMessage("Fail");
+ response.setResponse("Failed to retrieve the variables," + ex.getMessage());
+ response.setProcessInstanceID(processInstanceId);
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage()
+ + " for processKey: " + processKey + " with response: " + response.getResponse());
+ logger.debug("Exception :", ex);
+ }
+ return response;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index 3eed14bc30..296ab64df3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -32,7 +32,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
-
import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
@@ -53,8 +52,6 @@ import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl;
import org.camunda.bpm.model.bpmn.instance.EndEvent;
import org.camunda.bpm.model.bpmn.instance.FlowNode;
import org.camunda.bpm.model.bpmn.instance.StartEvent;
-
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,256 +69,259 @@ import org.springframework.stereotype.Component;
@Component
public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
- @Autowired
- private LoggingParseListener loggingParseListener;
-
- @Override
- public void preInit(
- ProcessEngineConfigurationImpl processEngineConfiguration) {
- List<BpmnParseListener> preParseListeners = processEngineConfiguration
- .getCustomPreBPMNParseListeners();
- if (preParseListeners == null) {
- preParseListeners = new ArrayList<>();
- processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
- }
- preParseListeners.add(loggingParseListener);
- }
-
- /**
- * Called when a process flow is parsed so we can inject listeners.
- */
- @Component
- public class LoggingParseListener extends AbstractBpmnParseListener {
-
-
- private void injectLogExecutionListener(ActivityImpl activity) {
- activity.addListener(
- ExecutionListener.EVENTNAME_END,
- new LoggingExecutionListener("END"));
-
- activity.addListener(
- ExecutionListener.EVENTNAME_START,
- new LoggingExecutionListener("START"));
-
- activity.addListener(
- ExecutionListener.EVENTNAME_TAKE,
- new LoggingExecutionListener("TAKE"));
- }
-
- @Override
- public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
- }
-
- @Override
- public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) {
- // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events
-
- injectLogExecutionListener(startEventActivity);
- }
-
- @Override
- public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) {
- injectLogExecutionListener(timerActivity);
- }
-
- @Override
- public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) {
- //injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
- injectLogExecutionListener(timerActivity);
- }
-
- @Override
- public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) {
-
- }
-
- @Override
- public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) {
- injectLogExecutionListener(signalActivity);
- }
-
- @Override
- public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
- injectLogExecutionListener(signalActivity);
- }
-
- @Override
- public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) {
- injectLogExecutionListener(compensationActivity);
- }
-
- @Override
- public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
- injectLogExecutionListener(activity);
- }
-
- @Override
- public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) {
- injectLogExecutionListener(nestedActivity);
- }
-
- @Override
- public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) {
- injectLogExecutionListener(nestedActivity);
- }
-
- @Override
- public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) {
- injectLogExecutionListener(messageActivity);
- }
- }
-
- /**
- * Logs details about the current activity.
- */
- public class LoggingExecutionListener implements ExecutionListener {
- private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class);
-
- private String event;
-
- public LoggingExecutionListener() {
- this.event = "";
- }
-
- public LoggingExecutionListener(String event) {
- this.event = event;
- }
-
- public String getEvent() {
- return event;
- }
-
- @Override
- public void notify(DelegateExecution execution) throws Exception {
- //required for legacy groovy processing in camunda
- execution.setVariable("isDebugLogEnabled", "true");
- if (!isBlank(execution.getCurrentActivityName())) {
- try {
-
- String id = execution.getId();
- if (id != null ) {
- RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
- String processName = repositoryService.createProcessDefinitionQuery()
- .processDefinitionId(execution.getProcessDefinitionId())
- .singleResult()
- .getName();
-
-
- String requestId = (String) execution.getVariable("mso-request-id");
- String svcid = (String) execution.getVariable("mso-service-instance-id");
- }
- } catch(Exception e) {
- logger.error("Exception occurred", e);
- }
- }
- }
-
- private boolean isBlank(Object object) {
- return object == null || "".equals(object.toString().trim());
- }
- }
+ @Autowired
+ private LoggingParseListener loggingParseListener;
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+ preParseListeners.add(loggingParseListener);
+ }
+
+ /**
+ * Called when a process flow is parsed so we can inject listeners.
+ */
+ @Component
+ public class LoggingParseListener extends AbstractBpmnParseListener {
+
+
+ private void injectLogExecutionListener(ActivityImpl activity) {
+ activity.addListener(ExecutionListener.EVENTNAME_END, new LoggingExecutionListener("END"));
+
+ activity.addListener(ExecutionListener.EVENTNAME_START, new LoggingExecutionListener("START"));
+
+ activity.addListener(ExecutionListener.EVENTNAME_TAKE, new LoggingExecutionListener("TAKE"));
+ }
+
+ @Override
+ public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {}
+
+ @Override
+ public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) {
+ // Inject these listeners only on the main start event for the flow, not on any embedded subflow start
+ // events
+
+ injectLogExecutionListener(startEventActivity);
+ }
+
+ @Override
+ public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting,
+ ActivityImpl timerActivity) {
+ injectLogExecutionListener(timerActivity);
+ }
+
+ @Override
+ public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting,
+ ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration,
+ ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) {
+ // injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseMultiInstanceLoopCharacteristics(Element activityElement,
+ Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
+ injectLogExecutionListener(timerActivity);
+ }
+
+ @Override
+ public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) {
+
+ }
+
+ @Override
+ public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition,
+ ActivityImpl signalActivity) {
+ injectLogExecutionListener(signalActivity);
+ }
+
+ @Override
+ public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting,
+ ActivityImpl signalActivity) {
+ injectLogExecutionListener(signalActivity);
+ }
+
+ @Override
+ public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseCompensateEventDefinition(Element compensateEventDefinition,
+ ActivityImpl compensationActivity) {
+ injectLogExecutionListener(compensationActivity);
+ }
+
+ @Override
+ public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope,
+ ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope,
+ ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement,
+ ActivityImpl nestedActivity) {
+ injectLogExecutionListener(nestedActivity);
+ }
+
+ @Override
+ public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition,
+ ActivityImpl nestedActivity) {
+ injectLogExecutionListener(nestedActivity);
+ }
+
+ @Override
+ public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting,
+ ActivityImpl messageActivity) {
+ injectLogExecutionListener(messageActivity);
+ }
+ }
+
+ /**
+ * Logs details about the current activity.
+ */
+ public class LoggingExecutionListener implements ExecutionListener {
+ private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class);
+
+ private String event;
+
+ public LoggingExecutionListener() {
+ this.event = "";
+ }
+
+ public LoggingExecutionListener(String event) {
+ this.event = event;
+ }
+
+ public String getEvent() {
+ return event;
+ }
+
+ @Override
+ public void notify(DelegateExecution execution) throws Exception {
+ // required for legacy groovy processing in camunda
+ execution.setVariable("isDebugLogEnabled", "true");
+ if (!isBlank(execution.getCurrentActivityName())) {
+ try {
+
+ String id = execution.getId();
+ if (id != null) {
+ RepositoryService repositoryService =
+ execution.getProcessEngineServices().getRepositoryService();
+ String processName = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionId(execution.getProcessDefinitionId()).singleResult().getName();
+
+
+ String requestId = (String) execution.getVariable("mso-request-id");
+ String svcid = (String) execution.getVariable("mso-service-instance-id");
+ }
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ }
+ }
+ }
+
+ private boolean isBlank(Object object) {
+ return object == null || "".equals(object.toString().trim());
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
index 8bc0055343..ab21c0807e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
@@ -25,7 +25,6 @@ package org.onap.so.bpmn.core.plugins;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
@@ -41,7 +40,6 @@ import org.camunda.bpm.engine.impl.pvm.PvmTransition;
import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
-
import org.onap.so.bpmn.core.WorkflowException;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
@@ -50,125 +48,115 @@ import org.slf4j.LoggerFactory;
/**
* This plugin does the following:
* <ol>
- * <li>
- * Adds logic at the start of every Call Activity to remove any existing
- * WorkflowException object from the execution (saving a copy of it in a
- * different variable).
- * </li>
- * <li>
- * Adds logic at the end of every Call Activity to generate a MSOWorkflowException
- * event if there is a WorkflowException object in the execution.
- * </li>
+ * <li>Adds logic at the start of every Call Activity to remove any existing WorkflowException object from the execution
+ * (saving a copy of it in a different variable).</li>
+ * <li>Adds logic at the end of every Call Activity to generate a MSOWorkflowException event if there is a
+ * WorkflowException object in the execution.</li>
* </ol>
*/
@Component
public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
-
- @Override
- public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
- List<BpmnParseListener> preParseListeners =
- processEngineConfiguration.getCustomPreBPMNParseListeners();
-
- if (preParseListeners == null) {
- preParseListeners = new ArrayList<>();
- processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
- }
-
- preParseListeners.add(new WorkflowExceptionParseListener());
- }
-
- public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener {
- @Override
- public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
- AtomicInteger triggerTaskIndex = new AtomicInteger(1);
- List<ActivityImpl> activities = new ArrayList<>(processDefinition.getActivities());
- recurse(activities, triggerTaskIndex);
- }
-
- /**
- * Helper method that recurses (into subprocesses) over all the listed activities.
- * @param activities a list of workflow activities
- * @param triggerTaskIndex the index of the next trigger task (mutable)
- */
- private void recurse(List<ActivityImpl> activities, AtomicInteger triggerTaskIndex) {
- for (ActivityImpl activity : activities) {
- String type = (String) activity.getProperty("type");
-
- if ("callActivity".equals(type)) {
- // Add a WorkflowExceptionResetListener to clear the WorkflowException
- // variable when each Call Activity starts.
-
- activity.addListener(
- ExecutionListener.EVENTNAME_START,
- new WorkflowExceptionResetListener());
-
- // Add a WorkflowExceptionTriggerTask after the call activity.
- // It must be a task because a listener cannot be used to generate
- // an event. Throwing BpmnError from an execution listener will
- // cause the process to die.
-
- List<PvmTransition> outTransitions =
- new ArrayList<>(activity.getOutgoingTransitions());
-
- for (PvmTransition transition : outTransitions) {
- String triggerTaskId = "WorkflowExceptionTriggerTask_" + triggerTaskIndex;
-
- ActivityImpl triggerTask = activity.getFlowScope().createActivity(triggerTaskId);
-
- ClassDelegateActivityBehavior behavior = new ClassDelegateActivityBehavior(
- WorkflowExceptionTriggerTask.class.getName(),
- new ArrayList<>(0));
-
- triggerTask.setActivityBehavior(behavior);
- triggerTask.setName("Workflow Exception Trigger Task " + triggerTaskIndex);
- triggerTaskIndex.getAndIncrement();
-
- TransitionImpl transitionImpl = (TransitionImpl) transition;
- TransitionImpl triggerTaskOutTransition = triggerTask.createOutgoingTransition();
- triggerTaskOutTransition.setDestination((ActivityImpl)transitionImpl.getDestination());
- transitionImpl.setDestination(triggerTask);
- }
- } else if ("subProcess".equals(type)) {
- recurse(new ArrayList<>(activity.getActivities()), triggerTaskIndex);
- }
- }
- }
- }
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
+
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+
+ preParseListeners.add(new WorkflowExceptionParseListener());
+ }
+
+ public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener {
+ @Override
+ public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
+ AtomicInteger triggerTaskIndex = new AtomicInteger(1);
+ List<ActivityImpl> activities = new ArrayList<>(processDefinition.getActivities());
+ recurse(activities, triggerTaskIndex);
+ }
+
+ /**
+ * Helper method that recurses (into subprocesses) over all the listed activities.
+ *
+ * @param activities a list of workflow activities
+ * @param triggerTaskIndex the index of the next trigger task (mutable)
+ */
+ private void recurse(List<ActivityImpl> activities, AtomicInteger triggerTaskIndex) {
+ for (ActivityImpl activity : activities) {
+ String type = (String) activity.getProperty("type");
+
+ if ("callActivity".equals(type)) {
+ // Add a WorkflowExceptionResetListener to clear the WorkflowException
+ // variable when each Call Activity starts.
+
+ activity.addListener(ExecutionListener.EVENTNAME_START, new WorkflowExceptionResetListener());
+
+ // Add a WorkflowExceptionTriggerTask after the call activity.
+ // It must be a task because a listener cannot be used to generate
+ // an event. Throwing BpmnError from an execution listener will
+ // cause the process to die.
+
+ List<PvmTransition> outTransitions = new ArrayList<>(activity.getOutgoingTransitions());
+
+ for (PvmTransition transition : outTransitions) {
+ String triggerTaskId = "WorkflowExceptionTriggerTask_" + triggerTaskIndex;
+
+ ActivityImpl triggerTask = activity.getFlowScope().createActivity(triggerTaskId);
+
+ ClassDelegateActivityBehavior behavior = new ClassDelegateActivityBehavior(
+ WorkflowExceptionTriggerTask.class.getName(), new ArrayList<>(0));
+
+ triggerTask.setActivityBehavior(behavior);
+ triggerTask.setName("Workflow Exception Trigger Task " + triggerTaskIndex);
+ triggerTaskIndex.getAndIncrement();
+
+ TransitionImpl transitionImpl = (TransitionImpl) transition;
+ TransitionImpl triggerTaskOutTransition = triggerTask.createOutgoingTransition();
+ triggerTaskOutTransition.setDestination((ActivityImpl) transitionImpl.getDestination());
+ transitionImpl.setDestination(triggerTask);
+ }
+ } else if ("subProcess".equals(type)) {
+ recurse(new ArrayList<>(activity.getActivities()), triggerTaskIndex);
+ }
+ }
+ }
+ }
/**
- * If there is a WorkflowException object in the execution, this method
- * removes it (saving a copy of it in a different variable).
+ * If there is a WorkflowException object in the execution, this method removes it (saving a copy of it in a
+ * different variable).
*/
- public static class WorkflowExceptionResetListener implements ExecutionListener {
- public void notify(DelegateExecution execution) throws Exception {
- Object workflowException = execution.getVariable("WorkflowException");
+ public static class WorkflowExceptionResetListener implements ExecutionListener {
+ public void notify(DelegateExecution execution) throws Exception {
+ Object workflowException = execution.getVariable("WorkflowException");
- if (workflowException instanceof WorkflowException) {
- int index = 1;
- String saveName = "SavedWorkflowException" + index;
- while (execution.getVariable(saveName) != null) {
- saveName = "SavedWorkflowException" + (++index);
- }
+ if (workflowException instanceof WorkflowException) {
+ int index = 1;
+ String saveName = "SavedWorkflowException" + index;
+ while (execution.getVariable(saveName) != null) {
+ saveName = "SavedWorkflowException" + (++index);
+ }
- logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+ logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
- execution.setVariable(saveName, workflowException);
- execution.setVariable("WorkflowException", null);
- }
- }
- }
+ execution.setVariable(saveName, workflowException);
+ execution.setVariable("WorkflowException", null);
+ }
+ }
+ }
/**
- * Generates an MSOWorkflowException event if there is a WorkflowException
- * object in the execution.
+ * Generates an MSOWorkflowException event if there is a WorkflowException object in the execution.
*/
- public static class WorkflowExceptionTriggerTask implements JavaDelegate {
- public void execute(DelegateExecution execution) throws Exception {
- if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
- logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
- throw new BpmnError("MSOWorkflowException");
- }
- }
- }
+ public static class WorkflowExceptionTriggerTask implements JavaDelegate {
+ public void execute(DelegateExecution execution) throws Exception {
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
+ throw new BpmnError("MSOWorkflowException");
+ }
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index cb20ded8de..6572beaba9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -23,9 +23,7 @@
package org.onap.so.bpmn.infrastructure;
import java.util.Arrays;
-
import javax.xml.ws.Endpoint;
-
import org.apache.cxf.Bus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
@@ -47,45 +45,44 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@Configuration
public class CXFConfiguration {
-
- private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
-
+
+ private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
+
+ @Autowired
+ private Bus bus;
+
+ @Autowired
+ private WorkflowMessageResource wmr;
+
+ @Autowired
+ private WorkflowResource workflowResource;
+
+ @Autowired
+ private WorkflowAsyncResource workflowAsyncResource;
+
@Autowired
- private Bus bus;
-
- @Autowired
- private WorkflowMessageResource wmr;
-
- @Autowired
- private WorkflowResource workflowResource;
-
- @Autowired
- private WorkflowAsyncResource workflowAsyncResource;
-
- @Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
-
- @Autowired
- private ObjectMapper mapper;
-
- @Autowired
- private SDNCCallbackAdapterPortType sdncAdapterCallbackServiceImpl;
-
- @Autowired
- private VnfAdapterNotify vnfAdapterNotifyServiceImpl;
-
- @Bean
+ private JaxRsFilterLogging jaxRsFilterLogging;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ @Autowired
+ private SDNCCallbackAdapterPortType sdncAdapterCallbackServiceImpl;
+
+ @Autowired
+ private VnfAdapterNotify vnfAdapterNotifyServiceImpl;
+
+ @Bean
public ServletRegistrationBean cxfServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/mso/*");
}
-
+
@Bean
public Endpoint vnfAdapterCallback() {
EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl);
@@ -95,7 +92,7 @@ public class CXFConfiguration {
endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
-
+
@Bean
public Endpoint sndcAdapterCallback() {
EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl);
@@ -105,22 +102,22 @@ public class CXFConfiguration {
endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
return endpoint;
}
-
+
@Bean
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
endpoint.setBus(bus);
endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource));
- endpoint.setAddress("/");
+ endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging));
-
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+
return endpoint.create();
}
@Bean
public Swagger2Feature createSwaggerFeature() {
- Swagger2Feature swagger2Feature= new Swagger2Feature();
+ Swagger2Feature swagger2Feature = new Swagger2Feature();
swagger2Feature.setPrettyPrint(true);
swagger2Feature.setTitle("SO Orchestration Application");
swagger2Feature.setContact("The ONAP SO team");
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index af9ab2899e..bd430fd679 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure;
import java.util.List;
import java.util.concurrent.Executor;
-
import org.camunda.bpm.application.PostDeploy;
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
@@ -51,55 +50,53 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication
@EnableAsync
-@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) })
+@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOInfrastructureApplication {
- private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
+ private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
- @Value("${mso.async.core-pool-size}")
- private int corePoolSize;
+ @Value("${mso.async.core-pool-size}")
+ private int corePoolSize;
- @Value("${mso.async.max-pool-size}")
- private int maxPoolSize;
+ @Value("${mso.async.max-pool-size}")
+ private int maxPoolSize;
- @Value("${mso.async.queue-capacity}")
- private int queueCapacity;
+ @Value("${mso.async.queue-capacity}")
+ private int queueCapacity;
- private static final String LOGS_DIR = "logs_dir";
+ private static final String LOGS_DIR = "logs_dir";
- private static void setLogsDir() {
- if (System.getProperty(LOGS_DIR) == null) {
- System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/");
- }
- }
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/");
+ }
+ }
- public static void main(String... args) {
- SpringApplication.run(MSOInfrastructureApplication.class, args);
- System.getProperties().setProperty("mso.config.path", ".");
- setLogsDir();
- }
+ public static void main(String... args) {
+ SpringApplication.run(MSOInfrastructureApplication.class, args);
+ System.getProperties().setProperty("mso.config.path", ".");
+ setLogsDir();
+ }
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- }
+ @PostDeploy
+ public void postDeploy(ProcessEngine processEngineInstance) {}
- @PreUndeploy
- public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
- List<ProcessEngine> processEngines) {
- }
+ @PreUndeploy
+ public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
+ List<ProcessEngine> processEngines) {}
- @Bean
- @Primary
- public Executor asyncExecutor() {
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setTaskDecorator(new MDCTaskDecorator());
- executor.setCorePoolSize(corePoolSize);
- executor.setMaxPoolSize(maxPoolSize);
- executor.setQueueCapacity(queueCapacity);
- executor.setThreadNamePrefix("Camunda-");
- executor.initialize();
- return executor;
- }
+ @Bean
+ @Primary
+ public Executor asyncExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+ executor.setTaskDecorator(new MDCTaskDecorator());
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix("Camunda-");
+ executor.initialize();
+ return executor;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
index ad9e210452..c2af155d51 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
@@ -31,22 +31,19 @@ import org.springframework.util.StringUtils;
@EnableWebSecurity
public class WebSecurityConfigImpl extends WebSecurityConfig {
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.csrf().disable()
- .authorizeRequests()
- .antMatchers("/manage/health","/manage/info").permitAll()
- .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
- .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
- .and()
- .httpBasic();
- }
-
- @Override
- public void configure(WebSecurity web) throws Exception {
- super.configure(web);
- StrictHttpFirewall firewall = new MSOSpringFirewall();
- web.httpFirewall(firewall);
- }
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService",
+ "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
+ .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic();
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
index e56b45f19d..b185f80aaf 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
@@ -1,46 +1,40 @@
/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 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
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 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
+ * 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.
+ * 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=========================================================
-*/
+ */
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader;
-public class RequestHeaderTest{
- RequestHeader rh = new RequestHeader();
+public class RequestHeaderTest {
+ RequestHeader rh = new RequestHeader();
- @Test
- public void testRequestHeader() {
- rh.setRequestId("requestId");
- rh.setSvcInstanceId("svcInstanceId");
- rh.setSvcAction("svcAction");
- rh.setSvcOperation("svcOperation");
- rh.setCallbackUrl("callbackUrl");
- rh.setMsoAction("msoAction");
- assertEquals(rh.getRequestId(), "requestId");
- assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
- assertEquals(rh.getSvcAction(), "svcAction");
- assertEquals(rh.getSvcOperation(), "svcOperation");
- assertEquals(rh.getCallbackUrl(), "callbackUrl");
- assertEquals(rh.getMsoAction(), "msoAction");
- assert(rh.toString()!=null);
- }
+ @Test
+ public void testRequestHeader() {
+ rh.setRequestId("requestId");
+ rh.setSvcInstanceId("svcInstanceId");
+ rh.setSvcAction("svcAction");
+ rh.setSvcOperation("svcOperation");
+ rh.setCallbackUrl("callbackUrl");
+ rh.setMsoAction("msoAction");
+ assertEquals(rh.getRequestId(), "requestId");
+ assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
+ assertEquals(rh.getSvcAction(), "svcAction");
+ assertEquals(rh.getSvcOperation(), "svcOperation");
+ assertEquals(rh.getCallbackUrl(), "callbackUrl");
+ assertEquals(rh.getMsoAction(), "msoAction");
+ assert (rh.toString() != null);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
index 884c2ac9c6..7ce82810be 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
@@ -1,44 +1,38 @@
/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 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
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 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
+ * 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.
+ * 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=========================================================
-*/
+ */
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import org.junit.Test;
import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader;
import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-public class SDNCAdapterCallbackRequestTest{
-
- SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
- CallbackHeader cbh = new CallbackHeader();
- String o = "test";
+public class SDNCAdapterCallbackRequestTest {
+
+ SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
+ CallbackHeader cbh = new CallbackHeader();
+ String o = "test";
- @Test
- public void testSDNCAdapterCallbackRequest() {
- sdnccall.setCallbackHeader(cbh);
- sdnccall.setRequestData(o);
- assertEquals(sdnccall.getCallbackHeader(), cbh);
- assertEquals(sdnccall.getRequestData(), o);
- assertNotNull(sdnccall.toString());
- }
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ sdnccall.setCallbackHeader(cbh);
+ sdnccall.setRequestData(o);
+ assertEquals(sdnccall.getCallbackHeader(), cbh);
+ assertEquals(sdnccall.getRequestData(), o);
+ assertNotNull(sdnccall.toString());
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
index 79bffe40d0..8a976711c6 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
@@ -1,41 +1,35 @@
/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 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
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 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
+ * 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.
+ * 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=========================================================
-*/
+ */
import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader;
import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterRequest;
public class SDNCAdapterRequestTest {
-
- SDNCAdapterRequest adapter = new SDNCAdapterRequest();
- RequestHeader rh = new RequestHeader();
- Object o = new Object();
- @Test
- public void testSDNCAdapterRequest() {
- adapter.setRequestHeader(rh);
- adapter.setRequestData(o);
- assertEquals(adapter.getRequestHeader(), rh);
- assertEquals(adapter.getRequestData(), o);
- }
+ SDNCAdapterRequest adapter = new SDNCAdapterRequest();
+ RequestHeader rh = new RequestHeader();
+ Object o = new Object();
+
+ @Test
+ public void testSDNCAdapterRequest() {
+ adapter.setRequestHeader(rh);
+ adapter.setRequestData(o);
+ assertEquals(adapter.getRequestHeader(), rh);
+ assertEquals(adapter.getRequestData(), o);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
index fc21ff905d..2176dd885b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -31,7 +31,6 @@ import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
-
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
@@ -40,19 +39,19 @@ import com.github.tomakehurst.wiremock.client.WireMock;
@ActiveProfiles("test")
@ContextConfiguration
@AutoConfigureWireMock(port = 0)
-public abstract class BaseIntegrationTest extends WorkflowTest {
- @Autowired
- BPMNUtil bpmnUtil;
+public abstract class BaseIntegrationTest extends WorkflowTest {
+ @Autowired
+ BPMNUtil bpmnUtil;
+
+ @Value("${wiremock.server.port}")
+ protected String wiremockPort;
+
+ @Autowired
+ protected WireMockServer wireMockServer;
- @Value("${wiremock.server.port}")
- protected String wiremockPort;
-
- @Autowired
- protected WireMockServer wireMockServer;
-
- @After
- public void baseAfterTest() {
- wireMockServer.resetAll();
- }
+ @After
+ public void baseAfterTest() {
+ wireMockServer.resetAll();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
index c28a86c49a..0a532663b8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
@@ -19,6 +19,7 @@
*/
package org.onap.so.bpmn;
+
import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
@@ -35,38 +36,27 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
-
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
@Configuration
@EnableTransactionManagement
-@EnableJpaRepositories(
- entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
- basePackages = { "org.onap.so.db.request.data.repository"}
-)
+@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory",
+ transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"})
@Profile({"test"})
public class InfraEmbeddedMariaDbConfig {
@Primary
@Bean(name = "requestEntityManagerFactory")
- public LocalContainerEntityManagerFactoryBean
- entityManagerFactory(
- EntityManagerFactoryBuilder builder,
- DataSource dataSource
- ) {
- return builder
- .dataSource(dataSource)
- .packages("org.onap.so.db.request.beans")
- .persistenceUnit("requestDB")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB")
.build();
}
@Bean(name = "requestTransactionManager")
public PlatformTransactionManager transactionManager(
- @Qualifier("requestEntityManagerFactory") EntityManagerFactory
- entityManagerFactory
- ) {
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
return new JpaTransactionManager(entityManagerFactory);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
index f65cadae3c..bc002c7022 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
@@ -27,6 +27,6 @@ import org.junit.runner.RunWith;
@RunWith(WildcardPatternSuite.class)
@SuiteClasses({"**/*IT.class"})
public class IntegrationTestSuite {
- // the class remains empty,
- // used only as a holder for the above annotations
+ // the class remains empty,
+ // used only as a holder for the above annotations
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
index 5f0722aa3d..f417a550d1 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
@@ -25,14 +25,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.ws.rs.core.Response;
-
import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.RuntimeService;
@@ -52,306 +49,303 @@ import org.springframework.stereotype.Component;
@Component
public class BPMNUtil {
- private static WorkflowAsyncResource workflowResource;
-
- @Autowired
- public void setWorkflowResource(WorkflowAsyncResource workflowResource) {
- BPMNUtil.workflowResource = workflowResource;
- }
-
- public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- return getVariable( processEngineServices, processDefinitionID, name, pID);
- }
-
- public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) {
- assertProcessInstanceFinished(processEngineServices, processInstanceId);
- HistoricVariableInstance responseData = processEngineServices.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
- .variableName(name)
- .singleResult();
-
- if (responseData != null) {
- return (responseData.getValue() != null ? responseData.getValue().toString(): null);
- }
- return null;
- }
-
- /*
- @SuppressWarnings("unchecked")
- public static <T extends Object> T getRawVariable(HistoryService historyService, String processDefinitionID, String name) {
- //String pID = getProcessInstanceId(processEngineServices,
- // processDefinitionID);
- assertProcessInstanceFinished(historyService, pID);
- Object responseData = historyService
- .createHistoricVariableInstanceQuery().processInstanceId(pID)
- .variableName(name)
- .singleResult()
- .getValue();
- return (T) responseData;
- }
- */
-
- @SuppressWarnings("unchecked")
- public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- return getRawVariable( processEngineServices, processDefinitionID, name, pID);
- }
-
- @SuppressWarnings("unchecked")
- public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) {
- assertProcessInstanceFinished(processEngineServices, processInstanceId);
- Object responseData = processEngineServices.getHistoryService()
- .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
- .variableName(name)
- .singleResult()
- .getValue();
- return (T) responseData;
- }
-
-
- public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- assertNotNull(pID);
- assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);
- }
-
- public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {
- assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
- }
-
- public static void assertProcessInstanceFinished(HistoryService historyService, String pid) {
- assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
- }
-
- public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
- assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
- }
-
- public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
- String pID = getProcessInstanceId(processEngineServices,
- processDefinitionID);
- assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count());
- }
-
- private static String getProcessInstanceId(
- ProcessEngineServices processEngineServices, String processDefinitionID) {
- List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
- String pID = null;
- for (HistoricProcessInstance hInstance: historyList) {
- if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
- pID = hInstance.getId();
- break;
- }
- }
- return pID;
- }
-
- public static void cleanHistory(ProcessEngineServices processEngineServices) {
- List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
- List<String> pidList = new ArrayList<>();
- for (HistoricProcessInstance hInstance : historyList) {
- pidList.add(hInstance.getId());
- }
- if (pidList.size() > 0) {
- processEngineServices.getHistoryService().deleteHistoricProcessInstances(pidList);
- }
- }
-
- private static String getProcessInstanceId(
- HistoryService historyService, String processDefinitionID) {
- List<HistoricProcessInstance> historyList = historyService.createHistoricProcessInstanceQuery().list();
- String pID = null;
- for (HistoricProcessInstance hInstance: historyList) {
- if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
- pID = hInstance.getId();
- break;
- }
- }
- return pID;
- }
-
- public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
- return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false;
- }
-
-
- private static void buildVariable(String key, String value, Map<String,Object> variableValueType) {
- Map<String, Object> host = new HashMap<>();
- host.put("value", value);
- host.put("type", "String");
- variableValueType.put(key, host);
- }
-
- public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) {
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<>();
- for (String key : variables.keySet()) {
- buildVariable(key, variables.get(key), variableValueType);
- }
- buildVariable("mso-service-request-timeout","600", variableValueType);
- variableMap.put("variables", variableValueType);
-
- workflowResource.setProcessEngineServices4junit(processEngineServices);
- Response response = workflowResource.startProcessInstanceByKey(
- processKey, variableMap);
- WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
- return workflowResponse;
- }
-
- public static WorkflowResponse executeWorkFlow(RuntimeService runtimeService, String processKey, Map<String,String> variables, WorkflowResource workflowResource) {
-
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<String, Object>();
- for (String key : variables.keySet()) {
- buildVariable(key, variables.get(key), variableValueType);
- }
- buildVariable("mso-service-request-timeout","600", variableValueType);
- variableMap.put("variables", variableValueType);
-
-
- Response response = workflowResource.startProcessInstanceByKey(
- processKey, variableMap);
- WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
- return workflowResponse;
- }
-
- //Check the runtime service to see whether the process is completed
- public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException {
- // Don't wait forever
- long waitTime = 120000;
- long endTime = System.currentTimeMillis() + waitTime;
-
- while (true) {
- if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
- break;
- }
-
- if (System.currentTimeMillis() >= endTime) {
- fail("Process " + pid + " did not finish in " + waitTime + "ms");
- }
-
- Thread.sleep(200);
- }
- }
-
-
- //Check the runtime service to see whether the process is completed
- public static void waitForWorkflowToFinish(RuntimeService runtimeService, String pid) throws InterruptedException {
- // Don't wait forever
- long waitTime = 120000;
- long endTime = System.currentTimeMillis() + waitTime;
-
- while (true) {
- if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
- break;
- }
-
- if (System.currentTimeMillis() >= endTime) {
- fail("Process " + pid + " did not finish in " + waitTime + "ms");
- }
-
- Thread.sleep(200);
- }
- }
-
-
- /**
- * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
- * @param processEngineServices
- * @param processKey
- * @param variables
- * @return
- * @throws InterruptedException
- */
- public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
- ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
- pthread.start();
- BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
- String pid = getProcessInstanceId(processEngineServices, processKey);
- //Caution: If there is a problem with workflow, this may wait for ever
- while (true) {
- pid = getProcessInstanceId(processEngineServices, processKey);
- if (!isProcessInstanceFinished(processEngineServices,pid)) {
- Thread.sleep(200);
- } else{
- break;
- }
- }
- //need to retrieve for second time ?
- pid = getProcessInstanceId(processEngineServices, processKey);
- waitForWorkflowToFinish(processEngineServices, pid);
- return pthread.workflowResponse;
- }
-
- /**
- * Execute workflow using async resource
- * @param processEngineServices
- * @param processKey
- * @param asyncResponse
- * @param variables
- * @throws InterruptedException
- */
- private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<>();
- for (String key : variables.keySet()) {
- buildVariable(key, variables.get(key), variableValueType);
- }
- buildVariable("mso-service-request-timeout","600", variableValueType);
- variableMap.put("variables", variableValueType);
-
- workflowResource.setProcessEngineServices4junit(processEngineServices);
- workflowResource.startProcessInstanceByKey(processKey, variableMap);
- }
-
- /**
- * Helper class which executes workflow in a thread
- *
- */
- static class ProcessThread extends Thread {
-
- public WorkflowResponse workflowResponse = null;
- public String processKey;
- public boolean started;
- public ProcessEngineServices processEngineServices;
- public Map<String,String> variables;
-
- public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map<String,String> variables) {
- this.processKey = processKey;
- this.processEngineServices = processEngineServices;
- this.variables = variables;
- }
-
- public void run() {
- started = true;
- /*doAnswer(new Answer<Void>() {
- public Void answer(InvocationOnMock invocation) {
- Response response = (Response) invocation.getArguments()[0];
- try {
- workflowResponse = (WorkflowResponse) response.getEntity();
- } catch (ClassCastException e) {
- String workflowResponseString = (String)response.getEntity();
- workflowResponse = new WorkflowResponse();
- workflowResponse.setResponse(workflowResponseString);
- workflowResponse.setMessageCode(200);
- }
- return null;
- }
- }).when(asyncResponse).setResponse(any(Response.class));
- */
- try {
- executeAsyncFlow(processEngineServices, processKey, variables);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
+ private static WorkflowAsyncResource workflowResource;
+
+ @Autowired
+ public void setWorkflowResource(WorkflowAsyncResource workflowResource) {
+ BPMNUtil.workflowResource = workflowResource;
+ }
+
+ public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+ String name) {
+ String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+ return getVariable(processEngineServices, processDefinitionID, name, pID);
+ }
+
+ public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+ String name, String processInstanceId) {
+ assertProcessInstanceFinished(processEngineServices, processInstanceId);
+ HistoricVariableInstance responseData =
+ processEngineServices.getHistoryService().createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).variableName(name).singleResult();
+
+ if (responseData != null) {
+ return (responseData.getValue() != null ? responseData.getValue().toString() : null);
+ }
+ return null;
+ }
+
+ /*
+ * @SuppressWarnings("unchecked") public static <T extends Object> T getRawVariable(HistoryService historyService,
+ * String processDefinitionID, String name) { //String pID = getProcessInstanceId(processEngineServices, //
+ * processDefinitionID); assertProcessInstanceFinished(historyService, pID); Object responseData = historyService
+ * .createHistoricVariableInstanceQuery().processInstanceId(pID) .variableName(name) .singleResult() .getValue();
+ * return (T) responseData; }
+ */
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+ String name) {
+ String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+ return getRawVariable(processEngineServices, processDefinitionID, name, pID);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID,
+ String name, String processInstanceId) {
+ assertProcessInstanceFinished(processEngineServices, processInstanceId);
+ Object responseData = processEngineServices.getHistoryService().createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).variableName(name).singleResult().getValue();
+ return (T) responseData;
+ }
+
+
+ public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices,
+ String processDefinitionID) {
+ String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+ assertNotNull(pID);
+ assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID)
+ .finished().count() > 0);
+ }
+
+ public static void assertNoProcessInstance(ProcessEngineServices processEngineServices,
+ String processDefinitionID) {
+ assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
+ }
+
+ public static void assertProcessInstanceFinished(HistoryService historyService, String pid) {
+ assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+ }
+
+ public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+ assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery()
+ .processInstanceId(pid).finished().count());
+ }
+
+ public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices,
+ String processDefinitionID) {
+ String pID = getProcessInstanceId(processEngineServices, processDefinitionID);
+ assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery()
+ .processInstanceId(pID).finished().count());
+ }
+
+ private static String getProcessInstanceId(ProcessEngineServices processEngineServices,
+ String processDefinitionID) {
+ List<HistoricProcessInstance> historyList =
+ processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+ String pID = null;
+ for (HistoricProcessInstance hInstance : historyList) {
+ if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+ pID = hInstance.getId();
+ break;
+ }
+ }
+ return pID;
+ }
+
+ public static void cleanHistory(ProcessEngineServices processEngineServices) {
+ List<HistoricProcessInstance> historyList =
+ processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+ List<String> pidList = new ArrayList<>();
+ for (HistoricProcessInstance hInstance : historyList) {
+ pidList.add(hInstance.getId());
+ }
+ if (pidList.size() > 0) {
+ processEngineServices.getHistoryService().deleteHistoricProcessInstances(pidList);
+ }
+ }
+
+ private static String getProcessInstanceId(HistoryService historyService, String processDefinitionID) {
+ List<HistoricProcessInstance> historyList = historyService.createHistoricProcessInstanceQuery().list();
+ String pID = null;
+ for (HistoricProcessInstance hInstance : historyList) {
+ if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+ pID = hInstance.getId();
+ break;
+ }
+ }
+ return pID;
+ }
+
+ public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+ return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid)
+ .finished().count() == 1 ? true : false;
+ }
+
+
+ private static void buildVariable(String key, String value, Map<String, Object> variableValueType) {
+ Map<String, Object> host = new HashMap<>();
+ host.put("value", value);
+ host.put("type", "String");
+ variableValueType.put(key, host);
+ }
+
+ public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey,
+ Map<String, String> variables) {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout", "600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineServices);
+ Response response = workflowResource.startProcessInstanceByKey(processKey, variableMap);
+ WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+ return workflowResponse;
+ }
+
+ public static WorkflowResponse executeWorkFlow(RuntimeService runtimeService, String processKey,
+ Map<String, String> variables, WorkflowResource workflowResource) {
+
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<String, Object>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout", "600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+
+ Response response = workflowResource.startProcessInstanceByKey(processKey, variableMap);
+ WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+ return workflowResponse;
+ }
+
+ // Check the runtime service to see whether the process is completed
+ public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid)
+ throws InterruptedException {
+ // Don't wait forever
+ long waitTime = 120000;
+ long endTime = System.currentTimeMillis() + waitTime;
+
+ while (true) {
+ if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid)
+ .singleResult() == null) {
+ break;
+ }
+
+ if (System.currentTimeMillis() >= endTime) {
+ fail("Process " + pid + " did not finish in " + waitTime + "ms");
+ }
+
+ Thread.sleep(200);
+ }
+ }
+
+
+ // Check the runtime service to see whether the process is completed
+ public static void waitForWorkflowToFinish(RuntimeService runtimeService, String pid) throws InterruptedException {
+ // Don't wait forever
+ long waitTime = 120000;
+ long endTime = System.currentTimeMillis() + waitTime;
+
+ while (true) {
+ if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
+ break;
+ }
+
+ if (System.currentTimeMillis() >= endTime) {
+ fail("Process " + pid + " did not finish in " + waitTime + "ms");
+ }
+
+ Thread.sleep(200);
+ }
+ }
+
+
+ /**
+ * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
+ *
+ * @param processEngineServices
+ * @param processKey
+ * @param variables
+ * @return
+ * @throws InterruptedException
+ */
+ public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey,
+ Map<String, String> variables) throws InterruptedException {
+ ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
+ pthread.start();
+ BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
+ String pid = getProcessInstanceId(processEngineServices, processKey);
+ // Caution: If there is a problem with workflow, this may wait for ever
+ while (true) {
+ pid = getProcessInstanceId(processEngineServices, processKey);
+ if (!isProcessInstanceFinished(processEngineServices, pid)) {
+ Thread.sleep(200);
+ } else {
+ break;
+ }
+ }
+ // need to retrieve for second time ?
+ pid = getProcessInstanceId(processEngineServices, processKey);
+ waitForWorkflowToFinish(processEngineServices, pid);
+ return pthread.workflowResponse;
+ }
+
+ /**
+ * Execute workflow using async resource
+ *
+ * @param processEngineServices
+ * @param processKey
+ * @param asyncResponse
+ * @param variables
+ * @throws InterruptedException
+ */
+ private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey,
+ Map<String, String> variables) throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout", "600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineServices);
+ workflowResource.startProcessInstanceByKey(processKey, variableMap);
+ }
+
+ /**
+ * Helper class which executes workflow in a thread
+ *
+ */
+ static class ProcessThread extends Thread {
+
+ public WorkflowResponse workflowResponse = null;
+ public String processKey;
+ public boolean started;
+ public ProcessEngineServices processEngineServices;
+ public Map<String, String> variables;
+
+ public ProcessThread(String processKey, ProcessEngineServices processEngineServices,
+ Map<String, String> variables) {
+ this.processKey = processKey;
+ this.processEngineServices = processEngineServices;
+ this.variables = variables;
+ }
+
+ public void run() {
+ started = true;
+ /*
+ * doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { Response response =
+ * (Response) invocation.getArguments()[0]; try { workflowResponse = (WorkflowResponse)
+ * response.getEntity(); } catch (ClassCastException e) { String workflowResponseString =
+ * (String)response.getEntity(); workflowResponse = new WorkflowResponse();
+ * workflowResponse.setResponse(workflowResponseString); workflowResponse.setMessageCode(200); } return
+ * null; } }).when(asyncResponse).setResponse(any(Response.class));
+ */
+ try {
+ executeAsyncFlow(processEngineServices, processKey, variables);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
index f528205d17..2be72184af 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
@@ -16,17 +16,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -36,148 +34,140 @@ import org.onap.so.BaseIntegrationTest;
*/
public class CompleteMsoProcessIT extends BaseIntegrationTest {
-
- private void executeFlow(String inputRequestFile) throws InterruptedException {
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- Map<String, Object> variables = new HashMap<>();
- variables.put("CompleteMsoProcessRequest",inputRequestFile);
- variables.put("mso-request-id", UUID.randomUUID().toString());
- String processId = invokeSubProcess( "CompleteMsoProcess", variables);
- waitForWorkflowToFinish(processEngine,processId);
- logEnd();
- }
-
- @Test
- public void msoCompletionRequestWithNotificationUrl_200() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNotificationurl());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- public void msoCompletionRequestWithNoNotificationurl() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNoNotificationurl());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- @Test
- public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
- logStart();
-
- //Execute Flow
- executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
-
- //Verify Error
- String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
- Assert.assertEquals("200", CMSO_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
- logEnd();
- }
-
- public String gMsoCompletionRequestWithNotificationurl() {
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id>STUW105_5002</ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
-
-
- public String gMsoCompletionRequestWithNoNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id>STUW105_5002</ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url></ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
- public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id></ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url></ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
-
- public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
- + " <ns:request-information>"
- + " <ns:request-id></ns:request-id>"
- + " <ns:request-action>RequestAction</ns:request-action>"
- + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
- + " <ns:source>SOURCE</ns:source>"
- + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
- + " <ns:order-number>10205000</ns:order-number>"
- + " <ns:order-version>1</ns:order-version>"
- + " </ns:request-information>"
- + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
- + "</sdncadapterworkflow:MsoCompletionRequest>";
-
- return xml;
- }
+
+ private void executeFlow(String inputRequestFile) throws InterruptedException {
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("CompleteMsoProcessRequest", inputRequestFile);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("CompleteMsoProcess", variables);
+ waitForWorkflowToFinish(processEngine, processId);
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNotificationUrl_200() throws Exception {
+ logStart();
+
+ // Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurl());
+
+ // Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue(
+ (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNoNotificationurl() throws Exception {
+ logStart();
+
+ // Execute Flow
+ executeFlow(gMsoCompletionRequestWithNoNotificationurl());
+
+ // Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue(
+ (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
+ logStart();
+
+ // Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
+
+ // Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue(
+ (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
+ logStart();
+
+ // Execute Flow
+ executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
+
+ // Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue(
+ (boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ public String gMsoCompletionRequestWithNotificationurl() {
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id>STUW105_5002</ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+
+
+ public String gMsoCompletionRequestWithNoNotificationurl() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id>STUW105_5002</ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>" + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>" + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>" + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
index cc3ca941e4..ad0428c68e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
@@ -16,17 +16,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Ignore;
@@ -38,79 +36,83 @@ import org.onap.so.BaseIntegrationTest;
*/
public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest {
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- public void sunnyDay() throws Exception {
- logStart();
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
- variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
- variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
- String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId);
-
- assertEquals("200", responseCode);
-
- logEnd();
- }
-
- /**
- * Rainy day scenario - nonexisting volume group id.
- *
- * @throws Exception
- */
- @Test
- public void rainyDayNoVolumeGroupId() throws Exception {
- logStart();
-
- // does not exist would return a 404 from AAI
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
- variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
- variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
- String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId);
-
- assertEquals("404", responseCode);
-
- logEnd();
- }
-
- /**
- * Rainy day scenario - volume group name does not match the name in AAI
- *
- *
- * @throws Exception
- */
- @Test
- public void rainyDayNameDoesNotMatch() throws Exception {
- logStart();
-
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
- variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
- variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
- String volumeGroupNameMatches = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_volumeGroupNameMatches",processId);
-
- assertEquals("false", volumeGroupNameMatches);
-
- logEnd();
- }
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void sunnyDay() throws Exception {
+ logStart();
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+ String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName",
+ "CVGN_queryVolumeGroupResponseCode", processId);
+
+ assertEquals("200", responseCode);
+
+ logEnd();
+ }
+
+ /**
+ * Rainy day scenario - nonexisting volume group id.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void rainyDayNoVolumeGroupId() throws Exception {
+ logStart();
+
+ // does not exist would return a 404 from AAI
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST",
+ "aai-volume-group-id-info.xml", 404);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+ String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName",
+ "CVGN_queryVolumeGroupResponseCode", processId);
+
+ assertEquals("404", responseCode);
+
+ logEnd();
+ }
+
+ /**
+ * Rainy day scenario - volume group name does not match the name in AAI
+ *
+ *
+ * @throws Exception
+ */
+ @Test
+ public void rainyDayNameDoesNotMatch() throws Exception {
+ logStart();
+
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+ String volumeGroupNameMatches =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_volumeGroupNameMatches", processId);
+
+ assertEquals("false", volumeGroupNameMatches);
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
index fd1f7c1a2b..f190b6243b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
@@ -19,17 +19,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -40,49 +38,59 @@ import org.onap.so.BaseIntegrationTest;
public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
- @Test
- public void testRemoveLayer3Service_success() throws Exception{
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
-
- String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
- String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
- String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId",processId);
-
- assertEquals("Response", "true", actualNameMatch);
- assertEquals("Response", "true", actualIdMatch);
- assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
- }
-
- @Test
- public void testRemoveLayer3Service_idsNotMatch() throws Exception{
- MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
-
-
- String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
- String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
- String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException",processId);
-
- assertEquals("Response", "true", actualNameMatch);
- assertEquals("Response", "false", actualIdMatch);
- assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]", actualResponse);
-
- }
-
- private void setVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("aicCloudRegion", "MDTWNJ21");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- }
+ @Test
+ public void testRemoveLayer3Service_success() throws Exception {
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
+ "CRTGVNF_queryAAIResponseVolume.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
+
+ String actualNameMatch =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch", processId);
+ String actualIdMatch =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch", processId);
+ String actualResponse =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId", processId);
+
+ assertEquals("Response", "true", actualNameMatch);
+ assertEquals("Response", "true", actualIdMatch);
+ assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
+ }
+
+ @Test
+ public void testRemoveLayer3Service_idsNotMatch() throws Exception {
+ MockGetVolumeGroupById(wireMockServer, "MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58",
+ "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
+
+
+ String actualNameMatch =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch", processId);
+ String actualIdMatch =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch", processId);
+ String actualResponse =
+ BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException", processId);
+
+ assertEquals("Response", "true", actualNameMatch);
+ assertEquals("Response", "false", actualIdMatch);
+ assertEquals("Response",
+ "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]",
+ actualResponse);
+
+ }
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("volumeGroupId", "a8399879-31b3-4973-be26-0a0cbe776b58");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("aicCloudRegion", "MDTWNJ21");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
index f6cd74a55b..47d3799e7d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -26,18 +26,15 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import com.github.tomakehurst.wiremock.WireMockServer;
/**
@@ -45,223 +42,228 @@ import com.github.tomakehurst.wiremock.WireMockServer;
*/
public class CreateAAIVfModuleIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-
- @Test
- public void TestCreateGenericVnfSuccess_200() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC22");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
- variables.put("vfModuleModelName", "MMSC::module-0");
-
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
- String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
- Assert.assertEquals("201", responseCode);
- logger.debug(response);
- }
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+
+ @Test
+ public void TestCreateGenericVnfSuccess_200() {
+
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC22");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+ "CAAIVfMod_createVfModuleResponseCode", processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+ "CAAIVfMod_createVfModuleResponseCode", processId);
+ Assert.assertEquals("201", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestCreateVfModuleSuccess_200() {
+ // create Add-on VF Module for existing Generic VNF
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+ "CAAIVfMod_createVfModuleResponseCode", processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule",
+ "CAAIVfMod_createVfModuleResponseCode", processId);
+ Assert.assertEquals("201", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestQueryGenericVnfFailure_5000() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC23");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(500, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateDupGenericVnfFailure_1002() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC21");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true,
+ exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateDupVfModuleFailure_1002() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateGenericVnfFailure_5000() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC22");
+ variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "PCRF::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestCreateVfModuleSuccess_200() {
- // create Add-on VF Module for existing Generic VNF
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
- variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
- String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
- Assert.assertEquals("201", responseCode);
- logger.debug(response);
- }
+ @Test
+ public void TestCreateGenericVnfFailure_1002() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
- @Test
- public void TestQueryGenericVnfFailure_5000() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC23");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
- variables.put("vfModuleModelName", "MMSC::module-0");
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(500, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
- logger.debug(exception.getErrorMessage());
- }
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "PCRF::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestCreateDupGenericVnfFailure_1002() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC21");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
- variables.put("vfModuleModelName", "MMSC::module-0");
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
- logger.debug(exception.getErrorMessage());
- }
+ @Test
+ public void TestCreateVfModuleFailure_5000() {
+ new MockAAIGenericVnfSearch(wireMockServer);
+ MockAAICreateGenericVnf(wireMockServer);
+ MockAAIVfModulePUT(wireMockServer, true);
- @Test
- public void TestCreateDupVfModuleFailure_1002() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
- variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
- logger.debug(exception.getErrorMessage());
- }
-
- @Test
- public void TestCreateGenericVnfFailure_5000() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfName", "STMTN5MMSC22");
- variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
- variables.put("vfModuleModelName", "PCRF::module-0");
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestCreateGenericVnfFailure_1002() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
- variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
- variables.put("vfModuleModelName", "PCRF::module-0");
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
- logger.debug(exception.getErrorMessage());
- }
+ public static void MockAAICreateGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
+ .willReturn(aResponse().withStatus(201)));
+ wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
- @Test
- public void TestCreateVfModuleFailure_5000() {
- new MockAAIGenericVnfSearch(wireMockServer);
- MockAAICreateGenericVnf(wireMockServer);
- MockAAIVfModulePUT(wireMockServer, true);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("isVidRequest", "false");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
- variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("personaModelVersion", "1.0");
- variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
- variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- String processId = invokeSubProcess("CreateAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModulePUT(WireMockServer wireMockServer, boolean isCreate) {
+ wireMockServer
+ .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC")).willReturn(aResponse().withStatus(isCreate ? 201 : 200)));
+ wireMockServer
+ .stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF")).willReturn(aResponse().withStatus(500)
+ .withHeader("Content-Type", "text/xml").withBodyFile("aaiFault.xml")));
+ wireMockServer.stubFor(
+ put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse().withStatus(200)));
+ }
- public static void MockAAICreateGenericVnf(WireMockServer wireMockServer){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
- .willReturn(aResponse()
- .withStatus(201)));
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModulePUT(WireMockServer wireMockServer, boolean isCreate){
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(isCreate ? 201 : 200)));
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- wireMockServer.stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
index 39a7e0c74b..b78c5b8aad 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
@@ -26,12 +26,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPri
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVfModuleId;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleId;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -45,91 +43,95 @@ import org.slf4j.LoggerFactory;
public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest {
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleVolumeGroupIT.class);
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- public void happyPath() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
- MockGetGenericVnfByIdWithPriority(wireMockServer, "skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
- MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
- invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(200, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
- public void badGet() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
- MockGetVfModuleId(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
- invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
- */
- @Test
- public void badPatch() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
- MockGetVfModuleId(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
- MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "999-99-9999");
- variables.put("isDebugLogEnabled","true");
- variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
- invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleVolumeGroupIT.class);
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetGenericVnfByIdWithPriority(wireMockServer, "skask", "lukewarm", 200,
+ "VfModularity/VfModule-lukewarm.xml", 2);
+ MockPutVfModuleIdNoResponse(wireMockServer, "skask", "PCRF", "lukewarm");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetVfModuleId(wireMockServer, "skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetVfModuleId(wireMockServer, "skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
+ MockPutVfModuleId(wireMockServer, "skask", "lukewarm", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
index 3d15a4b29b..0bfcbd370d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -25,7 +25,6 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Ignore;
@@ -40,56 +39,55 @@ import org.onap.so.BaseIntegrationTest;
public class DecomposeServiceIT extends BaseIntegrationTest {
- public DecomposeServiceIT() throws IOException {
+ public DecomposeServiceIT() throws IOException {
+
+ }
- }
+ @Test
+ public void testDecomposeService_success() throws Exception {
+ MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0",
+ "/getCatalogServiceResourcesDataWithConfig.json");
- @Test
- public void testDecomposeService_success() throws Exception{
- MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json");
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", businessKey, variables);
+ waitForProcessEnd(businessKey, 10000);
- waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue(isProcessEnded(businessKey));
+ }
- }
-
- //@Test
- @Test
- public void testDecomposeService_success_partial() throws Exception{
- MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json");
+ // @Test
+ @Test
+ public void testDecomposeService_success_partial() throws Exception {
+ MockGetServiceResourcesCatalogData(wireMockServer, "cmw-123-456-789", "1.0",
+ "/getCatalogServiceResourcesDataNoNetwork.json");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue(isProcessEnded(businessKey));
- }
+ }
- private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"cmw-123-456-789\"," +
- "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\"," + "\"modelInvariantUuid\": \"cmw-123-456-789\","
+ + "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + "\"modelName\": \"ServicevSAMP12\","
+ + "\"modelVersion\": \"1.0\"," + "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
- }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
index 99e4b8cbde..cac237aec4 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
@@ -16,14 +16,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -36,245 +35,227 @@ import org.slf4j.LoggerFactory;
*/
public class DeleteAAIVfModuleIT extends BaseIntegrationTest {
- private static final String EOL = "\n";
-
- Logger logger = LoggerFactory.getLogger(DeleteAAIVfModuleIT.class);
-
- @Test
- public void TestDeleteGenericVnfSuccess_200() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId);
- String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId);
- Assert.assertEquals("200", responseCode);
- logger.debug(response);
- }
+ private static final String EOL = "\n";
+
+ Logger logger = LoggerFactory.getLogger(DeleteAAIVfModuleIT.class);
+
+ @Test
+ public void TestDeleteGenericVnfSuccess_200() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+ "DAAIVfMod_deleteGenericVnfResponseCode", processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+ "DAAIVfMod_deleteGenericVnfResponseCode", processId);
+ Assert.assertEquals("200", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestDeleteVfModuleSuccess_200() {
+ // delete Add-on Vf Module for existing Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
+ String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest", request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+ "DAAIVfMod_deleteVfModuleResponseCode", processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule",
+ "DAAIVfMod_deleteVfModuleResponseCode", processId);
+ Assert.assertEquals("200", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestQueryGenericVnfFailure_5000() {
+ // query Generic Vnf failure (non-404) with A&AI
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
+ String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest", request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestQueryGenericVnfFailure_1002() {
+ // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
+ String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest", request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestDeleteGenericVnfFailure_5000() {
+ // A&AI failure (non-200) when attempting to delete a Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
+ String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest", request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestDeleteVfModuleSuccess_200() {
- // delete Add-on Vf Module for existing Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
+ @Test
+ public void TestDeleteVfModuleFailure_5000() {
+ // A&AI failure (non-200) when attempting to delete a Vf Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
+ String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest",request);
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId);
- String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId);
- Assert.assertEquals("200", responseCode);
- logger.debug(response);
- }
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest", request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestQueryGenericVnfFailure_5000() {
- // query Generic Vnf failure (non-404) with A&AI
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest",request);
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
+ @Test
+ public void TestDeleteVfModuleFailure_1002_1() {
+ // failure attempting to delete Base Module when not the last Vf Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
+ String request = "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL
+ + " <request-info>" + EOL + " <action>DELETE_VF_MODULE</action>" + EOL
+ + " <source>PORTAL</source>" + EOL + " </request-info>" + EOL + " <vnf-inputs>" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL
+ + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL + "</vnf-request>"
+ + EOL;
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
- @Test
- public void TestQueryGenericVnfFailure_1002() {
- // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest",request);
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
- logger.debug(exception.getErrorMessage());
- }
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest", request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
+ logger.debug(exception.getErrorMessage());
+ }
- @Test
- public void TestDeleteGenericVnfFailure_5000() {
- // A&AI failure (non-200) when attempting to delete a Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest",request);
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
-
- @Test
- public void TestDeleteVfModuleFailure_5000() {
- // A&AI failure (non-200) when attempting to delete a Vf Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest",request);
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(5000, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
- logger.debug(exception.getErrorMessage());
- }
-
- @Test
- public void TestDeleteVfModuleFailure_1002_1() {
- // failure attempting to delete Base Module when not the last Vf Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest",request);
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
- logger.debug(exception.getErrorMessage());
- }
+ @Test
+ public void TestDeleteVfModuleFailure_1002_2() {
+ // failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
+ new MockAAIGenericVnfSearch(wireMockServer);
+ new MockAAIDeleteGenericVnf(wireMockServer);
+ new MockAAIDeleteVfModule(wireMockServer);
- @Test
- public void TestDeleteVfModuleFailure_1002_2() {
- // failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
- new MockAAIGenericVnfSearch(wireMockServer);
- new MockAAIDeleteGenericVnf(wireMockServer);
- new MockAAIDeleteVfModule(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
- String processId = invokeSubProcess("DeleteAAIVfModule", variables);
- WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
- Assert.assertEquals(1002, exception.getErrorCode());
- Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
- logger.debug(exception.getErrorMessage());
- }
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception =
+ BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException", processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
+ logger.debug(exception.getErrorMessage());
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
index 88f8e5deb7..59f46b2a93 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -26,11 +26,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -42,185 +40,164 @@ import org.slf4j.LoggerFactory;
*/
public class FalloutHandlerIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
-
-
- private void setupMocks() {
- wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody("<DbTag>Notified</DbTag>")));
- wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody("<DbTag>Notified</DbTag>")));
- }
-
- private String executeFlow(String inputRequestFile) throws InterruptedException {
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("FalloutHandlerRequest",inputRequestFile); variables.put("mso-request-id", UUID.randomUUID().toString());
- String processId = invokeSubProcess( "FalloutHandler", variables);
- waitForWorkflowToFinish(processEngine,processId);
- logEnd();
- return processId;
- }
-
- @Test
- public void msoFalloutHandlerWithNotificationurl_200() throws Exception{
- //Setup Mocks
- setupMocks();
- //Execute Flow
- String processId = executeFlow(gMsoFalloutHandlerWithNotificationurl());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode",processId);
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator",processId));
- }
-
- public String gMsoFalloutHandlerWithNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
-
- }
-
-
-
-
- @Test
- public void msoFalloutHandlerWithNoNotificationurl() throws Exception{
-
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNoNotificationurl() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url></ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
- @Test
-
- public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- logger.debug("STARTED TEST: {}", method);
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id></ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url>www.test.com</ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
- @Test
-
- public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{
- String method = getClass().getSimpleName() + "." + new Object() {
- }.getClass().getEnclosingMethod().getName();
- logger.debug("STARTED TEST: {}", method);
- //Setup Mocks
- setupMocks();
- //Execute Flow
- executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
- //Verify Error
- String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
- Assert.assertEquals("200", FH_ResponseCode);
- Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
- }
-
- public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
- //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
- String xml = ""
- + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
- + " <ns7:request-information>"
- + " <ns7:request-id></ns7:request-id>"
- + " <ns7:request-action>requestAction</ns7:request-action>"
- + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
- + " <ns7:source>source</ns7:source>"
- + " <ns7:notification-url></ns7:notification-url>"
- + " <ns7:order-number>10205000</ns7:order-number>"
- + " <ns7:order-version>1</ns7:order-version>"
- + " </ns7:request-information>"
- + " <sdncadapterworkflow:WorkflowException>"
- + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
- + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
- + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
- + " </sdncadapterworkflow:WorkflowException>"
- + "</sdncadapterworkflow:FalloutHandlerRequest>";
-
- return xml;
- }
-
+
+ Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class);
+
+
+ private void setupMocks() {
+ wireMockServer.stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter")).willReturn(aResponse()
+ .withStatus(200).withHeader("Content-Type", "text/xml").withBody("<DbTag>Notified</DbTag>")));
+ wireMockServer.stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")).willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "text/xml").withBody("<DbTag>Notified</DbTag>")));
+ }
+
+ private String executeFlow(String inputRequestFile) throws InterruptedException {
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("FalloutHandlerRequest", inputRequestFile);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("FalloutHandler", variables);
+ waitForWorkflowToFinish(processEngine, processId);
+ logEnd();
+ return processId;
+ }
+
+ @Test
+ public void msoFalloutHandlerWithNotificationurl_200() throws Exception {
+ // Setup Mocks
+ setupMocks();
+ // Execute Flow
+ String processId = executeFlow(gMsoFalloutHandlerWithNotificationurl());
+ // Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode", processId);
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue(
+ (boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator", processId));
+ }
+
+ public String gMsoFalloutHandlerWithNotificationurl() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+
+ }
+
+
+
+ @Test
+ public void msoFalloutHandlerWithNoNotificationurl() throws Exception {
+
+ // Setup Mocks
+ setupMocks();
+ // Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
+ // Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNoNotificationurl() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>" + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+ @Test
+
+ public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception {
+ String method = getClass().getSimpleName() + "." + new Object() {}.getClass().getEnclosingMethod().getName();
+ logger.debug("STARTED TEST: {}", method);
+ // Setup Mocks
+ setupMocks();
+ // Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
+ // Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url>www.test.com</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+ @Test
+
+ public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception {
+ String method = getClass().getSimpleName() + "." + new Object() {}.getClass().getEnclosingMethod().getName();
+ logger.debug("STARTED TEST: {}", method);
+ // Setup Mocks
+ setupMocks();
+ // Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
+ // Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
+ // Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>" + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>" + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>" + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>" + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
index 7299e0602e..ff0b318df9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
@@ -22,10 +22,8 @@ package org.onap.so.bpmn.common;
import static org.junit.Assert.assertNotNull;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-
import java.util.HashMap;
import java.util.Map;
-
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Ignore;
@@ -37,42 +35,37 @@ import org.onap.so.BaseIntegrationTest;
*/
public class GenerateVfModuleNameIT extends BaseIntegrationTest {
- private static final String EOL = "\n";
-
- @Test
- public void TestGenerateVfModuleNameSuvvess() {
- //
- String request =
- "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>CREATE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
- " <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL +
- " <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
+ private static final String EOL = "\n";
+
+ @Test
+ public void TestGenerateVfModuleNameSuvvess() {
+ //
+ String request =
+ "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL + " <request-info>" + EOL
+ + " <action>CREATE_VF_MODULE</action>" + EOL + " <source>PORTAL</source>" + EOL
+ + " </request-info>" + EOL + " <vnf-inputs>" + EOL + " <vnf-name>STMTN5MMSC22</vnf-name>"
+ + EOL + " <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL
+ + " <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL
+ + " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL + " </vnf-inputs>" + EOL
+ + " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL
+ + "</vnf-request>" + EOL;
+
+ MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ RuntimeService runtimeService = processEngine.getRuntimeService();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfName", "STMTN5MMSC20");
+ variables.put("vfModuleLabel", "ModuleLabel1");
+ variables.put("personaModelId", "extrovert");
+ variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
+
+ runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
+ String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName");
- MockGetGenericVnfById(wireMockServer, ".*", "GenericFlows/getGenericVnfByNameResponse.xml");
- RuntimeService runtimeService = processEngine.getRuntimeService();
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("isDebugLogEnabled","true");
- variables.put("vnfName", "STMTN5MMSC20");
- variables.put("vfModuleLabel", "ModuleLabel1");
- variables.put("personaModelId", "extrovert");
- variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
-
- runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
- String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName");
-
- assertNotNull(response);
- }
+ assertNotNull(response);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
index 53d29c51bf..97a09d84aa 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
@@ -23,12 +23,10 @@
package org.onap.so.bpmn.common;
import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.engine.task.TaskQuery;
@@ -42,58 +40,58 @@ import org.slf4j.LoggerFactory;
* Unit test for RainyDayHandler.bpmn.
*/
public class ManualHandlingIT extends BaseIntegrationTest {
- Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
-
- @Test
- public void TestManualHandlingSuccess() {
- MockPostRequestDB(wireMockServer);
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceType", "X");
- variables.put("vnfType", "Y");
- variables.put("currentActivity", "BB1");
- variables.put("workStep", "1");
- variables.put("failedActivity", "AAI");
- variables.put("vnfName", "vSAMP12");
- variables.put("errorCode", "123");
- variables.put("errorText", "update failed");
- variables.put("validResponses", "Rollback");
- variables.put("vnfName", "vSAMP1");
-
-
- String businessKey = UUID.randomUUID().toString();
- invokeSubProcess("ManualHandling", businessKey, variables);
-
- try {
- Thread.sleep(5);
- } catch (Exception e) {
-
- }
-
- TaskService taskService = processEngine.getTaskService();
-
- TaskQuery q = taskService.createTaskQuery();
-
- List<Task> tasks = q.orderByTaskCreateTime().asc().list();
-
- for (Task task : tasks) {
- logger.debug("TASK ID: {}", task.getId());
- logger.debug("TASK NAME: {}", task.getName());
-
- try {
- logger.debug("Completing the task");
- Map<String,Object> completeVariables = new HashMap<>();
- completeVariables.put("responseValue", "skip");
- taskService.complete(task.getId(), completeVariables);
- } catch(Exception e) {
- logger.debug("GOT EXCEPTION: {}", e.getMessage());
- }
- }
-
- waitForProcessEnd(businessKey, 100000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- }
+ Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class);
+
+ @Test
+ public void TestManualHandlingSuccess() {
+ MockPostRequestDB(wireMockServer);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceType", "X");
+ variables.put("vnfType", "Y");
+ variables.put("currentActivity", "BB1");
+ variables.put("workStep", "1");
+ variables.put("failedActivity", "AAI");
+ variables.put("vnfName", "vSAMP12");
+ variables.put("errorCode", "123");
+ variables.put("errorText", "update failed");
+ variables.put("validResponses", "Rollback");
+ variables.put("vnfName", "vSAMP1");
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("ManualHandling", businessKey, variables);
+
+ try {
+ Thread.sleep(5);
+ } catch (Exception e) {
+
+ }
+
+ TaskService taskService = processEngine.getTaskService();
+
+ TaskQuery q = taskService.createTaskQuery();
+
+ List<Task> tasks = q.orderByTaskCreateTime().asc().list();
+
+ for (Task task : tasks) {
+ logger.debug("TASK ID: {}", task.getId());
+ logger.debug("TASK NAME: {}", task.getName());
+
+ try {
+ logger.debug("Completing the task");
+ Map<String, Object> completeVariables = new HashMap<>();
+ completeVariables.put("responseValue", "skip");
+ taskService.complete(task.getId(), completeVariables);
+ } catch (Exception e) {
+ logger.debug("GOT EXCEPTION: {}", e.getMessage());
+ }
+ }
+
+ waitForProcessEnd(businessKey, 100000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
index 052fd5dc94..45ef0add2b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
@@ -23,18 +23,16 @@ package org.onap.so.bpmn.common;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteGenericVnf {
- public MockAAIDeleteGenericVnf(WireMockServer wireMockServer){
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- }
+ public MockAAIDeleteGenericVnf(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
index 1cbe0b9244..f405fc943b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
@@ -24,31 +24,30 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIDeleteVfModule {
-
- public MockAAIDeleteVfModule(WireMockServer wireMockServer)
- {
- wireMockServer.stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
- .willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
- .willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
- .willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(delete(urlMatching(
- "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
- .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
- .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse().withStatus(200)));
- }
+ public MockAAIDeleteVfModule(WireMockServer wireMockServer) {
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ wireMockServer.stubFor(
+ get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
+
+ wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
index 1d6337ffc4..a33268efbe 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
@@ -23,319 +23,219 @@ package org.onap.so.bpmn.common;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-
import com.github.tomakehurst.wiremock.WireMockServer;
public class MockAAIGenericVnfSearch {
-
- private static final String EOL = "\n";
- public MockAAIGenericVnfSearch(WireMockServer wireMockServer){
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- // The following stubs are for DeleteAAIVfModule
-
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- }
+ private static final String EOL = "\n";
+
+ public MockAAIGenericVnfSearch(WireMockServer wireMockServer) {
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ wireMockServer.stubFor(
+ get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ wireMockServer.stubFor(
+ get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
+ .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
+ .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body = "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>1508691</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(
+ get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>1508691</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>1508692</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(
+ get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ // The following stubs are for DeleteAAIVfModule
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
+ .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000021</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000073</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000020</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000074</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000075</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000019</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000076</resource-version>" + EOL + " </vf-module>" + EOL
+ + " <vf-module>" + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>"
+ + EOL + " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>false</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000077</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000018</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000078</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
+ + " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
+ + " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + " <vnf-type>mmsc-capacity</vnf-type>" + EOL
+ + " <service-id>SDN-MOBILITY</service-id>" + EOL + " <equipment-role>vMMSC</equipment-role>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL + " <in-maint>false</in-maint>"
+ + EOL + " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
+ + " <resource-version>0000021</resource-version>" + EOL + " <vf-modules>" + EOL + " <vf-module>"
+ + EOL + " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
+ + " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
+ + " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
+ + " <persona-model-version>1.0</persona-model-version>" + EOL
+ + " <is-base-vf-module>true</is-base-vf-module>" + EOL
+ + " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
+ + " <orchestration-status>pending-create</orchestration-status>" + EOL
+ + " <resource-version>0000073</resource-version>" + EOL + " </vf-module>" + EOL
+ + " </vf-modules>" + EOL + " <relationship-list/>" + EOL + " <l-interfaces/>" + EOL
+ + " <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
+ wireMockServer.stubFor(get(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
+
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
index 6a9ff2a4a8..0154f2eae7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
@@ -24,12 +24,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
public class MockLoggerDelegate implements JavaDelegate {
- @Override
- public void execute(DelegateExecution execution) throws Exception {
- System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId="
- + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId()
- + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId="
- + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey()
- + ", executionId=" + execution.getId() + " \n\n");
- }
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId="
+ + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId()
+ + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId="
+ + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey()
+ + ", executionId=" + execution.getId() + " \n\n");
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
index 4d7a127a85..c128f58103 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
@@ -25,14 +25,12 @@ import static org.junit.Assert.assertNull;
import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
import static org.onap.so.bpmn.mock.StubResponseOof.mockOof;
import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -65,12 +63,12 @@ public class OofHomingIT extends BaseIntegrationTest {
String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf.json");
String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json");
- String oofCallbackNoSolution = FileUtil.
- readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json");
- String oofCallbackPolicyException = FileUtil.
- readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json");
- String oofCallbackServiceException = FileUtil.
- readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json");
+ String oofCallbackNoSolution =
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json");
+ String oofCallbackPolicyException =
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json");
+ String oofCallbackServiceException =
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json");
callbacks.put("oof", JSON, "oofResponse", oofCallback);
callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
@@ -121,133 +119,73 @@ public class OofHomingIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setNfFunction("testVnfFunctionName");
- vnf.getHomingSolution().setOofDirectives(
- "{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"sdnc_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }");
+ vnf.getHomingSolution().setOofDirectives("{ \n" + " \"directives\":[ \n" + " { \n"
+ + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " },\n" + " \"sdnc_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -264,11 +202,12 @@ public class OofHomingIT extends BaseIntegrationTest {
serviceDecomposition.setServiceInstance(si);
// Subscriber
- subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber =
+ "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
}
- @Test
+ @Test
public void testHoming_success_2AR1Vnf() throws Exception {
mockOof(wireMockServer);
@@ -283,11 +222,11 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -305,22 +244,23 @@ public class OofHomingIT extends BaseIntegrationTest {
expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+ "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
"\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
- resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
- null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
- true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+ resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(verifyOofRequest(), expectedOofRequest);
}
- @Test
+ @Test
public void testHoming_success_2AR1Vnf2Net() throws Exception {
mockOof(wireMockServer);
@@ -335,11 +275,11 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -367,28 +307,27 @@ public class OofHomingIT extends BaseIntegrationTest {
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+ "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
"\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
- resourceARHoming2.getVnf().getResourceId(),
- "aic", "testCloudRegionId2",
- null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud","aic",
- "testCloudRegionId3",
- true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+ resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
- assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
- "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
- "testCloudRegionIdNet",
- null, null), resourceNetHomingString);
- assertEquals(homingSolutionCloud("cloud", "aic",
- "testCloudRegionIdNet2",
- false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+ assertEquals(
+ homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet",
+ resourceNetHoming.getVnf().getResourceId(), "aic", "testCloudRegionIdNet", null, null),
+ resourceNetHomingString);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionIdNet2", false,
+ "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
resourceNetHoming2String);
assertEquals(verifyOofRequest(), expectedOofRequest);
@@ -402,8 +341,7 @@ public class OofHomingIT extends BaseIntegrationTest {
"/BuildingBlocks/oofCatalogResp.json");
String busKey = UUID.randomUUID().toString();
Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123",
- "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
invokeSubProcess("DecomposeService", busKey, vars);
ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
@@ -438,12 +376,12 @@ public class OofHomingIT extends BaseIntegrationTest {
injectWorkflowMessages(callbacks, "oof3");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
+ // Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp);
Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
@@ -457,26 +395,26 @@ public class OofHomingIT extends BaseIntegrationTest {
assertNull(workflowException);
- //Verify request
+ // Verify request
String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
System.out.println("oofRequest is: " + oofRequest);
- assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
- replaceAll("\n", "").replaceAll("\r", "").
- replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
- replaceAll("\r", "").replaceAll("\t", ""));
-
- //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
-
- assertEquals(homingSolutionService("service", "service-instance-01234",
- "MDTNJ01", "test-resource-id-000","CloudOwner",
- "mtmnj1a",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ assertEquals(
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").replaceAll("\n", "")
+ .replaceAll("\r", "").replaceAll("\t", ""),
+ oofRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+
+ // System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " +
+ // resourceVnfHoming.getVnf().getResourceId());
+
+ assertEquals(
+ homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000",
+ "CloudOwner", "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVnfHomingString);
}
- @Test
+ @Test
public void testHoming_success_existingLicense() throws Exception {
mockOof(wireMockServer);
@@ -491,9 +429,11 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -511,24 +451,25 @@ public class OofHomingIT extends BaseIntegrationTest {
oofRequest = oofRequest.replaceAll("\\s+", "");
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- "aic", "dfwtx", "KDTNJ01",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
- resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
- null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "aic",
- "testCloudRegionId3",
- false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+ resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionId3", false,
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(verifyOofRequestExistingLicense(), oofRequest);
}
- @Test
+ @Test
public void testHoming_error_inputVariable() throws Exception {
String businessKey = UUID.randomUUID().toString();
@@ -539,15 +480,15 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
- "input variable is missing or null,workStep=*]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required "
+ + "input variable is missing or null,workStep=*]", workflowException.toString());
}
- @Test
+ @Test
public void testHoming_error_badResponse() throws Exception {
mockOof_500(wireMockServer);
@@ -559,14 +500,16 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString());
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]",
+ workflowException.toString());
}
- @Test
+ @Test
public void testHoming_error_oofNoSolution() throws Exception {
mockOof(wireMockServer);
@@ -580,15 +523,16 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
- "Response contains error: Unable to find any candidate for demand *** Response:");
- assert(errorMatch);
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Boolean errorMatch = workflowException.toString()
+ .contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+ + "Response contains error: Unable to find any candidate for demand *** Response:");
+ assert (errorMatch);
}
- @Test
+ @Test
public void testHoming_error_oofPolicyException() throws Exception {
mockOof(wireMockServer);
@@ -602,16 +546,16 @@ public class OofHomingIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
- "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
- "limit]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+ + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable "
+ + "limit]", workflowException.toString());
}
- @Test
+ @Test
public void testHoming_error_oofServiceException() throws Exception {
mockOof(wireMockServer);
@@ -623,14 +567,15 @@ public class OofHomingIT extends BaseIntegrationTest {
injectWorkflowMessages(callbacks, "oofServiceEx");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
- "Response contains a Request Error Service Exception: OOF PlacementError: " +
- "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
- "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+ + "Response contains a Request Error Service Exception: OOF PlacementError: "
+ + "requests.exceptions.HTTPError: 404 Client Error: Not Found for "
+ + "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
workflowException.toString());
}
@@ -649,7 +594,7 @@ public class OofHomingIT extends BaseIntegrationTest {
variables.put("cloudRegionId", "TNZED");
variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
variables.put("vgMuxInfraModelId", "testArModelUuid");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId123");
variables.put("serviceInstanceName", "testServiceName");
@@ -716,7 +661,7 @@ public class OofHomingIT extends BaseIntegrationTest {
variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
variables.put("vgMuxInfraModelId", "testArModelUuid");
variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId123");
variables.put("serviceInstanceName", "testServiceName");
@@ -727,11 +672,15 @@ public class OofHomingIT extends BaseIntegrationTest {
private void setVariablesExistingLicense(Map<String, Object> variables) {
HomingSolution currentHomingSolution = new HomingSolution();
serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addEntitlementPool("testEntitlementPoolId2");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId2");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
@@ -742,56 +691,52 @@ public class OofHomingIT extends BaseIntegrationTest {
}
private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
- String vnfResourceId, String cloudOwner,
- String cloudRegionId, String enList,
- String licenseList){
+ String vnfResourceId, String cloudOwner, String cloudRegionId, String enList, String licenseList) {
String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
- serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
- cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
- "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
- " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
- " \"rehome\" : false } }";
- }else{
- //language=JSON
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
- serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
- cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
- " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
- " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
- " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+ + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+ + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId
+ + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :"
+ + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { },"
+ + " \"rehome\" : false } }";
+ } else {
+ // language=JSON
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+ + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+ + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :"
+ + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :"
+ + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :"
+ + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList
+ + " ] }, \"rehome\" : false } }";
}
return solution;
}
- private String homingSolutionCloud(String type, String cloudOwner,
- String cloudRegionId, Boolean flavors, String enList,
- String licenseList){
+ private String homingSolutionCloud(String type, String cloudOwner, String cloudRegionId, Boolean flavors,
+ String enList, String licenseList) {
String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"license\" : { }, \"rehome\" : false } }";
- } else if (flavors && enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
- "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
- "\"license\" : { }, \"rehome\" : false } }";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors && enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId
+ + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+ + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+ + "\"license\" : { }, \"rehome\" : false } }";
} else if (flavors) {
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
- "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
- "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
- licenseList + " ] }, \"rehome\" : false } }";
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId
+ + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+ + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+ + "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ "
+ + licenseList + " ] }, \"rehome\" : false } }";
} else {
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
- licenseList + " ] }, \"rehome\" : false } }";
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { \"entitlementPoolList\" : [ "
+ + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
}
return solution;
}
@@ -814,68 +759,67 @@ public class OofHomingIT extends BaseIntegrationTest {
variables.put("cloudRegionId", "TNZED");
- String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
- "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":"
+ + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
variables.put("serviceModelInfo", serviceModelInfo);
}
private String verifyOofRequest() {
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
- "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
- "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
- "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
- "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
- "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
- "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" +
- ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
- "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
- "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" +
- "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," +
- "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," +
- "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
- "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," +
- "\"modelType\":\"\",\"modelVersion\":\"\"," +
- "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" +
- "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" +
- ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" +
- "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" +
- ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
- "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
- "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
- "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
- "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
- "\"}}}";
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+ + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\","
+ + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"],"
+ + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":"
+ + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":"
+ + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+ + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\""
+ + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":"
+ + "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\","
+ + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":"
+ + "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}},"
+ + "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\","
+ + "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\","
+ + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\","
+ + "\"modelType\":\"\",\"modelVersion\":\"\","
+ + "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\""
+ + "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\""
+ + ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\""
+ + "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\""
+ + ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":"
+ + "{\"serviceInstanceId\":\"testServiceInstanceId123\","
+ + "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":"
+ + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\","
+ + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + "\"}}}";
return request;
}
- private String verifyOofRequestExistingLicense(){
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
- "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
- "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
- "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
- "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
- "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
- "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
- "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
- "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
- "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
- "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
- "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
- "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
- "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
- "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
- "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
- "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
- "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
- "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
- "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
- "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
- "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
- "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
- "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
- "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
- "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
- "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ private String verifyOofRequestExistingLicense() {
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+ + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\","
+ + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],"
+ + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\","
+ + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":"
+ + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":"
+ + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+ + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":"
+ + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\","
+ + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\","
+ + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\","
+ + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":"
+ + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":"
+ + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":"
+ + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\","
+ + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\","
+ + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\","
+ + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":"
+ + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\","
+ + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":"
+ + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\","
+ + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\","
+ + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},"
+ + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\","
+ + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\","
+ + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":"
+ + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
return request;
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
index 390f5294aa..39a8995607 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -38,14 +38,12 @@ import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.mock.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
@@ -59,7 +57,7 @@ import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
@Ignore
public class OofHomingTestIT extends BaseIntegrationTest {
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
String subscriber = "";
@@ -72,12 +70,11 @@ public class OofHomingTestIT extends BaseIntegrationTest {
String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf");
String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net");
- String oofCallbackNoSolution = FileUtil.
- readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound");
- String oofCallbackPolicyException = FileUtil.
- readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException");
- String oofCallbackServiceException = FileUtil.
- readResourceFile("__files/BuildingBlocks/oofCallbackServiceException");
+ String oofCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound");
+ String oofCallbackPolicyException =
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException");
+ String oofCallbackServiceException =
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackServiceException");
callbacks.put("oof", JSON, "oofResponse", oofCallback);
callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
@@ -128,133 +125,73 @@ public class OofHomingTestIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setResourceInstanceName("testVnfInstanceName");
- vnf.getHomingSolution().setOofDirectives(
- "{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " \"sdnc_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"vnfc_directives\":[ \n" +
- " { \n" +
- " \"vnfc_id\":\"<ID of VNFC>\",\n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
- " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
- " \"attribute_value\":\"<value such as direct/normal>\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
- " \"attribute_value\":\"<value such as physnet>\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"vnf_directives\":{ \n" +
- " \"directives\":[ \n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value>\"\n" +
- " }\n" +
- " ]\n" +
- " },\n" +
- " { \n" +
- " \"directive_name\":\"<Name of directive>\",\n" +
- " \"attributes\":[ \n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " },\n" +
- " { \n" +
- " \"attribute_name\":\"<name of attribute>\",\n" +
- " \"attribute_value\":\"<value >\"\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " ]\n" +
- " }\n" +
- " }\n" +
- " ]\n" +
- " }");
+ vnf.getHomingSolution().setOofDirectives("{ \n" + " \"directives\":[ \n" + " { \n"
+ + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " },\n" + " \"sdnc_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"vnfc_directives\":[ \n" + " { \n"
+ + " \"vnfc_id\":\"<ID of VNFC>\",\n" + " \"directives\":[ \n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n"
+ + " \"attribute_value\":\"<value such as cloud specific flavor>\"\n"
+ + " }\n" + " ]\n" + " },\n"
+ + " { \n"
+ + " \"directive_name\":\"<Name of directive,example vnic-info>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n"
+ + " \"attribute_value\":\"<value such as direct/normal>\"\n"
+ + " },\n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n"
+ + " \"attribute_value\":\"<value such as physnet>\"\n"
+ + " }\n" + " ]\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " },\n" + " { \n"
+ + " \"vnf_directives\":{ \n" + " \"directives\":[ \n"
+ + " { \n" + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value>\"\n" + " }\n"
+ + " ]\n" + " },\n" + " { \n"
+ + " \"directive_name\":\"<Name of directive>\",\n"
+ + " \"attributes\":[ \n" + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " },\n"
+ + " { \n"
+ + " \"attribute_name\":\"<name of attribute>\",\n"
+ + " \"attribute_value\":\"<value >\"\n" + " }\n"
+ + " ]\n" + " }\n" + " ]\n" + " }\n"
+ + " }\n" + " ]\n" + " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -271,7 +208,8 @@ public class OofHomingTestIT extends BaseIntegrationTest {
serviceDecomposition.setServiceInstance(si);
// Subscriber
- subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber =
+ "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
}
@@ -285,17 +223,17 @@ public class OofHomingTestIT extends BaseIntegrationTest {
Map<String, Object> variables = new HashMap<>();
setVariables(variables);
- invokeSubProcess("Homing", businessKey, variables);
+ invokeSubProcess("Homing", businessKey, variables);
injectWorkflowMessages(callbacks, "oof2");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -313,17 +251,18 @@ public class OofHomingTestIT extends BaseIntegrationTest {
expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+ "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
"\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
- resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
- null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
- true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+ resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(verifyOofRequest(), expectedOofRequest);
}
@@ -338,17 +277,17 @@ public class OofHomingTestIT extends BaseIntegrationTest {
Map<String, Object> variables = new HashMap<>();
setVariables2(variables);
- invokeSubProcess("Homing", businessKey, variables);
+ invokeSubProcess("Homing", businessKey, variables);
injectWorkflowMessages(callbacks, "oof3");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -376,28 +315,27 @@ public class OofHomingTestIT extends BaseIntegrationTest {
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", resourceARHoming.getVnf().getResourceId(),
+ "aic", "dfwtx", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
"\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
- resourceARHoming2.getVnf().getResourceId(),
- "aic", "testCloudRegionId2",
- null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud","aic",
- "testCloudRegionId3",
- true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+ resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionId3", true,
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
- assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
- "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
- "testCloudRegionIdNet",
- null, null), resourceNetHomingString);
- assertEquals(homingSolutionCloud("cloud", "aic",
- "testCloudRegionIdNet2",
- false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+ assertEquals(
+ homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet",
+ resourceNetHoming.getVnf().getResourceId(), "aic", "testCloudRegionIdNet", null, null),
+ resourceNetHomingString);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionIdNet2", false,
+ "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
resourceNetHoming2String);
assertEquals(verifyOofRequest(), expectedOofRequest);
@@ -413,12 +351,10 @@ public class OofHomingTestIT extends BaseIntegrationTest {
"/BuildingBlocks/oofCatalogResp.json");
String busKey = UUID.randomUUID().toString();
Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123",
- "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
invokeSubProcess("DecomposeService", busKey, vars);
- ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey,
- "serviceDecomposition");
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = {}", sd);
List<VnfResource> vnfResourceList = sd.getVnfResources();
vnfResourceList.get(0).setResourceId("test-resource-id-000");
@@ -450,12 +386,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
injectWorkflowMessages(callbacks, "oof3");
waitForProcessEnd(businessKey, 10000);
- //Get Variables
+ // Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
- "serviceDecomposition");
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
logger.debug("serviceDecompositionExp is: {}", serviceDecompositionExp);
Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
@@ -469,21 +405,20 @@ public class OofHomingTestIT extends BaseIntegrationTest {
assertNull(workflowException);
- //Verify request
+ // Verify request
String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
logger.debug("oofRequest is: {}", oofRequest);
- assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
- replaceAll("\n", "").replaceAll("\r", "").
- replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
- replaceAll("\r", "").replaceAll("\t", ""));
-
- assertEquals(homingSolutionService("service", "service-instance-01234",
- "MDTNJ01", "test-resource-id-000","CloudOwner",
- "mtmnj1a",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
- " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ assertEquals(
+ FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").replaceAll("\n", "")
+ .replaceAll("\r", "").replaceAll("\t", ""),
+ oofRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+
+ assertEquals(
+ homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000",
+ "CloudOwner", "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVnfHomingString);
}
@Test
@@ -501,9 +436,11 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
@@ -521,18 +458,19 @@ public class OofHomingTestIT extends BaseIntegrationTest {
oofRequest = oofRequest.replaceAll("\\s+", "");
assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
- "aic", "dfwtx", "KDTNJ01",
- "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
- resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
- null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "aic",
- "testCloudRegionId3",
- false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
- "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ assertEquals(
+ homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(), "aic", "testCloudRegionId2", null, null),
+ resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "aic", "testCloudRegionId3", false,
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(verifyOofRequestExistingLicense(), oofRequest);
@@ -549,12 +487,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
- "input variable is missing or null]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required "
+ + "input variable is missing or null]", workflowException.toString());
}
@Test
@@ -570,12 +508,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " +
- "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a "
+ + "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
}
@Test
@@ -593,12 +531,12 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " +
- "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found "
+ + "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
}
@Test
@@ -616,13 +554,13 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
- "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
- "limit]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+ + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable "
+ + "limit]", workflowException.toString());
}
@Test
@@ -640,14 +578,15 @@ public class OofHomingTestIT extends BaseIntegrationTest {
waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
- "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
- "Response contains a Request Error Service Exception: OOF PlacementError: " +
- "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
- "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback "
+ + "Response contains a Request Error Service Exception: OOF PlacementError: "
+ + "requests.exceptions.HTTPError: 404 Client Error: Not Found for "
+ + "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
workflowException.toString());
}
@@ -665,7 +604,7 @@ public class OofHomingTestIT extends BaseIntegrationTest {
variables.put("cloudOwner", "amazon");
variables.put("cloudRegionId", "TNZED");
variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId");
variables.put("serviceDecomposition", serviceDecomposition);
@@ -726,7 +665,7 @@ public class OofHomingTestIT extends BaseIntegrationTest {
variables.put("cloudOwner", "amazon");
variables.put("cloudRegionId", "TNZED");
variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
+ // variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId");
variables.put("serviceDecomposition", null);
@@ -736,11 +675,15 @@ public class OofHomingTestIT extends BaseIntegrationTest {
private void setVariablesExistingLicense(Map<String, Object> variables) {
HomingSolution currentHomingSolution = new HomingSolution();
serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addEntitlementPool("testEntitlementPoolId2");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId2");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
@@ -751,56 +694,52 @@ public class OofHomingTestIT extends BaseIntegrationTest {
}
private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
- String vnfResourceId, String cloudOwner,
- String cloudRegionId, String enList,
- String licenseList){
+ String vnfResourceId, String cloudOwner, String cloudRegionId, String enList, String licenseList) {
String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
- serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
- cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
- "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
- " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
- " \"rehome\" : false } }";
- }else{
- //language=JSON
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
- serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
- cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
- " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
- " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
- " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+ + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+ + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId
+ + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :"
+ + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { },"
+ + " \"rehome\" : false } }";
+ } else {
+ // language=JSON
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+ + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \""
+ + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :"
+ + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :"
+ + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :"
+ + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList
+ + " ] }, \"rehome\" : false } }";
}
return solution;
}
- private String homingSolutionCloud(String type, String cloudOwner,
- String cloudRegionId, Boolean flavors, String enList,
- String licenseList){
+ private String homingSolutionCloud(String type, String cloudOwner, String cloudRegionId, Boolean flavors,
+ String enList, String licenseList) {
String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"license\" : { }, \"rehome\" : false } }";
- } else if (flavors && enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
- "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
- "\"license\" : { }, \"rehome\" : false } }";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors && enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId
+ + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+ + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+ + "\"license\" : { }, \"rehome\" : false } }";
} else if (flavors) {
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
- "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
- "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
- licenseList + " ] }, \"rehome\" : false } }";
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId
+ + "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, "
+ + "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], "
+ + "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ "
+ + licenseList + " ] }, \"rehome\" : false } }";
} else {
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
- cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
- "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
- licenseList + " ] }, \"rehome\" : false } }";
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"license\" : { \"entitlementPoolList\" : [ "
+ + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
}
return solution;
}
@@ -823,68 +762,68 @@ public class OofHomingTestIT extends BaseIntegrationTest {
variables.put("cloudRegionId", "TNZED");
- String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
- "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":"
+ + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
variables.put("serviceModelInfo", serviceModelInfo);
}
private String verifyOofRequest() {
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
- "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
- "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
- "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
- "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
- "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
- "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" +
- ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
- "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," +
- "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" +
- "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," +
- "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," +
- "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," +
- "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," +
- "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," +
- "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
- "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
- "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
- "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
- "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
- "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":" +
- "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":" +
- "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":" +
- "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
- "\"modelCustomizationName\":\"\"}}]}}";
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+ + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\","
+ + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"],"
+ + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":"
+ + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":"
+ + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+ + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\""
+ + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":"
+ + "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\","
+ + "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":"
+ + "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}},"
+ + "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\","
+ + "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\","
+ + "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\","
+ + "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\","
+ + "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":"
+ + "{\"serviceInstanceId\":\"testServiceInstanceId123\","
+ + "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":"
+ + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\","
+ + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\""
+ + "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":"
+ + "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":"
+ + "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":"
+ + "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\","
+ + "\"modelCustomizationName\":\"\"}}]}}";
return request;
}
- private String verifyOofRequestExistingLicense(){
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
- "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
- "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
- "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
- "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
- "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
- "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
- "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
- "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
- "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
- "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
- "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
- "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
- "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
- "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
- "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
- "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
- "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
- "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
- "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
- "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
- "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
- "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
- "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
- "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
- "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
- "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ private String verifyOofRequestExistingLicense() {
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\","
+ + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\","
+ + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],"
+ + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\","
+ + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":"
+ + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":"
+ + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\","
+ + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":"
+ + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\","
+ + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\","
+ + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\","
+ + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":"
+ + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":"
+ + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":"
+ + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\","
+ + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\","
+ + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\","
+ + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":"
+ + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\","
+ + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":"
+ + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\","
+ + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\","
+ + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},"
+ + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\","
+ + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\","
+ + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":"
+ + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
return request;
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
index c994173cd7..ace5fdd15b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -27,12 +27,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDep
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Test;
@@ -47,164 +45,176 @@ import org.slf4j.LoggerFactory;
*/
public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(PrepareUpdateAAIVfModuleIT.class);
-
- /**
- * Test the happy path through the flow.
- */
- @Test
-
- public void happyPath() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
-
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
- MockPatchVfModuleId(wireMockServer, "skask", "supercool");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(200, responseCode.intValue());
- String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
- logger.debug("Ouput heat-stack-id:{}", heatStackId);
- Assert.assertEquals("slowburn", heatStackId);
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
-
- public void badGet() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
- Assert.assertNotNull(workflowException);
- logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
-
- logEnd();
- }
-
- /**
- * Test the case where the validation of the VF Module fails.
- */
- @Test
-
- public void failValidation1() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm");
-
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- Assert.assertNotNull(workflowException);
- logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
- Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
-
- logEnd();
- }
-
- /**
- * Test the case where the validation of the VF Module fails.
- */
- @Test
-
- public void failValidation2() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool");
-
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- Assert.assertNotNull(workflowException);
- logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
- Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
- */
- @Test
-
- public void badPatch() throws IOException {
-
- logStart();
-
- String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
-
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
- invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
- Assert.assertNotNull(workflowException);
- logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
-
- logEnd();
- }
+
+ Logger logger = LoggerFactory.getLogger(PrepareUpdateAAIVfModuleIT.class);
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId(wireMockServer, "skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(200, responseCode.intValue());
+ String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
+ logger.debug("Ouput heat-stack-id:{}", heatStackId);
+ Assert.assertEquals("slowburn", heatStackId);
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the validation of the VF Module fails.
+ */
+ @Test
+
+ public void failValidation1() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml")
+ .replaceFirst("supercool", "lukewarm");
+
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+ Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the validation of the VF Module fails.
+ */
+ @Test
+
+ public void failValidation2() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml")
+ .replaceFirst("supercool", "notsocool");
+
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+ Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
+ */
+ @Test
+
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockAAIVfModuleBadPatch(wireMockServer,
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage());
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
index 2f6d2ae85b..d669674297 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
@@ -16,16 +16,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import static org.onap.so.bpmn.mock.StubResponsePolicy.MockPolicyAbort;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
@@ -35,35 +33,35 @@ import org.onap.so.BaseIntegrationTest;
*/
public class RainyDayHandlerIT extends BaseIntegrationTest {
-
- @Test
-
- public void TestRainyDayHandlingSuccess() {
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceType", "X");
- variables.put("vnfType", "Y");
- variables.put("currentActivity", "BB1");
- variables.put("workStep", "1");
- variables.put("failedActivity", "");
- variables.put("errorCode", "123");
- variables.put("errorText", "update failed");
- variables.put("vnfName", "vSAMP1");
-
- MockPolicyAbort(wireMockServer);
-
-
- String businessKey = UUID.randomUUID().toString();
- invokeSubProcess("RainyDayHandler", businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- }
-
-
-
-} \ No newline at end of file
+
+ @Test
+
+ public void TestRainyDayHandlingSuccess() {
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceType", "X");
+ variables.put("vnfType", "Y");
+ variables.put("currentActivity", "BB1");
+ variables.put("workStep", "1");
+ variables.put("failedActivity", "");
+ variables.put("errorCode", "123");
+ variables.put("errorText", "update failed");
+ variables.put("vnfName", "vSAMP1");
+
+ MockPolicyAbort(wireMockServer);
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("RainyDayHandler", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ }
+
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
index 7f3e884601..d8e3264091 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
@@ -17,7 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.bpmn.common;
import static org.junit.Assert.assertEquals;
@@ -25,12 +25,10 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Ignore;
import org.junit.Test;
@@ -44,102 +42,85 @@ import org.onap.so.bpmn.core.WorkflowException;
@Ignore
public class ReceiveWorkflowMessageTest extends WorkflowTest {
- private static final String EOL = "\n";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public ReceiveWorkflowMessageTest() throws IOException {
- callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
- "{" + EOL +
- " \"SDNCEvent\": {" + EOL +
- " \"eventType\": \"evenType\"," + EOL +
- " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
- " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
- " \"params\": {" + EOL +
- " \"success-indicator\":\"Y\"" + EOL +
- " }" +EOL +
- " }" + EOL +
- "}" + EOL);
-
- callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent",
- "{" + EOL +
- " \"SDNCEvent\": {" + EOL +
- " \"eventType\": \"evenType\"," + EOL +
- " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
- " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
- " \"params\": {" + EOL +
- " \"success-indicator\":\"N\"," + EOL +
- " \"error-message\":\"SOMETHING BAD HAPPENED\"" + EOL +
- " }" +EOL +
- " }" + EOL +
- "}" + EOL);
- }
-
- /**
- * Test the happy path.
- */
- @Test
- @Deployment(resources = {
- "subprocess/ReceiveWorkflowMessage.bpmn"
- })
- public void happyPath() throws Exception {
-
- logStart();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
- variables.put("isDebugLogEnabled", "true");
- variables.put("RCVWFMSG_timeout", "PT1M");
- variables.put("RCVWFMSG_messageType", "SDNCAEvent");
- variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
-
- invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
- injectWorkflowMessages(callbacks, "sdnc-event-success");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
- System.out.println("Response:\n" + response);
- assertTrue(response.contains("\"SDNCEvent\""));
- assertTrue((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the timeout scenario.
- */
- @Test
- @Deployment(resources = {
- "subprocess/ReceiveWorkflowMessage.bpmn"
- })
- public void timeout() throws Exception {
-
- logStart();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
- variables.put("isDebugLogEnabled", "true");
- variables.put("RCVWFMSG_timeout", "PT5S");
- variables.put("RCVWFMSG_messageType", "SDNCAEvent");
- variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
-
- invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
-
- // No injection
-
- waitForProcessEnd(businessKey, 10000);
-
- // There is no response from SDNC, so the flow doesn't set WorkflowResponse.
- String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
- assertNull(response);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertNotNull(wfe);
- System.out.println(wfe.toString());
- assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
- assertFalse((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
-
- logEnd();
- }
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public ReceiveWorkflowMessageTest() throws IOException {
+ callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
+ "{" + EOL + " \"SDNCEvent\": {" + EOL + " \"eventType\": \"evenType\"," + EOL
+ + " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL
+ + " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + " \"params\": {" + EOL
+ + " \"success-indicator\":\"Y\"" + EOL + " }" + EOL + " }" + EOL + "}" + EOL);
+
+ callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent", "{" + EOL + " \"SDNCEvent\": {" + EOL
+ + " \"eventType\": \"evenType\"," + EOL + " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL
+ + " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL + " \"params\": {" + EOL
+ + " \"success-indicator\":\"N\"," + EOL + " \"error-message\":\"SOMETHING BAD HAPPENED\""
+ + EOL + " }" + EOL + " }" + EOL + "}" + EOL);
+ }
+
+ /**
+ * Test the happy path.
+ */
+ @Test
+ @Deployment(resources = {"subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("RCVWFMSG_timeout", "PT1M");
+ variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+ variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+
+ invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+ injectWorkflowMessages(callbacks, "sdnc-event-success");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("\"SDNCEvent\""));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the timeout scenario.
+ */
+ @Test
+ @Deployment(resources = {"subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void timeout() throws Exception {
+
+ logStart();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("RCVWFMSG_timeout", "PT5S");
+ variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+ variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+
+ invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+
+ // No injection
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // There is no response from SDNC, so the flow doesn't set WorkflowResponse.
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ assertNull(response);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertNotNull(wfe);
+ System.out.println(wfe.toString());
+ assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
+ assertFalse((boolean) getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
index dc5c36f5a7..36adccd758 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.common;
import javax.xml.ws.Endpoint;
-
import org.camunda.bpm.engine.ProcessEngineServices;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@@ -29,56 +28,54 @@ import org.junit.runners.model.Statement;
import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
/**
- * A JUnit rule that starts the SDNC Adapter Callback Service before
- * every test, and tears it down after every test. Example:
+ * A JUnit rule that starts the SDNC Adapter Callback Service before every test, and tears it down after every test.
+ * Example:
+ *
* <pre>
- * @Rule
- * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- * new SDNCAdapterCallbackRule(processEngineRule);
+ * &#64;Rule
+ * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = new SDNCAdapterCallbackRule(processEngineRule);
* </pre>
*/
public class SDNCAdapterCallbackRule implements TestRule {
- public static final String DEFAULT_ENDPOINT_URL =
- "http://localhost:28080/mso/SDNCAdapterCallbackService";
+ public static final String DEFAULT_ENDPOINT_URL = "http://localhost:28080/mso/SDNCAdapterCallbackService";
- private final ProcessEngineServices processEngineServices;
- private final String endpointUrl;
+ private final ProcessEngineServices processEngineServices;
+ private final String endpointUrl;
- public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
- this(processEngineServices, DEFAULT_ENDPOINT_URL);
- }
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
+ this(processEngineServices, DEFAULT_ENDPOINT_URL);
+ }
- public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices,
- String endpointUrl) {
- this.processEngineServices = processEngineServices;
- this.endpointUrl = endpointUrl;
- }
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices, String endpointUrl) {
+ this.processEngineServices = processEngineServices;
+ this.endpointUrl = endpointUrl;
+ }
- @Override
- public Statement apply(final Statement baseStmt, Description description) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- Endpoint endpoint = null;
+ @Override
+ public Statement apply(final Statement baseStmt, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ Endpoint endpoint = null;
- try {
- SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
- sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
+ try {
+ SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
+ sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
- System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
- System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
+ System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
+ System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
- System.out.println("Publishing Endpoint - " + endpointUrl);
- endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
+ System.out.println("Publishing Endpoint - " + endpointUrl);
+ endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
- baseStmt.evaluate();
- } finally {
- if (endpoint != null) {
- System.out.println("Stopping Endpoint - " + endpointUrl);
- endpoint.stop();
- }
- }
- }
- };
- }
-} \ No newline at end of file
+ baseStmt.evaluate();
+ } finally {
+ if (endpoint != null) {
+ System.out.println("Stopping Endpoint - " + endpointUrl);
+ endpoint.stop();
+ }
+ }
+ }
+ };
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
index bf3fefdf9c..415e8096a3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
@@ -25,12 +25,10 @@ package org.onap.so.bpmn.common;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -42,81 +40,78 @@ import org.slf4j.LoggerFactory;
/**
* Unit tests for SDNCAdapterRestV2.bpmn.
*
- * This version of SDNCAdapterRest allows for interim notifications to be sent for
- * any non-final response received from SDNC.
+ * This version of SDNCAdapterRest allows for interim notifications to be sent for any non-final response received from
+ * SDNC.
*/
public class SDNCAdapterRestV2IT extends BaseIntegrationTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class);
-
-
- /**
- * Constructor. Insert callbacks.
- *
- * @throws IOException
- */
- public SDNCAdapterRestV2IT() throws IOException {
- String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json");
- String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json");
- callbacks.put("nonfinal", sdncCallbackNonFinal);
- callbacks.put("final", sdncCallbackFinal);
- }
-
- /**
- * Test the success path through the subflow.
- */
- @Test
- @Ignore
- public void success() throws IOException {
- logStart();
- mocks();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535");
- variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5");
- variables.put("isDebugLogEnabled", "true");
- variables.put("SDNCREST_Request",
- FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json"));
- variables.put("SDNCREST_InterimNotification1",
- FileUtil.readResourceFile("__files/SDNCInterimNotification1.json"));
-
- invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
-
- injectSDNCRestCallbacks(callbacks, "nonfinal");
-
- // First non-final response will have done a notification
- Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
- Assert.assertNotNull(interimNotification);
-
- injectSDNCRestCallbacks(callbacks, "nonfinal");
-
- // Second non-final response will not have done a notification
- interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
- Assert.assertNull(interimNotification);
-
- injectSDNCRestCallbacks(callbacks, "final");
-
- interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
- Assert.assertNull(interimNotification);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- logEnd();
- }
-
- /**
- * Defines WireMock stubs needed by these tests.
- */
- private void mocks() {
- wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/json")));
- }
+ private final CallbackSet callbacks = new CallbackSet();
+
+ Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class);
+
+
+ /**
+ * Constructor. Insert callbacks.
+ *
+ * @throws IOException
+ */
+ public SDNCAdapterRestV2IT() throws IOException {
+ String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json");
+ String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json");
+ callbacks.put("nonfinal", sdncCallbackNonFinal);
+ callbacks.put("final", sdncCallbackFinal);
+ }
+
+ /**
+ * Test the success path through the subflow.
+ */
+ @Test
+ @Ignore
+ public void success() throws IOException {
+ logStart();
+ mocks();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535");
+ variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("SDNCREST_Request", FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json"));
+ variables.put("SDNCREST_InterimNotification1",
+ FileUtil.readResourceFile("__files/SDNCInterimNotification1.json"));
+
+ invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
+
+ injectSDNCRestCallbacks(callbacks, "nonfinal");
+
+ // First non-final response will have done a notification
+ Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+ Assert.assertNotNull(interimNotification);
+
+ injectSDNCRestCallbacks(callbacks, "nonfinal");
+
+ // Second non-final response will not have done a notification
+ interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+ Assert.assertNull(interimNotification);
+
+ injectSDNCRestCallbacks(callbacks, "final");
+
+ interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+ Assert.assertNull(interimNotification);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ logEnd();
+ }
+
+ /**
+ * Defines WireMock stubs needed by these tests.
+ */
+ private void mocks() {
+ wireMockServer.stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc"))
+ .willReturn(aResponse().withStatus(202).withHeader("Content-Type", "application/json")));
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
index 9239889f28..96ea1cad9b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
@@ -22,10 +22,8 @@ package org.onap.so.bpmn.common;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-
import java.io.FileNotFoundException;
import java.io.IOException;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.so.client.RestPropertiesLoader;
@@ -36,34 +34,37 @@ import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
public class SPIPropertiesTest {
- @BeforeClass
- public static void beforeClass() {
- System.setProperty("mso.config.path", "src/test/resources");
- }
-
- @Test
- public void notEqual() {
- DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl();
- DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl();
- assertNotEquals(one, two);
- }
- @Test
- public void equal() {
- DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl();
- DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl();
- assertEquals(one, two);
- }
- @Test
- public void restNotEqual() {
- AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
- AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
- assertNotEquals(one, two);
- }
- @Test
- public void restEqual() {
- AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
- AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
- assertEquals(one, two);
- }
-
+ @BeforeClass
+ public static void beforeClass() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void notEqual() {
+ DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl();
+ DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl();
+ assertNotEquals(one, two);
+ }
+
+ @Test
+ public void equal() {
+ DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl();
+ DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl();
+ assertEquals(one, two);
+ }
+
+ @Test
+ public void restNotEqual() {
+ AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ assertNotEquals(one, two);
+ }
+
+ @Test
+ public void restEqual() {
+ AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
+ AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
+ assertEquals(one, two);
+ }
+
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
index c7ba702212..6b253d2b4d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
@@ -25,14 +25,12 @@ package org.onap.so.bpmn.common;
import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
import static org.onap.so.bpmn.mock.StubResponseSNIRO.*;
import static org.junit.Assert.*;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Ignore;
import org.junit.Test;
@@ -49,504 +47,588 @@ import org.slf4j.LoggerFactory;
*/
@Ignore
public class SniroHomingV1IT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(SniroHomingV1IT.class);
-
-
- ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
- String subscriber = "";
- String subscriber2 = "";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public SniroHomingV1IT() throws IOException {
- String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
- String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
- String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
- String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
- String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
- String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
- callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
- callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
- callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
- callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
- callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
- callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
-
- // Service Model
- ModelInfo sModel = new ModelInfo();
- sModel.setModelCustomizationUuid("testModelCustomizationUuid");
- sModel.setModelInstanceName("testModelInstanceName");
- sModel.setModelInvariantUuid("testModelInvariantId");
- sModel.setModelName("testModelName");
- sModel.setModelUuid("testModelUuid");
- sModel.setModelVersion("testModelVersion");
- // Service Instance
- ServiceInstance si = new ServiceInstance();
- si.setInstanceId("testServiceInstanceId123");
- // Allotted Resources
- List<AllottedResource> arList = new ArrayList<AllottedResource>();
- AllottedResource ar = new AllottedResource();
- ar.setResourceId("testResourceIdAR");
- ar.setResourceInstanceName("testARInstanceName");
- ModelInfo arModel = new ModelInfo();
- arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
- arModel.setModelInvariantUuid("testModelInvariantIdAR");
- arModel.setModelName("testModelNameAR");
- arModel.setModelVersion("testModelVersionAR");
- arModel.setModelUuid("testARModelUuid");
- arModel.setModelType("testModelTypeAR");
- ar.setModelInfo(arModel);
- AllottedResource ar2 = new AllottedResource();
- ar2.setResourceId("testResourceIdAR2");
- ar2.setResourceInstanceName("testAR2InstanceName");
- ModelInfo arModel2 = new ModelInfo();
- arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
- arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
- arModel2.setModelName("testModelNameAR2");
- arModel2.setModelVersion("testModelVersionAR2");
- arModel2.setModelUuid("testAr2ModelUuid");
- arModel2.setModelType("testModelTypeAR2");
- ar2.setModelInfo(arModel2);
- arList.add(ar);
- arList.add(ar2);
- // Vnfs
- List<VnfResource> vnfList = new ArrayList<VnfResource>();
- VnfResource vnf = new VnfResource();
- vnf.setResourceId("testResourceIdVNF");
- vnf.setResourceInstanceName("testVnfInstanceName");
- ModelInfo vnfModel = new ModelInfo();
- vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
- vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
- vnfModel.setModelName("testModelNameVNF");
- vnfModel.setModelVersion("testModelVersionVNF");
- vnfModel.setModelUuid("testVnfModelUuid");
- vnfModel.setModelType("testModelTypeVNF");
- vnf.setModelInfo(vnfModel);
- vnfList.add(vnf);
- logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString());
- serviceDecomposition.setModelInfo(sModel);
- serviceDecomposition.setAllottedResources(arList);
- serviceDecomposition.setVnfResources(vnfList);
- serviceDecomposition.setServiceInstance(si);
-
- // Subscriber
- subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
- subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
- }
-
- @Test
- // 1802 merge
-
- public void testHoming_success_2AR1Vnf() throws Exception {
-
- mockSNIRO(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniro");
-
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
-
- Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
- HomingSolution resourceARHoming = resourceAR.getHomingSolution();
- Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
- HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
- Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
- HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
- String resourceARHomingString = resourceARHoming.toString();
- resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
- String resourceARHoming2String = resourceARHoming2.toString();
- resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
- String resourceVNFHomingString = resourceVNFHoming.toString();
- resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
- expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
-
- assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
- assertEquals(verifySniroRequest(), expectedSniroRequest);
-
- }
-
- @Test
- // 1802 merge
-
- public void testHoming_success_2AR1Vnf2Net() throws Exception {
-
- mockSNIRO(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables2(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
-
- injectWorkflowMessages(callbacks, "sniro2");
-
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
-
- Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
- HomingSolution resourceARHoming = resourceAR.getHomingSolution();
- Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
- HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
- Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
- HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
- Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
- HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
- Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
- HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
-
- String resourceARHomingString = resourceARHoming.toString();
- resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
- String resourceARHoming2String = resourceARHoming2.toString();
- resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
- String resourceVNFHomingString = resourceVNFHoming.toString();
- resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
- String resourceNetHomingString = resourceNetHoming.toString();
- resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
- String resourceNetHoming2String = resourceNetHoming2.toString();
- resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
- expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
-
- assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
- assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String);
- assertEquals(verifySniroRequest(), expectedSniroRequest);
- }
-
- @Test
- // 1802 merge
-
- public void testHoming_success_vnfResourceList() throws Exception {
-
- // Create a Service Decomposition
- MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
- String busKey = UUID.randomUUID().toString();
- Map<String, Object> vars = new HashMap<>();
- setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
- invokeSubProcess("DecomposeService", busKey, vars);
-
- ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
- List<VnfResource> vnfResourceList = sd.getVnfResources();
- vnfResourceList.get(0).setResourceId("test-resource-id-000");
-
- // Invoke Homing
-
- mockSNIRO(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("homingService", "sniro");
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", sd);
- variables.put("subscriberInfo", subscriber2);
-
- invokeSubProcess("Homing", businessKey, variables);
- injectWorkflowMessages(callbacks, "sniro3");
- waitForProcessEnd(businessKey, 10000);
-
- //Get Variables
-
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
-
- Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
- HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
-
- String resourceVnfHomingString = resourceVnfHoming.toString();
- resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
-
- assertNull(workflowException);
-
- //Verify request
- String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
- assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
-
- assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "CloudOwner", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
- }
-
- @Test
-
- public void testHoming_success_existingLicense() throws Exception {
-
- mockSNIRO(wireMockServer);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<String, Object>();
- setVariablesExistingLicense(variables);
-
- invokeSubProcess("Homing", businessKey, variables);
- injectWorkflowMessages(callbacks, "sniro");
+ Logger logger = LoggerFactory.getLogger(SniroHomingV1IT.class);
+
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ String subscriber = "";
+ String subscriber2 = "";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public SniroHomingV1IT() throws IOException {
+ String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
+ String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
+ String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
+ String sniroCallbackNoSolution =
+ FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
+ String sniroCallbackPolicyException =
+ FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
+ String sniroCallbackServiceException =
+ FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
+ callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
+ callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
+ callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
+ callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
+ callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
+ callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
+
+ // Service Model
+ ModelInfo sModel = new ModelInfo();
+ sModel.setModelCustomizationUuid("testModelCustomizationUuid");
+ sModel.setModelInstanceName("testModelInstanceName");
+ sModel.setModelInvariantUuid("testModelInvariantId");
+ sModel.setModelName("testModelName");
+ sModel.setModelUuid("testModelUuid");
+ sModel.setModelVersion("testModelVersion");
+ // Service Instance
+ ServiceInstance si = new ServiceInstance();
+ si.setInstanceId("testServiceInstanceId123");
+ // Allotted Resources
+ List<AllottedResource> arList = new ArrayList<AllottedResource>();
+ AllottedResource ar = new AllottedResource();
+ ar.setResourceId("testResourceIdAR");
+ ar.setResourceInstanceName("testARInstanceName");
+ ModelInfo arModel = new ModelInfo();
+ arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+ arModel.setModelInvariantUuid("testModelInvariantIdAR");
+ arModel.setModelName("testModelNameAR");
+ arModel.setModelVersion("testModelVersionAR");
+ arModel.setModelUuid("testARModelUuid");
+ arModel.setModelType("testModelTypeAR");
+ ar.setModelInfo(arModel);
+ AllottedResource ar2 = new AllottedResource();
+ ar2.setResourceId("testResourceIdAR2");
+ ar2.setResourceInstanceName("testAR2InstanceName");
+ ModelInfo arModel2 = new ModelInfo();
+ arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+ arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+ arModel2.setModelName("testModelNameAR2");
+ arModel2.setModelVersion("testModelVersionAR2");
+ arModel2.setModelUuid("testAr2ModelUuid");
+ arModel2.setModelType("testModelTypeAR2");
+ ar2.setModelInfo(arModel2);
+ arList.add(ar);
+ arList.add(ar2);
+ // Vnfs
+ List<VnfResource> vnfList = new ArrayList<VnfResource>();
+ VnfResource vnf = new VnfResource();
+ vnf.setResourceId("testResourceIdVNF");
+ vnf.setResourceInstanceName("testVnfInstanceName");
+ ModelInfo vnfModel = new ModelInfo();
+ vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+ vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+ vnfModel.setModelName("testModelNameVNF");
+ vnfModel.setModelVersion("testModelVersionVNF");
+ vnfModel.setModelUuid("testVnfModelUuid");
+ vnfModel.setModelType("testModelTypeVNF");
+ vnf.setModelInfo(vnfModel);
+ vnfList.add(vnf);
+ logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString());
+ serviceDecomposition.setModelInfo(sModel);
+ serviceDecomposition.setAllottedResources(arList);
+ serviceDecomposition.setVnfResources(vnfList);
+ serviceDecomposition.setServiceInstance(si);
+
+ // Subscriber
+ subscriber =
+ "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_success_2AR1Vnf() throws Exception {
+
+ mockSNIRO(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(
+ homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2",
+ "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0",
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifySniroRequest(), expectedSniroRequest);
+
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+ mockSNIRO(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables2(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro2");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+ HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+ Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+ HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ String resourceNetHomingString = resourceNetHoming.toString();
+ resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+ String resourceNetHoming2String = resourceNetHoming2.toString();
+ resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+ expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(
+ homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2",
+ "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0",
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic",
+ "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
+ assertEquals(
+ homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+ resourceNetHoming2String);
+ assertEquals(verifySniroRequest(), expectedSniroRequest);
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_success_vnfResourceList() throws Exception {
+
+ // Create a Service Decomposition
+ MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "/BuildingBlocks/catalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+ List<VnfResource> vnfResourceList = sd.getVnfResources();
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+ // Invoke Homing
+
+ mockSNIRO(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", sd);
+ variables.put("subscriberInfo", subscriber2);
+
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "sniro3");
+ waitForProcessEnd(businessKey, 10000);
+
+ // Get Variables
+
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+
+ Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+ HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+ String resourceVnfHomingString = resourceVnfHoming.toString();
+ resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+
+ assertNull(workflowException);
+
+ // Verify request
+ String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+ assertEquals(
+ FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "")
+ .replaceAll("\r", "").replaceAll("\t", ""),
+ sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+
+ assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "CloudOwner", "mtmnj1a",
+ "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVnfHomingString);
+ }
+
+ @Test
+
+ public void testHoming_success_existingLicense() throws Exception {
+
+ mockSNIRO(wireMockServer);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ setVariablesExistingLicense(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp =
+ (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
- waitForProcessEnd(businessKey, 10000);
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ sniroRequest = sniroRequest.replaceAll("\\s+", "");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
- String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+ assertNull(workflowException);
+ assertEquals(
+ homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2",
+ "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(
+ homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0",
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifySniroRequest_existingLicense(), sniroRequest);
- Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
- HomingSolution resourceARHoming = resourceAR.getHomingSolution();
- Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
- HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
- Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
- HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
- String resourceARHomingString = resourceARHoming.toString();
- resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
- String resourceARHoming2String = resourceARHoming2.toString();
- resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
- String resourceVNFHomingString = resourceVNFHoming.toString();
- resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
- sniroRequest = sniroRequest.replaceAll("\\s+", "");
+ }
- assertNull(workflowException);
- assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
- assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
- assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
- assertEquals(verifySniroRequest_existingLicense(), sniroRequest);
- }
+ @Test
+ public void testHoming_error_inputVariable() throws Exception {
- @Test
-
- public void testHoming_error_inputVariable() throws Exception {
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables3(variables);
+ invokeSubProcess("Homing", businessKey, variables);
- invokeSubProcess("Homing", businessKey, variables);
+ waitForProcessEnd(businessKey, 10000);
- waitForProcessEnd(businessKey, 10000);
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]",
+ workflowException.toString());
+ }
- assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
- }
+ @Test
- @Test
-
- public void testHoming_error_badResponse() throws Exception {
- mockSNIRO_500(wireMockServer);
+ public void testHoming_error_badResponse() throws Exception {
+ mockSNIRO_500(wireMockServer);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- invokeSubProcess("Homing", businessKey, variables);
+ invokeSubProcess("Homing", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ waitForProcessEnd(businessKey, 10000);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString());
- }
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]",
+ workflowException.toString());
+ }
- @Test
- // 1802 merge
-
- public void testHoming_error_sniroNoSolution() throws Exception {
- mockSNIRO(wireMockServer);
+ @Test
+ // 1802 merge
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ public void testHoming_error_sniroNoSolution() throws Exception {
+ mockSNIRO(wireMockServer);
- invokeSubProcess("Homing", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- injectWorkflowMessages(callbacks, "sniroNoSol");
+ invokeSubProcess("Homing", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ injectWorkflowMessages(callbacks, "sniroNoSol");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ waitForProcessEnd(businessKey, 10000);
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
- }
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]",
+ workflowException.toString());
+ }
- @Test
-
- public void testHoming_error_sniroPolicyException() throws Exception {
- mockSNIRO(wireMockServer);
+ @Test
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ public void testHoming_error_sniroPolicyException() throws Exception {
+ mockSNIRO(wireMockServer);
- invokeSubProcess("Homing", businessKey, variables);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- injectWorkflowMessages(callbacks, "sniroPolicyEx");
+ invokeSubProcess("Homing", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
+ injectWorkflowMessages(callbacks, "sniroPolicyEx");
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ waitForProcessEnd(businessKey, 10000);
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString());
- }
-
- @Test
-
- public void testHoming_error_sniroServiceException() throws Exception {
- mockSNIRO(wireMockServer);
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]",
+ workflowException.toString());
+ }
- invokeSubProcess("Homing", businessKey, variables);
+ @Test
- injectWorkflowMessages(callbacks, "sniroServiceEx");
+ public void testHoming_error_sniroServiceException() throws Exception {
+ mockSNIRO(wireMockServer);
- waitForProcessEnd(businessKey, 10000);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
- //Get Variables
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
-
- assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString());
- }
-
-
-
- private void setVariables(Map<String, Object> variables) {
- variables.put("homingService", "sniro");
- variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", serviceDecomposition);
- variables.put("subscriberInfo", subscriber2);
-
- }
-
- private void setVariables2(Map<String, Object> variables) {
- List<NetworkResource> netList = new ArrayList<NetworkResource>();
- NetworkResource net = new NetworkResource();
- net.setResourceId("testResourceIdNet");
- ModelInfo netModel = new ModelInfo();
- netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
- netModel.setModelInvariantUuid("testModelInvariantIdNet");
- netModel.setModelName("testModelNameNet");
- netModel.setModelVersion("testModelVersionNet");
- net.setModelInfo(netModel);
- netList.add(net);
- NetworkResource net2 = new NetworkResource();
- net2.setResourceId("testResourceIdNet2");
- ModelInfo netModel2 = new ModelInfo();
- netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
- netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
- netModel2.setModelName("testModelNameNet2");
- netModel2.setModelVersion("testModelVersionNet2");
- net2.setModelInfo(netModel2);
- netList.add(net2);
- serviceDecomposition.setNetworkResources(netList);
-
- variables.put("homingService", "sniro");
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", serviceDecomposition);
- variables.put("subscriberInfo", subscriber2);
- }
-
- private void setVariables3(Map<String, Object> variables) {
- variables.put("homingService", "sniro");
- variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", null);
- variables.put("subscriberInfo", subscriber2);
-
- }
-
- private void setVariablesExistingLicense(Map<String, Object> variables) {
- HomingSolution currentHomingSolution = new HomingSolution();
- serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
-
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
- serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
-
- variables.put("isDebugLogEnabled", "true");
- // variables.put("mso-request-id", "testRequestId");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "testServiceInstanceId");
- variables.put("serviceDecomposition", serviceDecomposition);
- variables.put("subscriberInfo", subscriber2);
-
- }
-
- private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
- String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
- }else{
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
- }
- return solution;
- }
-
- private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
- String solution = "";
- if(enList == null){
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
- }else{
- solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
- }
- return solution;
- }
-
- private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
- variables.put("homingService", "sniro");
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," +
- "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," +
- "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," +
- "\"modelVersion\": \"5.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- }
-
- private String verifySniroRequest(){
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
- return request;
- }
-
- private String verifySniroRequest_existingLicense(){
- String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
- return request;
- }
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroServiceEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // Get Variables
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals(
+ "WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+ workflowException.toString());
+ }
+
+
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private void setVariables2(Map<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ NetworkResource net = new NetworkResource();
+ net.setResourceId("testResourceIdNet");
+ ModelInfo netModel = new ModelInfo();
+ netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+ netModel.setModelInvariantUuid("testModelInvariantIdNet");
+ netModel.setModelName("testModelNameNet");
+ netModel.setModelVersion("testModelVersionNet");
+ net.setModelInfo(netModel);
+ netList.add(net);
+ NetworkResource net2 = new NetworkResource();
+ net2.setResourceId("testResourceIdNet2");
+ ModelInfo netModel2 = new ModelInfo();
+ netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+ netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+ netModel2.setModelName("testModelNameNet2");
+ netModel2.setModelVersion("testModelVersionNet2");
+ net2.setModelInfo(netModel2);
+ netList.add(net2);
+ serviceDecomposition.setNetworkResources(netList);
+
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables3(Map<String, Object> variables) {
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", null);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private void setVariablesExistingLicense(Map<String, Object> variables) {
+ HomingSolution currentHomingSolution = new HomingSolution();
+ serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addEntitlementPool("testEntitlementPoolId2");
+
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense()
+ .addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner,
+ String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList) {
+ String solution = "";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+ + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \""
+ + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+ + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
+ } else {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \""
+ + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \""
+ + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+ + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ "
+ + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner,
+ String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList) {
+ String solution = "";
+ if (enList == null) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+ + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
+ } else {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner
+ + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli
+ + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ "
+ + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+
+ String serviceModelInfo = "{ " + "\"modelType\": \"service\","
+ + "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\","
+ + "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\","
+ + "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," + "\"modelVersion\": \"5.0\"," + "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ }
+
+ private String verifySniroRequest() {
+ String request =
+ "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
+
+ private String verifySniroRequest_existingLicense() {
+ String request =
+ "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
index 5015a1351a..fc991bd50e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -28,12 +28,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Ignore;
@@ -49,129 +47,134 @@ import org.slf4j.LoggerFactory;
*/
public class UpdateAAIGenericVnfIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-
-
- /**
- * Test the happy path through the flow.
- */
- @Test
-
- public void happyPath() throws IOException {
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(wireMockServer, "/skask", 200);
- MockPatchGenericVnf(wireMockServer, "skask");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(200, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the happy path through the flow.
- */
- @Test
-
- public void personaMismatch() throws IOException {
-
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
- updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
-
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- logger.debug("Workflow Exception: {}", workflowException);
- Assert.assertNotNull(workflowException);
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
-
- public void badGet() throws IOException {
-
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
-
- MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
- */
- @Test
-
- public void badPatch() throws IOException {
-
- logStart();
-
- String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
-
- MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf_Bad(wireMockServer, "skask", 404);
- MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
- invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
+
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void happyPath() throws IOException {
+ logStart();
+
+ String updateAAIGenericVnfRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(wireMockServer, "/skask", 200);
+ MockPatchGenericVnf(wireMockServer, "skask");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void personaMismatch() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+ updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
+
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ WorkflowException workflowException =
+ (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ logger.debug("Workflow Exception: {}", workflowException);
+ Assert.assertNotNull(workflowException);
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+ MockGetGenericVnfById_404(wireMockServer, "skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth(wireMockServer, "skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf_Bad(wireMockServer, "skask", 404);
+ MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
index 0a3931a12f..ebf8799121 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -28,12 +28,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPri
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Ignore;
@@ -48,98 +46,105 @@ import org.slf4j.LoggerFactory;
*/
public class UpdateAAIVfModuleIT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
-
-
- /**
- * Test the happy path through the flow.
- */
- @Test
-
- public void happyPath() throws IOException {
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfByIdWithPriority(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
- MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
- MockPatchVfModuleId(wireMockServer, "skask", "supercool");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
- invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(200, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI returns a 404.
- */
- @Test
-
- public void badGet() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
- invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
-
- /**
- * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
- */
- @Test
-
- public void badPatch() throws IOException {
-
- logStart();
-
- String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
- MockGetGenericVnfById_404(wireMockServer, "/skask/vf-modules/vf-module/supercool");
- MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
- MockAAIVfModuleBadPatch(wireMockServer, "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("isDebugLogEnabled","true");
- variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
- invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
- Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
- logger.debug("Subflow response code: {}", responseCode);
- logger.debug("Subflow response: {}", response);
- Assert.assertEquals(404, responseCode.intValue());
-
- logEnd();
- }
+
+ Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
+
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void happyPath() throws IOException {
+ logStart();
+
+ String updateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfByIdWithPriority(wireMockServer, "/skask/vf-modules/vf-module/supercool", 200,
+ "VfModularity/VfModule-supercool.xml");
+ MockPutGenericVnf(wireMockServer, "/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId(wireMockServer, "skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml",
+ 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest =
+ FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById_404(wireMockServer, "/skask/vf-modules/vf-module/supercool");
+ MockGetGenericVnfById(wireMockServer, "/skask/vf-modules/vf-module/supercool",
+ "VfModularity/VfModule-supercool.xml", 200);
+ MockAAIVfModuleBadPatch(wireMockServer,
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: {}", responseCode);
+ logger.debug("Subflow response: {}", response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
index c0482a52ca..0cefdca9ca 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
@@ -29,12 +29,10 @@ import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Ignore;
import org.junit.Test;
@@ -48,347 +46,261 @@ import org.slf4j.LoggerFactory;
*/
public class VnfAdapterRestV1IT extends BaseIntegrationTest {
-
- Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class);
-
-
- private static final String EOL = "\n";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- private final String CREATE_VF_MODULE_REQUEST =
- "<createVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vnfType>vnfType</vnfType>" + EOL +
- " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
- " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
- " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
- " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
- " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
- " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <backout>false</backout>" + EOL +
- " <failIfExists>true</failIfExists>" + EOL +
- " <vfModuleParams>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleParams>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</createVfModuleRequest>" + EOL;
-
- private final String UPDATE_VF_MODULE_REQUEST =
- "<updateVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vnfType>vnfType</vnfType>" + EOL +
- " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
- " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
- " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
- " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
- " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
- " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <backout>false</backout>" + EOL +
- " <failIfExists>true</failIfExists>" + EOL +
- " <vfModuleParams>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleParams>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</updateVfModuleRequest>" + EOL;
-
- private final String DELETE_VF_MODULE_REQUEST =
- "<deleteVfModuleRequest>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- "</deleteVfModuleRequest>" + EOL;
-
- private final String ROLLBACK_VF_MODULE_REQUEST =
- "<rollbackVfModuleRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
- " <skipAAI>true</skipAAI>" + EOL +
- " <vfModuleRollback>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " </vfModuleRollback>" + EOL +
- "</rollbackVfModuleRequest>" + EOL;
-
- public VnfAdapterRestV1IT() throws IOException {
- callbacks.put("createVfModule",
- "<createVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleOutputs>" + EOL +
- " <rollback>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleCreated>true</vfModuleCreated>" + EOL +
- " <tenantId>tenantId</tenantId>" + EOL +
- " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
- " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
- " <msoRequest>" + EOL +
- " <requestId>requestId</requestId>" + EOL +
- " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
- " </msoRequest>" + EOL +
- " <messageId>messageId</messageId>" + EOL +
- " </rollback>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</createVfModuleResponse>" + EOL);
-
- callbacks.put("updateVfModule",
- "<updateVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>key1</key>" + EOL +
- " <value>value1</value>" + EOL +
- " </entry>" + EOL +
- " <entry>" + EOL +
- " <key>key2</key>" + EOL +
- " <value>value2</value>" + EOL +
- " </entry>" + EOL +
- " </vfModuleOutputs>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</updateVfModuleResponse>" + EOL);
-
- callbacks.put("deleteVfModule",
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>vnfId</vnfId>" + EOL +
- " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL);
-
- callbacks.put("rollbackVfModule",
- "<rollbackVfModuleResponse>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
- "</rollbackVfModuleResponse>" + EOL);
-
- callbacks.put("vfModuleException",
- "<vfModuleException>" + EOL +
- " <message>message</message>" + EOL +
- " <category>category</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL);
- }
-
- @Test
-
- public void testCreateVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFPost(wireMockServer, "", 202, "vnfId");
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "createVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- logger.debug("Response:\n{}", response);
- assertTrue(response!=null && response.contains("<createVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testUpdateVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFPut(wireMockServer, "/vfModuleId", 202);
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "updateVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- logger.debug("Response:\n{}", response);
- assertTrue(response.contains("<updateVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testDeleteVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFDelete(wireMockServer, "vnfId", "/vfModuleId", 202);
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "deleteVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- logger.debug("Response:\n{}", response);
- assertTrue(response.contains("<deleteVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testRollbackVfModuleSuccess() throws Exception {
- logStart();
-
- mockVNFRollbackDelete(wireMockServer, "/vfModuleId", 202);
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "rollbackVfModule");
- waitForProcessEnd(businessKey, 10000);
-
- String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
- logger.debug("Response:\n{}", response);
- assertTrue(response.contains("<rollbackVfModuleResponse>"));
- assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
-
- logEnd();
- }
-
- @Test
-
- public void testCreateVfModuleException() throws Exception {
- logStart();
-
- mockVNFPost(wireMockServer, "", 202, "vnfId");
-
- String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
- String messageId = requestId + "-" + System.currentTimeMillis();
- String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", requestId);
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfAdapterRestV1Request", request);
-
- invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
- injectVNFRestCallbacks(callbacks, "vfModuleException");
- waitForProcessEnd(businessKey, 10000);
-
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertNotNull(wfe);
- logger.debug(wfe.toString());
-
- String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
- logger.debug("Response:\n{}", response);
- assertTrue(response.contains("<vfModuleException>"));
- assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
- logEnd();
- }
+ Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class);
+
+
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private final String CREATE_VF_MODULE_REQUEST = "<createVfModuleRequest>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vnfType>vnfType</vnfType>" + EOL + " <vnfVersion>vnfVersion</vnfVersion>" + EOL
+ + " <vfModuleType>vfModuleType</vfModuleType>" + EOL + " <volumeGroupId>volumeGroupId</volumeGroupId>"
+ + EOL + " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL
+ + " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL
+ + " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL + " <skipAAI>true</skipAAI>"
+ + EOL + " <backout>false</backout>" + EOL + " <failIfExists>true</failIfExists>" + EOL
+ + " <vfModuleParams>" + EOL + " <entry>" + EOL + " <key>key1</key>" + EOL
+ + " <value>value1</value>" + EOL + " </entry>" + EOL + " <entry>" + EOL + " <key>key2</key>"
+ + EOL + " <value>value2</value>" + EOL + " </entry>" + EOL + " </vfModuleParams>" + EOL
+ + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + "</createVfModuleRequest>" + EOL;
+
+ private final String UPDATE_VF_MODULE_REQUEST = "<updateVfModuleRequest>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + " <vnfType>vnfType</vnfType>" + EOL
+ + " <vnfVersion>vnfVersion</vnfVersion>" + EOL + " <vfModuleType>vfModuleType</vfModuleType>" + EOL
+ + " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL
+ + " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL
+ + " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL
+ + " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL + " <skipAAI>true</skipAAI>"
+ + EOL + " <backout>false</backout>" + EOL + " <failIfExists>true</failIfExists>" + EOL
+ + " <vfModuleParams>" + EOL + " <entry>" + EOL + " <key>key1</key>" + EOL
+ + " <value>value1</value>" + EOL + " </entry>" + EOL + " <entry>" + EOL + " <key>key2</key>"
+ + EOL + " <value>value2</value>" + EOL + " </entry>" + EOL + " </vfModuleParams>" + EOL
+ + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + "</updateVfModuleRequest>" + EOL;
+
+ private final String DELETE_VF_MODULE_REQUEST = "<deleteVfModuleRequest>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+ + EOL + " <skipAAI>true</skipAAI>" + EOL + " <msoRequest>" + EOL + " <requestId>requestId</requestId>"
+ + EOL + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + "</deleteVfModuleRequest>" + EOL;
+
+ private final String ROLLBACK_VF_MODULE_REQUEST = "<rollbackVfModuleRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL
+ + " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL
+ + " <skipAAI>true</skipAAI>" + EOL + " <vfModuleRollback>" + EOL
+ + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <cloudOwner>cloudOwner</cloudOwner>" + EOL
+ + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+ + EOL + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + " <vfModuleCreated>true</vfModuleCreated>" + EOL
+ + " </vfModuleRollback>" + EOL + "</rollbackVfModuleRequest>" + EOL;
+
+ public VnfAdapterRestV1IT() throws IOException {
+ callbacks.put("createVfModule", "<createVfModuleResponse>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>"
+ + EOL + " <vfModuleCreated>true</vfModuleCreated>" + EOL + " <vfModuleOutputs>" + EOL + " <entry>"
+ + EOL + " <key>key1</key>" + EOL + " <value>value1</value>" + EOL + " </entry>" + EOL
+ + " <entry>" + EOL + " <key>key2</key>" + EOL + " <value>value2</value>" + EOL
+ + " </entry>" + EOL + " </vfModuleOutputs>" + EOL + " <rollback>" + EOL
+ + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL
+ + " <vfModuleCreated>true</vfModuleCreated>" + EOL + " <tenantId>tenantId</tenantId>" + EOL
+ + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL
+ + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL
+ + " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL + " </msoRequest>" + EOL
+ + " <messageId>messageId</messageId>" + EOL + " </rollback>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</createVfModuleResponse>" + EOL);
+
+ callbacks.put("updateVfModule",
+ "<updateVfModuleResponse>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL
+ + " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + " <vfModuleOutputs>" + EOL
+ + " <entry>" + EOL + " <key>key1</key>" + EOL + " <value>value1</value>" + EOL
+ + " </entry>" + EOL + " <entry>" + EOL + " <key>key2</key>" + EOL
+ + " <value>value2</value>" + EOL + " </entry>" + EOL + " </vfModuleOutputs>" + EOL
+ + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</updateVfModuleResponse>" + EOL);
+
+ callbacks.put("deleteVfModule",
+ "<deleteVfModuleResponse>" + EOL + " <vnfId>vnfId</vnfId>" + EOL
+ + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + " <vfModuleDeleted>true</vfModuleDeleted>"
+ + EOL + " <messageId>{{MESSAGE-ID}}</messageId>" + EOL + "</deleteVfModuleResponse>" + EOL);
+
+ callbacks.put("rollbackVfModule", "<rollbackVfModuleResponse>" + EOL + " <messageId>{{MESSAGE-ID}}</messageId>"
+ + EOL + " <vfModuleRolledback>true</vfModuleRolledback>" + EOL + "</rollbackVfModuleResponse>" + EOL);
+
+ callbacks.put("vfModuleException",
+ "<vfModuleException>" + EOL + " <message>message</message>" + EOL + " <category>category</category>"
+ + EOL + " <rolledBack>false</rolledBack>" + EOL + " <messageId>{{MESSAGE-ID}}</messageId>"
+ + EOL + "</vfModuleException>" + EOL);
+ }
+
+ @Test
+
+ public void testCreateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPost(wireMockServer, "", 202, "vnfId");
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "createVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n{}", response);
+ assertTrue(response != null && response.contains("<createVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testUpdateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPut(wireMockServer, "/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "updateVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n{}", response);
+ assertTrue(response.contains("<updateVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testDeleteVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFDelete(wireMockServer, "vnfId", "/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "deleteVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n{}", response);
+ assertTrue(response.contains("<deleteVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testRollbackVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFRollbackDelete(wireMockServer, "/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "rollbackVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n{}", response);
+ assertTrue(response.contains("<rollbackVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testCreateVfModuleException() throws Exception {
+ logStart();
+
+ mockVNFPost(wireMockServer, "", 202, "vnfId");
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "vfModuleException");
+ waitForProcessEnd(businessKey, 10000);
+
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertNotNull(wfe);
+ logger.debug(wfe.toString());
+
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ logger.debug("Response:\n{}", response);
+ assertTrue(response.contains("<vfModuleException>"));
+ assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
index a746bbb48e..cc2d6ab640 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
@@ -16,16 +16,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import static org.junit.Assert.assertEquals;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.junit.Ignore;
@@ -36,49 +34,53 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
@Ignore
public class WorkflowAsyncResourceTest extends WorkflowTest {
- @Test
- @Deployment(resources = { "testAsyncResource.bpmn" })
- public void asyncRequestSuccess() throws InterruptedException {
- //it can be any request which asynchronously processed by the workflow
- String request = "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
-
- Map<String,String> variables = new HashMap<>();
- variables.put("testAsyncRequestMsg", request);
- variables.put("mso-request-id", UUID.randomUUID().toString());
- variables.put("mso-service-request-timeout", "5");
-
- WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
- assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getResponse());
- assertEquals(200, workflowResponse.getMessageCode());
- }
-
- private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException {
- WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
- VariableMapImpl variableMap = new VariableMapImpl();
-
- Map<String, Object> variableValueType = new HashMap<>();
-
- Map<String, Object> requestMsg = new HashMap<>();
- requestMsg.put("value", request);
- requestMsg.put("type", "String");
-
- Map<String, Object> msorequestId = new HashMap<>();
- msorequestId.put("type", "String");
- msorequestId.put("value",requestId);
-
- Map<String, Object> timeout = new HashMap<>();
- timeout.put("type", "String");
- timeout.put("value","5");
-
- variableValueType.put("testAsyncRequestMsg", requestMsg);
- variableValueType.put("mso-request-id", msorequestId);
- variableValueType.put("mso-service-request-timeout", timeout);
-
- variableMap.put("variables", variableValueType);
-
- workflowResource.setProcessEngineServices4junit(processEngineRule);
- workflowResource.startProcessInstanceByKey( processKey, variableMap);
- }
-
-
+ @Test
+ @Deployment(resources = {"testAsyncResource.bpmn"})
+ public void asyncRequestSuccess() throws InterruptedException {
+ // it can be any request which asynchronously processed by the workflow
+ String request =
+ "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
+
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testAsyncRequestMsg", request);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("mso-service-request-timeout", "5");
+
+ WorkflowResponse workflowResponse =
+ BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
+ assertEquals(
+ "Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>",
+ workflowResponse.getResponse());
+ assertEquals(200, workflowResponse.getMessageCode());
+ }
+
+ private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException {
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", request);
+ requestMsg.put("type", "String");
+
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value", requestId);
+
+ Map<String, Object> timeout = new HashMap<>();
+ timeout.put("type", "String");
+ timeout.put("value", "5");
+
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
+
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineRule);
+ workflowResource.startProcessInstanceByKey(processKey, variableMap);
+ }
+
+
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
index 0efecac254..23f9818669 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
@@ -16,14 +16,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common;
import java.util.UUID;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
@@ -35,35 +34,35 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
public class WorkflowContextHolderTest {
- @Test
- public void testProcessCallback() throws Exception {
- String requestId = UUID.randomUUID().toString();
- String message = "TEST MESSATGE";
- String responseMessage = "Successfully processed request";
- int testCode = 200;
-
-
- WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setMessage(message);
- callbackResponse.setResponse(responseMessage);
- callbackResponse.setStatusCode(testCode);
-
- contextHolder.processCallback("testAsyncProcess","process-instance-id",requestId,callbackResponse);
-
- //same object returned
- WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId);
- if(contextFound == null)
- throw new Exception("Expected to find Context Object");
-
- WorkflowResponse testResponse = contextFound.getWorkflowResponse();
- Assert.assertEquals(200,testResponse.getMessageCode());
- Assert.assertEquals(message, testResponse.getMessage());
- Assert.assertEquals(responseMessage, testResponse.getResponse());
-
-
-
- }
+ @Test
+ public void testProcessCallback() throws Exception {
+ String requestId = UUID.randomUUID().toString();
+ String message = "TEST MESSATGE";
+ String responseMessage = "Successfully processed request";
+ int testCode = 200;
+
+
+ WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setMessage(message);
+ callbackResponse.setResponse(responseMessage);
+ callbackResponse.setStatusCode(testCode);
+
+ contextHolder.processCallback("testAsyncProcess", "process-instance-id", requestId, callbackResponse);
+
+ // same object returned
+ WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId);
+ if (contextFound == null)
+ throw new Exception("Expected to find Context Object");
+
+ WorkflowResponse testResponse = contextFound.getWorkflowResponse();
+ Assert.assertEquals(200, testResponse.getMessageCode());
+ Assert.assertEquals(message, testResponse.getMessage());
+ Assert.assertEquals(responseMessage, testResponse.getResponse());
+
+
+
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index eed2978bc7..389f931901 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.onap.so.bpmn.core.json.JsonUtils.getJsonValue;
import static org.onap.so.bpmn.core.json.JsonUtils.updJsonValue;
-
import java.io.IOException;
import java.io.StringReader;
import java.lang.management.ManagementFactory;
@@ -37,7 +36,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import javax.ws.rs.core.Response;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.NamespaceContext;
@@ -50,7 +48,6 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-
import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineException;
@@ -98,2158 +95,2108 @@ import org.xml.sax.SAXException;
/**
* A base class for Workflow tests.
* <p>
- * WireMock response transformers may be specified by declaring public
- * static fields with the @WorkflowTestTransformer annotation. For example:
+ * WireMock response transformers may be specified by declaring public static fields with the @WorkflowTestTransformer
+ * annotation. For example:
+ *
* <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
* </pre>
*/
public abstract class WorkflowTest {
- private static final Logger logger = LoggerFactory.getLogger(WorkflowTest.class);
-
- //TODO this is not used anymore, can maybe be removed
- @Rule
- public ProcessEngineRule processEngineRule;
-
- @Autowired
- protected WorkflowResource workflowResourceSync;
-
- @Autowired
- protected ProcessEngine processEngine;
-
- @Autowired
- protected RuntimeService runtimeService;
-
- @Autowired
- protected HistoryService historyService;
-
- @Autowired
- private WorkflowAsyncResource workflowResource;
-
- @Autowired
- private WorkflowMessageResource workflowMessageResource;
-
- @Autowired
- SDNCAdapterCallbackServiceImpl callbackService;
- /**
- * Content-Type for XML.
- */
- protected static final String XML = "application/xml";
-
- /**
- * Content-Type for JSON.
- */
- protected static final String JSON = "application/json; charset=UTF-8";
-
- private static final int timeout = 2000;
-
- /**
- * Constructor.
- */
- public WorkflowTest() throws RuntimeException {
- }
-
- /**
- * The current request ID. Normally set when an "invoke" method is called.
- */
- protected volatile String msoRequestId = null;
-
- /**
- * The current service instance ID. Normally set when an "invoke" method
- * is called.
- */
- protected volatile String msoServiceInstanceId = null;
-
- /**
- * Logs a test start method.
- */
- protected void logStart() {
- logger.debug("STARTED TEST");
- }
-
- /**
- * Logs a test end method.
- */
- protected void logEnd() {
- logger.debug("ENDED TEST");
- }
-
- /**
- * Invokes a subprocess.
- * @param processKey the process key
- * @param businessKey a unique key that will identify the process instance
- * @param injectedVariables variables to inject into the process
- */
- protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.debug("JVM args = {}", arguments);
-
- msoRequestId = (String) injectedVariables.get("mso-request-id");
- String requestId = (String) injectedVariables.get("msoRequestId");
-
- if (msoRequestId == null && requestId == null) {
- String msg = "mso-request-id variable was not provided";
- logger.debug(msg);
- fail(msg);
- }
-
- // Note: some scenarios don't have a service-instance-id, may be null
- msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
-
-
- runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
- }
-
- protected String invokeSubProcess(String processKey, Map<String, Object> injectedVariables) {
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.debug("JVM args = {}", arguments);
-
- msoRequestId = (String) injectedVariables.get("mso-request-id");
- String requestId = (String) injectedVariables.get("msoRequestId");
-
- if (msoRequestId == null && requestId == null) {
- String msg = "mso-request-id variable was not provided";
- logger.debug(msg);
- fail(msg);
- }
-
- // Note: some scenarios don't have a service-instance-id, may be null
- msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
-
-
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, msoRequestId, injectedVariables);
- return processInstance.getId();
- }
-
- /**
- * Invokes an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param processKey the process key
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @return a TestAsyncResponse object associated with the test
- * @throws InterruptedException
- */
- protected TestAsyncResponse invokeAsyncProcess(String processKey,
- String schemaVersion, String businessKey, String request) throws InterruptedException {
- return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
- }
-
- /**
- * Invokes an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param processKey the process key
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @param injectedVariables optional variables to inject into the process
- * @return a TestAsyncResponse object associated with the test
- * @throws InterruptedException
- */
- protected TestAsyncResponse invokeAsyncProcess(String processKey,
- String schemaVersion, String businessKey, String request,
- Map<String, Object> injectedVariables) {
-
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.debug("JVM args = {}", arguments);
-
- Map<String, Object> variables = createVariables(schemaVersion, businessKey,
- request, injectedVariables, false);
- VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
- logger.debug("Sending {} to {} process", request, processKey);
-
- TestAsyncResponse asyncResponse = new TestAsyncResponse();
-
- asyncResponse.setResponse(workflowResource.startProcessInstanceByKey( processKey, variableMapImpl));
-
- return asyncResponse;
- }
-
- /**
- * Invokes an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param processKey the process key
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @param injectedVariables optional variables to inject into the process
- * @param serviceInstantiationModel indicates whether this method is being
- * invoked for a flow that is designed using the service instantiation model
- * @return a TestAsyncResponse object associated with the test
- * @throws InterruptedException
- */
- protected Response invokeAsyncProcess(String processKey,
- String schemaVersion, String businessKey, String request,
- Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
-
- RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
- List<String> arguments = runtimeMxBean.getInputArguments();
- logger.debug("JVM args = {}", arguments);
-
- Map<String, Object> variables = createVariables(schemaVersion, businessKey,
- request, injectedVariables, serviceInstantiationModel);
- VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
-
- logger.debug("Sending {} to {} process", request, processKey);
-
- return workflowResource.startProcessInstanceByKey( processKey, variableMapImpl);
-
- }
-
- /**
- * Private helper method that creates a variable map for a request.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param schemaVersion the API schema version, e.g. "v1"
- * @param businessKey a unique key that will identify the process instance
- * @param request the request
- * @param injectedVariables optional variables to inject into the process
- * @param serviceInstantiationModel indicates whether this method is being
- * invoked for a flow that is designed using the service instantiation model
- * @return a variable map
- */
- private Map<String, Object> createVariables(String schemaVersion,
- String businessKey, String request, Map<String, Object> injectedVariables,
- boolean serviceInstantiationModel) {
-
- Map<String, Object> variables = new HashMap<>();
-
- // These variables may be overridded by injected variables.
- variables.put("mso-service-request-timeout", "180");
- variables.put("isDebugLogEnabled", "true");
-
- // These variables may not be overridded by injected variables.
- String[] notAllowed = new String[] {
- "mso-schema-version",
- "mso-business-key",
- "bpmnRequest",
- "mso-request-id",
- "mso-service-instance-id"
- };
-
- if (injectedVariables != null) {
- for (String key : injectedVariables.keySet()) {
- for (String var : notAllowed) {
- if (var.equals(key)) {
- String msg = "Cannot specify " + var + " in injected variables";
- logger.debug(msg);
- fail(msg);
- }
- }
-
- variables.put(key, injectedVariables.get(key));
- }
- }
-
- variables.put("mso-schema-version", schemaVersion);
- variables.put("mso-business-key", businessKey);
- variables.put("bpmnRequest", request);
-
- if (serviceInstantiationModel) {
-
- /*
- * The request ID and the service instance ID are generated for flows
- * that follow the service instantiation model unless "requestId" and
- * "serviceInstanceId" are injected variables.
- */
-
- try {
- msoRequestId = (String) injectedVariables.get("requestId");
- variables.put("mso-request-id", msoRequestId);
- msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
- variables.put("mso-service-instance-id", msoServiceInstanceId);
- }
- catch(Exception e) {
- }
- if (msoRequestId == null || msoRequestId.trim().equals("")) {
- logger.debug("No requestId element in injectedVariables");
- variables.put("mso-request-id", UUID.randomUUID().toString());
- }
- if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
- logger.debug("No seviceInstanceId element in injectedVariables");
- variables.put("mso-service-instance-id", UUID.randomUUID().toString());
- }
-
- } else {
- msoRequestId = getXMLTextElement(request, "request-id");
-
- if (msoRequestId == null) {
- //check in injected variables
- try {
- msoRequestId = (String) injectedVariables.get("requestId");
- }
- catch(Exception e) {
- }
- if (msoRequestId == null || msoRequestId.trim().equals("")) {
- String msg = "No request-id element in " + request;
- logger.debug(msg);
- fail(msg);
- }
- }
-
- variables.put("mso-request-id", msoRequestId);
-
- // Note: some request types don't have a service-instance-id
- msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
-
- if (msoServiceInstanceId != null) {
- variables.put("mso-service-instance-id", msoServiceInstanceId);
- }
- }
-
- return variables;
- }
-
- /**
- * Private helper method that creates a camunda VariableMapImpl from a simple
- * variable map.
- * @param variables the simple variable map
- * @return a VariableMap
- */
- private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
- Map<String, Object> wrappedVariables = new HashMap<>();
-
- for (String key : variables.keySet()) {
- Object value = variables.get(key);
- wrappedVariables.put(key, wrapVariableValue(value));
- }
-
- VariableMapImpl variableMapImpl = new VariableMapImpl();
- variableMapImpl.put("variables", wrappedVariables);
- return variableMapImpl;
- }
-
- /**
- * Private helper method that wraps a variable value for inclusion in a
- * camunda VariableMapImpl.
- * @param value the variable value
- * @return the wrapped variable
- */
- private Map<String, Object> wrapVariableValue(Object value) {
- HashMap<String, Object> valueMap = new HashMap<>();
- valueMap.put("value", value);
- return valueMap;
- }
-
- /**
- * Receives a response from an asynchronous process.
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param businessKey the process business key
- * @param asyncResponse the TestAsyncResponse object associated with the test
- * @param timeout the timeout in milliseconds
- * @return the WorkflowResponse
- */
- protected WorkflowResponse receiveResponse(String businessKey,
- TestAsyncResponse asyncResponse, long timeout) {
- logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- Response response = asyncResponse.getResponse();
-
- if (response != null) {
- logger.debug("Received a response from process with business key {}", businessKey);
-
- Object entity = response.getEntity();
-
- if (!(entity instanceof WorkflowResponse)) {
- String msg = "Response entity is " +
- (entity == null ? "null" : entity.getClass().getName()) +
- ", expected WorkflowResponse";
- logger.debug(msg);
- fail(msg);
- return null; // unreachable
- }
-
- return (WorkflowResponse) entity;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for a response from process with business key " +
- businessKey;
- logger.debug(msg);
- fail(msg);
- return null; // unreachable
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "No response received from process with business key " + businessKey +
- " within " + timeout + "ms";
- logger.debug(msg);
- fail("Process with business key " + businessKey + " did not end within 10000ms");
- return null; // unreachable
- }
-
- /**
- * Runs a program to inject SDNC callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' SDNC request";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else if ("ERR".equals(modifier)) {
- content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
- contentType = JSON;
- } else {
- String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (contentType == null) {
- // Default for backward compatibility with existing tests.
- contentType = JSON;
- }
-
- if (!injectSDNCRestCallback(contentType, content, 10000)) {
- fail("Failed to inject SDNC '" + action + "' callback");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of SDNC '" + action + "' callback");
- }
- }
- }
-
- /**
- * Runs a program to inject SDNC events into the test environment.
- * A program is essentially just a list of keys that identify event data
- * to be injected, in sequence. An example program:
- * <pre>
- * event1, event2
- * </pre>
- * NOTE: Each callback must have a message type associated with it, e.g.
- * "SDNCAEvent".
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectSDNCEvents(CallbackSet callbacks, String program) {
- injectWorkflowMessages(callbacks, program);
- }
-
- /**
- * Runs a program to inject SDNC callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * Uses the static/default timeout value for backward compatibility.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
- injectSDNCCallbacks(callbacks, program, timeout);
- }
-
- /**
- * Runs a program to inject SDNC callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * reserve, assign, delete:ERR
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- * @param timeout a timeout value to wait for the callback
- */
- protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
- int respCode = 200;
- String respMsg = "OK";
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' SDNC request";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- respCode = 200;
- respMsg = "OK";
- } else if ("CREATED".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' SDNC request";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- respCode = 201;
- respMsg = "Created";
- } else if ("ERR".equals(modifier)) {
- content = "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
- respCode = 500;
- respMsg = "SERVER ERROR";
- } else {
- String msg = "Invalid SDNC program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
- fail("Failed to inject SDNC '" + action + "' callback");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of SDNC '" + action + "' callback");
- }
- }
- }
-
- /**
- * Runs a program to inject VNF adapter REST callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * create, rollback
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' VNF REST request";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else if ("ERR".equals(modifier)) {
- content = "SIMULATED ERROR FROM VNF ADAPTER";
- contentType = "text/plain";
- } else {
- String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (contentType == null) {
- // Default for backward compatibility with existing tests.
- contentType = XML;
- }
-
- if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
- fail("Failed to inject VNF REST '" + action + "' callback");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of VNF REST '" + action + "' callback");
- }
- }
- }
-
- /**
- * Runs a program to inject VNF callback data into the test environment.
- * A program is essentially just a list of keys that identify callback data
- * to be injected, in sequence. An example program:
- * <pre>
- * createVnf, deleteVnf
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * @param callbacks an object containing callback data for the program
- * @param program the program to execute
- */
- protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String content = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No callback defined for '" + action + "' VNF request";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- } else if ("ERR".equals(modifier)) {
- String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- } else {
- String msg = "Invalid VNF program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- boolean injected = false;
-
- if (content.contains("createVnfNotification")) {
- injected = injectCreateVNFCallback(content, 10000);
- } else if (content.contains("deleteVnfNotification")) {
- injected = injectDeleteVNFCallback(content, 10000);
- } else if (content.contains("updateVnfNotification")) {
- injected = injectUpdateVNFCallback(content, 10000);
- }
-
- if (!injected) {
- String msg = "Failed to inject VNF '" + action + "' callback";
- logger.debug(msg);
- fail(msg);
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of VNF '" + action + "' callback");
- }
- }
- }
-
- /**
- * Waits for the number of running processes with the specified process
- * definition key to equal a particular count.
- * @param processKey the process definition key
- * @param count the desired count
- * @param timeout the timeout in milliseconds
- */
- protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
- logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
- int last = -1;
-
- while (now <= endTime) {
- int actual = runtimeService
- .createProcessInstanceQuery()
- .processDefinitionKey(processKey)
- .list().size();
-
- if (actual != last) {
- logger.debug("There are now {} {} instances", actual, processKey);
- last = actual;
- }
-
- if (actual == count) {
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for there to be " + count + " "
- + processKey + " instances";
- logger.debug(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Timed out waiting for there to be " + count + " "
- + processKey + " instances";
- logger.debug(msg);
- fail(msg);
- }
-
- /**
- * Waits for the specified process variable to be set.
- * @param processKey the process definition key
- * @param variable the variable name
- * @param timeout the timeout in milliseconds
- * @return the variable value, or null if it cannot be obtained
- * in the specified time
- */
- protected Object getProcessVariable(String processKey, String variable,
- long timeout) {
-
- logger.debug("Waiting " + timeout + "ms for " + processKey + "." + variable + " to be set");
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- ProcessInstance processInstance = null;
- Object value = null;
-
- while (value == null) {
- if (now > endTime) {
- if (processInstance == null) {
- logger.debug("Timed out waiting for "
- + processKey + " to start");
- } else {
- logger.debug("Timed out waiting for "
- + processKey + "[" + processInstance.getId()
- + "]." + variable + " to be set");
- }
-
- return null;
- }
-
- ProcessInstanceQuery processInstanceQuery = null;
- if (processInstance == null) {
- processInstanceQuery = runtimeService
- .createProcessInstanceQuery()
- .processDefinitionKey(processKey);
- }
-
- if(processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0){
- processInstance = processInstanceQuery.singleResult();
- }else{
- //TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list
- logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list",
- processInstanceQuery.count());
- List<ProcessInstance> processList = processInstanceQuery.list();
- processInstance = processList.get((processList.size() - 1));
- }
-
-
- if (processInstance != null) {
- value = runtimeService
- .getVariable(processInstance.getId(), variable);
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable);
- return null;
- }
-
- now = System.currentTimeMillis();
- }
-
- logger.debug(processKey + "["
- + processInstance.getId() + "]." + variable + "="
- + value);
-
- return value;
- }
-
- /**
- * Injects a single SDNC adapter callback request. The specified callback data
- * may contain the placeholder string ((REQUEST-ID)) which is replaced with
- * the actual SDNC request ID. Note: this is not the requestId in the original
- * MSO request.
- * @param contentType the HTTP content type for the callback
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- */
- protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
- String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1",
- "SDNCAResponse_CORRELATOR", timeout);
-
- if (sdncRequestId == null) {
- sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2",
- "SDNCAResponse_CORRELATOR", timeout);
- }
-
- if (sdncRequestId == null) {
- return false;
- }
-
- content = content.replace("((REQUEST-ID))", sdncRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", sdncRequestId);
-
- logger.debug("Injecting SDNC adapter callback");
-
- Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
- logger.debug("Workflow response to SDNC adapter callback: " + response);
- return true;
- }
-
- /**
- * Injects a single SDNC adapter callback request. The specified callback data
- * may contain the placeholder string ((REQUEST-ID)) which is replaced with
- * the actual SDNC request ID. Note: this is not the requestId in the original
- * MSO request.
- * @param content the content of the callback
- * @param respCode the response code (normally 200)
- * @param respMsg the response message (normally "OK")
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- */
- protected boolean injectSDNCCallback(int respCode, String respMsg,
- String content, long timeout) {
-
- String sdncRequestId = (String) getProcessVariable("sdncAdapter",
- "SDNCA_requestId", timeout);
-
- if (sdncRequestId == null) {
- return false;
- }
-
- content = content.replace("((REQUEST-ID))", sdncRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", sdncRequestId);
-
- // TODO this needs to be fixed. It is causing double tags and content
- // Need to parse content before setting below since content includes not just RequestData or modify callback files to only contain RequestData contents.
-
- logger.debug("Injecting SDNC adapter callback");
- CallbackHeader callbackHeader = new CallbackHeader();
- callbackHeader.setRequestId(sdncRequestId);
- callbackHeader.setResponseCode(String.valueOf(respCode));
- callbackHeader.setResponseMessage(respMsg);
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
- sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
- sdncAdapterCallbackRequest.setRequestData(content);
- SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
- logger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
-
- return true;
- }
-
- /**
- * Injects a single VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. Note: this is not the requestId in the original
- * MSO request.
- * @param contentType the HTTP content type for the callback
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- */
- protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
- String messageId = (String) getProcessVariable("vnfAdapterRestV1",
- "VNFAResponse_CORRELATOR", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- logger.debug("Injecting VNF adapter callback");
-
- Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
- logger.debug("Workflow response to VNF adapter callback: {}", response);
- return true;
- }
-
- /**
- * Injects a Create VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. It may also contain the placeholder string
- * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- * @throws JAXBException if the content does not adhere to the schema
- */
- protected boolean injectCreateVNFCallback(String content, long timeout) {
-
- String messageId = (String) getProcessVariable("vnfAdapterCreateV1",
- "VNFC_messageId", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- if(content.contains("((REQUEST-ID))")){
- content = content.replace("((REQUEST-ID))", msoRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", msoRequestId);
- }
-
- logger.debug("Injecting VNF adapter callback");
-
- // Is it possible to unmarshal this with JAXB? I couldn't.
-
- CreateVnfNotification createVnfNotification = new CreateVnfNotification();
- XPathTool xpathTool = new VnfNotifyXPathTool();
- xpathTool.setXML(content);
-
- try {
- String completed = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:completed/text()");
- createVnfNotification.setCompleted("true".equals(completed));
-
- String vnfId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:vnfId/text()");
- createVnfNotification.setVnfId(vnfId);
-
- NodeList entries = (NodeList) xpathTool.evaluate(
- "/tns:createVnfNotification/tns:outputs/tns:entry",
- XPathConstants.NODESET);
-
- CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
-
- for (int i = 0; i < entries.getLength(); i++) {
- Node node = entries.item(i);
-
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
- String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
- outputs.add(key, value);
- }
- }
-
- createVnfNotification.setOutputs(outputs);
-
- VnfRollback rollback = new VnfRollback();
-
- String cloudSiteId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
- rollback.setCloudSiteId(cloudSiteId);
-
- String cloudOwner = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
- rollback.setCloudOwner(cloudOwner);
-
- String requestId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
- String serviceInstanceId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
-
- if (requestId != null || serviceInstanceId != null) {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId(requestId);
- msoRequest.setServiceInstanceId(serviceInstanceId);
- rollback.setMsoRequest(msoRequest);
- }
-
- String tenantCreated = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
- rollback.setTenantCreated("true".equals(tenantCreated));
-
- String tenantId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
- rollback.setTenantId(tenantId);
-
- String vnfCreated = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
- rollback.setVnfCreated("true".equals(vnfCreated));
-
- String rollbackVnfId = xpathTool.evaluate(
- "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
- rollback.setVnfId(rollbackVnfId);
-
- createVnfNotification.setRollback(rollback);
-
- } catch (Exception e) {
- logger.debug("Failed to unmarshal VNF callback content:");
- logger.debug(content);
- return false;
- }
-
- VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
-
-
- notifyService.createVnfNotification(
- messageId,
- createVnfNotification.isCompleted(),
- createVnfNotification.getException(),
- createVnfNotification.getErrorMessage(),
- createVnfNotification.getVnfId(),
- createVnfNotification.getOutputs(),
- createVnfNotification.getRollback());
-
- return true;
- }
-
- /**
- * Injects a Delete VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. It may also contain the placeholder string
- * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- * @throws JAXBException if the content does not adhere to the schema
- */
- protected boolean injectDeleteVNFCallback(String content, long timeout) {
-
- String messageId = (String) getProcessVariable("vnfAdapterDeleteV1",
- "VNFDEL_uuid", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- logger.debug("Injecting VNF adapter delete callback");
-
- // Is it possible to unmarshal this with JAXB? I couldn't.
-
- DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
- XPathTool xpathTool = new VnfNotifyXPathTool();
- xpathTool.setXML(content);
-
- try {
- String completed = xpathTool.evaluate(
- "/tns:deleteVnfNotification/tns:completed/text()");
- deleteVnfNotification.setCompleted("true".equals(completed));
- // if notification failure, set the exception and error message
- if (deleteVnfNotification.isCompleted() == false) {
- deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
- deleteVnfNotification.setErrorMessage(xpathTool.evaluate(
- "/tns:deleteVnfNotification/tns:errorMessage/text()")) ;
- }
-
- } catch (Exception e) {
- logger.debug("Failed to unmarshal VNF Delete callback content:");
- logger.debug(content);
- return false;
- }
-
- VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
-
-
- notifyService.deleteVnfNotification(
- messageId,
- deleteVnfNotification.isCompleted(),
- deleteVnfNotification.getException(),
- deleteVnfNotification.getErrorMessage());
-
- return true;
- }
-
- /**
- * Injects a Update VNF adapter callback request. The specified callback data
- * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
- * the actual message ID. It may also contain the placeholder string
- * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
- * @param content the content of the callback
- * @param timeout the timeout in milliseconds
- * @return true if the callback could be injected, false otherwise
- * @throws JAXBException if the content does not adhere to the schema
- */
- protected boolean injectUpdateVNFCallback(String content, long timeout) {
-
- String messageId = (String) getProcessVariable("vnfAdapterUpdate",
- "VNFU_messageId", timeout);
-
- if (messageId == null) {
- return false;
- }
-
- content = content.replace("((MESSAGE-ID))", messageId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{MESSAGE-ID}}", messageId);
-
- content = content.replace("((REQUEST-ID))", msoRequestId);
- // Deprecated usage. All test code should switch to the (( ... )) syntax.
- content = content.replace("{{REQUEST-ID}}", msoRequestId);
-
- logger.debug("Injecting VNF adapter callback");
-
- // Is it possible to unmarshal this with JAXB? I couldn't.
-
- UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
- XPathTool xpathTool = new VnfNotifyXPathTool();
- xpathTool.setXML(content);
-
- try {
- String completed = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:completed/text()");
- updateVnfNotification.setCompleted("true".equals(completed));
-
- NodeList entries = (NodeList) xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:outputs/tns:entry",
- XPathConstants.NODESET);
-
- UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
-
- for (int i = 0; i < entries.getLength(); i++) {
- Node node = entries.item(i);
-
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
- String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
- outputs.add(key, value);
- }
- }
-
- updateVnfNotification.setOutputs(outputs);
-
- VnfRollback rollback = new VnfRollback();
-
- String cloudSiteId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
- rollback.setCloudSiteId(cloudSiteId);
-
- String cloudOwner = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
- rollback.setCloudOwner(cloudOwner);
-
- String requestId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
- String serviceInstanceId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
-
- if (requestId != null || serviceInstanceId != null) {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId(requestId);
- msoRequest.setServiceInstanceId(serviceInstanceId);
- rollback.setMsoRequest(msoRequest);
- }
-
- String tenantCreated = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
- rollback.setTenantCreated("true".equals(tenantCreated));
-
- String tenantId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
- rollback.setTenantId(tenantId);
-
- String vnfCreated = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
- rollback.setVnfCreated("true".equals(vnfCreated));
-
- String rollbackVnfId = xpathTool.evaluate(
- "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
- rollback.setVnfId(rollbackVnfId);
-
- updateVnfNotification.setRollback(rollback);
-
- } catch (Exception e) {
- logger.debug("Failed to unmarshal VNF callback content:");
- logger.debug(content);
- return false;
- }
-
- VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
-
-
- notifyService.updateVnfNotification(
- messageId,
- updateVnfNotification.isCompleted(),
- updateVnfNotification.getException(),
- updateVnfNotification.getErrorMessage(),
- updateVnfNotification.getOutputs(),
- updateVnfNotification.getRollback());
-
- return true;
- }
-
- /**
- * Runs a program to inject workflow messages into the test environment.
- * A program is essentially just a list of keys that identify event data
- * to be injected, in sequence. An example program:
- * <pre>
- * event1, event2
- * </pre>
- * Errors are handled with junit assertions and will cause the test to fail.
- * NOTE: Each callback must have a workflow message type associated with it.
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String messageType = null;
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No '" + action + "' workflow message callback is defined";
- logger.debug(msg);
- fail(msg);
- }
-
- messageType = callbackData.getMessageType();
-
- if (messageType == null || messageType.trim().equals("")) {
- String msg = "No workflow message type is defined in the '" + action + "' callback";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
- fail("Failed to inject '" + action + "' workflow message");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of '" + action + "' workflow message");
- }
- }
- }
-
- /**
- * Injects a workflow message. The specified callback data may contain the
- * placeholder string ((CORRELATOR)) which is replaced with the actual
- * correlator value.
- * @param contentType the HTTP contentType for the message (possibly null)
- * @param messageType the message type
- * @param content the message content (possibly null)
- * @param timeout the timeout in milliseconds
- * @return true if the message could be injected, false otherwise
- */
- protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
- String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
- messageType + "_CORRELATOR", timeout);
-
- if (correlator == null) {
- return false;
- }
-
- if (content != null) {
- content = content.replace("((CORRELATOR))", correlator);
- }
-
- logger.debug("Injecting " + messageType + " message");
-
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- logger.debug("Workflow response to {} message: {}", messageType, response);
- return true;
- }
-
- /**
- * Runs a program to inject sniro workflow messages into the test environment.
- * A program is essentially just a list of keys that identify event data
- * to be injected, in sequence. For more details, see
- * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout)
- *
- * Errors are handled with junit assertions and will cause the test to fail.
- * NOTE: Each callback must have a workflow message type associated with it.
- *
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String messageType = null;
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No '" + action + "' workflow message callback is defined";
- logger.debug(msg);
- fail(msg);
- }
-
- messageType = callbackData.getMessageType();
-
- if (messageType == null || messageType.trim().equals("")) {
- String msg = "No workflow message type is defined in the '" + action + "' callback";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
- fail("Failed to inject '" + action + "' workflow message");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of '" + action + "' workflow message");
- }
- }
- }
-
- /**
- * Injects a sniro workflow message. The specified callback response may
- * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID))
- * The ((CORRELATOR)) is replaced with the actual correlator value from the
- * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId
- * value from the sniro request. Currently this only works with sniro request
- * that contain only 1 resource.
- *
- * @param contentType the HTTP contentType for the message (possibly null)
- * @param messageType the message type
- * @param content the message content (possibly null)
- * @param timeout the timeout in milliseconds
- * @return true if the message could be injected, false otherwise
- */
- protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
- String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
- messageType + "_CORRELATOR", timeout);
-
- if (correlator == null) {
- return false;
- }
- if (content != null) {
- content = content.replace("((CORRELATOR))", correlator);
- if(messageType.equalsIgnoreCase("SNIROResponse")){
- ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
- List<Resource> resourceList = decomp.getServiceResources();
- if(resourceList.size() == 1){
- String resourceId = "";
- for(Resource resource:resourceList){
- resourceId = resource.getResourceId();
- }
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- JSONArray placementArr = null;
- try {
- placementArr = new JSONArray(homingList);
- }
- catch (Exception e) {
- return false;
- }
- if(placementArr.length() == 1){
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray licenseArr = null;
- try {
- licenseArr = new JSONArray(licenseInfoList);
- }
- catch (Exception e) {
- return false;
- }
- if(licenseArr.length() == 1){
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- }
- else {
- try {
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray placementArr = new JSONArray(homingList);
- JSONArray licenseArr = new JSONArray(licenseInfoList);
- for (Resource resource: resourceList) {
- String resourceModuleName = resource.getModelInfo().getModelInstanceName();
- String resourceId = resource.getResourceId();
-
- for (int i=0; i<placementArr.length(); i++) {
- JSONObject placementObj = placementArr.getJSONObject(i);
- String placementModuleName = placementObj.getString("resourceModuleName");
- if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
- String placementString = placementObj.toString();
- placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newPlacementObj = new JSONObject(placementString);
- placementArr.put(i, newPlacementObj);
- }
- }
-
- for (int i=0; i<licenseArr.length(); i++) {
- JSONObject licenseObj = licenseArr.getJSONObject(i);
- String licenseModuleName = licenseObj.getString("resourceModuleName");
- if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
- String licenseString = licenseObj.toString();
- licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newLicenseObj = new JSONObject(licenseString);
- licenseArr.put(i, newLicenseObj);
- }
- }
- }
- String newPlacementInfos = placementArr.toString();
- String newLicenseInfos = licenseArr.toString();
- content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
- content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
- }
- catch(Exception e) {
- return false;
- }
-
- }
- }
- }
- logger.debug("Injecting " + messageType + " message");
-
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- logger.debug("Workflow response to {} message: {}", messageType, response);
- return true;
- }
-
-
- /**
- * Wait for the process to end.
- * @param businessKey the process business key
- * @param timeout the amount of time to wait, in milliseconds
- */
- protected void waitForProcessEnd(String businessKey, long timeout) {
- logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- if (isProcessEnded(businessKey)) {
- logger.debug("Process with business key {} has ended", businessKey);
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for process with business key " +
- businessKey + " to end";
- logger.debug(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Process with business key " + businessKey +
- " did not end within " + timeout + "ms";
- logger.debug(msg);
- fail(msg);
- }
-
- /**
- * Wait for the process to end. Must be used when multiple process instances exist with
- * this same business key such as when its passed to subflows or shared across multiple
- * processes.
- *
- * @param businessKey the process business key
- * @param processName the process definition name
- * @param timeout the amount of time to wait, in milliseconds
- * @author cb645j
- */
- protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
- logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
-
- long now = System.currentTimeMillis() + timeout;
- long endTime = now + timeout;
-
- while (now <= endTime) {
- if (isProcessEnded(businessKey, processName)) {
- logger.debug("Process with business key {} has ended", businessKey);
- return;
- }
-
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- String msg = "Interrupted waiting for process with business key " +
- businessKey + " to end";
- logger.debug(msg);
- fail(msg);
- }
-
- now = System.currentTimeMillis();
- }
-
- String msg = "Process with business key " + businessKey +
- " did not end within " + timeout + "ms";
- logger.debug(msg);
- fail(msg);
- }
-
- /**
- * Verifies that the specified historic process variable has the specified value.
- * If the variable does not have the specified value, the test is failed.
- *
- * @param businessKey the process business key
- * @param variable the variable name
- * @param value the expected variable value
- */
- protected void checkVariable(String businessKey, String variable, Object value) {
- if (!isProcessEnded(businessKey)) {
- fail("Cannot get historic variable " + variable + " because process with business key " +
- businessKey + " has not ended");
- }
-
- Object variableValue = getVariableFromHistory(businessKey, variable);
- assertEquals(value, variableValue);
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param businessKey the process business Key
- * @return true if the process is ended
- */
- protected boolean isProcessEnded(String businessKey) {
- HistoricProcessInstance processInstance = historyService
- .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
- return processInstance != null && processInstance.getEndTime() != null;
- }
-
- /**
- * Checks to see if the specified process is ended.
- *
- * @param processInstanceId the process Instance Id
- * @return true if the process is ended
- */
- protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
- HistoricProcessInstance processInstance = historyService
- .createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
- return processInstance != null && processInstance.getEndTime() != null;
- }
-
- /**
- * Checks to see if the specified process is ended.
- *
- * @author cb645j
- */
- //TODO combine into 1
- private boolean isProcessEnded(String businessKey, String processName) {
- HistoricProcessInstance processInstance = historyService
- .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
- return processInstance != null && processInstance.getEndTime() != null;
- }
-
- /**
- * Gets a variable value from a historical process instance. The business key must be unique.
- *
- * @param businessKey the process business key
- * @param variableName the variable name
- * @return the variable value or null if the variable does not exist
- */
- protected Object getVariableFromHistory(String businessKey, String variableName) {
- try {
- HistoricProcessInstance processInstance = historyService
- .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
-
- if (processInstance == null) {
- return null;
- }
-
- HistoricVariableInstance v = historyService
- .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName, businessKey,
- e);
- return null;
- }
- }
-
- /**
- * Gets a variable value from a process instance based on businessKey and process name.
- * Must be used when multiple instances exist with the same business key such as when
- * business key is passed to subflows or shared across multiple processes. This method
- * can obtain variables from mainflows and from subflows.
- *
- * @param businessKey the process business key
- * @param processName the process definition name
- * @param variableName the variable name
- * @return the variable value or null if the variable does not exist
- * @author cb645j
- */
- protected Object getVariableFromHistory(String businessKey, String processName, String variableName){
- try{
- HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName)
- .singleResult();
-
- if(processInstance == null){
- return null;
- }
- HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
-
- return variable == null ? null : variable.getValue();
- }catch(ProcessEngineException e){
- logger.debug("Multiple proccess instances exist with process name {} and business key {}. Must pass instance "
- + "index as a parameter.", processName, businessKey);
- return null;
- }catch(Exception e){
- logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
- variableName, processName, businessKey, e);
- return null;
- }
- }
-
- /**
- * Gets the value of a process variable from x instance of y process. Must be used when
- * multiple instances exist with the same business key AND process name. This method
- * shall be used primarily for obtaining subflow variables when the business key is
- * passed to the subflow AND the subflow is called multiple times in a given flow.
- *
- * @param businessKey the process business key
- * @param processName the name of the subflow that contains the variable
- * @param variableName the variable name
- * @param processInstanceIndex the instance in which the subprocess was called
- * @return the variable value or null if the variable does not exist
- * @author cb645j
- */
- protected Object getVariableFromHistory(String businessKey, int subflowInstanceIndex, String processName, String variableName){
- try{
- List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName)
- .list();
-
- if(processInstanceList == null){
- return null;
- }
- processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
- HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
- HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
-
- return variable == null ? null : variable.getValue();
- }catch(Exception e) {
- logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
- variableName, processName, businessKey, e);
- return null;
- }
- }
-
-
- /**
- * Gets the value of a subflow variable from the specified subflow's
- * historical process instance.
- *
- * DEPRECATED - Use method getVariableFromHistory(businessKey, processName, variableName) instead
- *
- * @param subflowName - the name of the subflow that contains the variable
- * @param variableName the variable name
- *
- * @return the variable value, or null if the variable could not be obtained
- *
- */
- @Deprecated
- protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
- try {
- List<HistoricProcessInstance> processInstanceList = historyService
- .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
-
- if (processInstanceList == null) {
- return null;
- }
-
- processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
- HistoricProcessInstance processInstance = processInstanceList.get(0);
-
- HistoricVariableInstance v = historyService
- .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName, e);
- return null;
- }
- }
-
- /**
- * Gets the value of a subflow variable from the subflow's
- * historical process x instance.
- *
- * DEPRECATED: Use method getVariableFromHistory(businessKey, processInstanceIndex, processName, variableName) instead
- *
- * @param subflowName - the name of the subflow that contains the variable
- * @param variableName the variable name
- * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow)
- *
- * @return the variable value, or null if the variable could not be obtained
- */
- @Deprecated
- protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
- try {
- List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
-
- if (processInstanceList == null) {
- return null;
- }
-
- processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
-
- HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
-
- HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
- .variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ", variableName,
- subflowInstanceIndex, subflowName, e);
- return null;
- }
- }
-
- /**
- * Extracts text from an XML element. This method is not namespace aware
- * (namespaces are ignored). The first matching element is selected.
- * @param xml the XML document or fragment
- * @param tag the desired element, e.g. "<name>"
- * @return the element text, or null if the element was not found
- */
- protected String getXMLTextElement(String xml, String tag) {
- xml = removeXMLNamespaces(xml);
-
- if (!tag.startsWith("<")) {
- tag = "<" + tag + ">";
- }
-
- int start = xml.indexOf(tag);
-
- if (start == -1) {
- return null;
- }
-
- int end = xml.indexOf('<', start + tag.length());
-
- if (end == -1) {
- return null;
- }
-
- return xml.substring(start + tag.length(), end);
- }
-
- /**
- * Removes namespace definitions and prefixes from XML, if any.
- */
- private String removeXMLNamespaces(String xml) {
- // remove xmlns declaration
- xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
-
- // remove opening tag prefix
- xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
-
- // remove closing tags prefix
- xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
-
- // remove extra spaces left when xmlns declarations are removed
- xml = xml.replaceAll("\\s+>", ">");
-
- return xml;
- }
-
- /**
- * Asserts that two XML documents are semantically equivalent. Differences
- * in whitespace or in namespace usage do not affect the comparison.
- * @param expected the expected XML
- * @param actual the XML to test
- * @throws SAXException
- * @throws IOException
- */
- public static void assertXMLEquals(String expected, String actual)
- throws SAXException, IOException {
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreAttributeOrder(true);
- DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
- List<?> allDifferences = diff.getAllDifferences();
- assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowTest.class);
+
+ // TODO this is not used anymore, can maybe be removed
+ @Rule
+ public ProcessEngineRule processEngineRule;
+
+ @Autowired
+ protected WorkflowResource workflowResourceSync;
+
+ @Autowired
+ protected ProcessEngine processEngine;
+
+ @Autowired
+ protected RuntimeService runtimeService;
+
+ @Autowired
+ protected HistoryService historyService;
+
+ @Autowired
+ private WorkflowAsyncResource workflowResource;
+
+ @Autowired
+ private WorkflowMessageResource workflowMessageResource;
+
+ @Autowired
+ SDNCAdapterCallbackServiceImpl callbackService;
+ /**
+ * Content-Type for XML.
+ */
+ protected static final String XML = "application/xml";
+
+ /**
+ * Content-Type for JSON.
+ */
+ protected static final String JSON = "application/json; charset=UTF-8";
+
+ private static final int timeout = 2000;
+
+ /**
+ * Constructor.
+ */
+ public WorkflowTest() throws RuntimeException {}
+
+ /**
+ * The current request ID. Normally set when an "invoke" method is called.
+ */
+ protected volatile String msoRequestId = null;
+
+ /**
+ * The current service instance ID. Normally set when an "invoke" method is called.
+ */
+ protected volatile String msoServiceInstanceId = null;
+
+ /**
+ * Logs a test start method.
+ */
+ protected void logStart() {
+ logger.debug("STARTED TEST");
+ }
+
+ /**
+ * Logs a test end method.
+ */
+ protected void logEnd() {
+ logger.debug("ENDED TEST");
+ }
+
+ /**
+ * Invokes a subprocess.
+ *
+ * @param processKey the process key
+ * @param businessKey a unique key that will identify the process instance
+ * @param injectedVariables variables to inject into the process
+ */
+ protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.debug("JVM args = {}", arguments);
+
+ msoRequestId = (String) injectedVariables.get("mso-request-id");
+ String requestId = (String) injectedVariables.get("msoRequestId");
+
+ if (msoRequestId == null && requestId == null) {
+ String msg = "mso-request-id variable was not provided";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ // Note: some scenarios don't have a service-instance-id, may be null
+ msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
+
+
+ runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
+ }
+
+ protected String invokeSubProcess(String processKey, Map<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.debug("JVM args = {}", arguments);
+
+ msoRequestId = (String) injectedVariables.get("mso-request-id");
+ String requestId = (String) injectedVariables.get("msoRequestId");
+
+ if (msoRequestId == null && requestId == null) {
+ String msg = "mso-request-id variable was not provided";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ // Note: some scenarios don't have a service-instance-id, may be null
+ msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
+
+
+ ProcessInstance processInstance =
+ runtimeService.startProcessInstanceByKey(processKey, msoRequestId, injectedVariables);
+ return processInstance.getId();
+ }
+
+ /**
+ * Invokes an asynchronous process. Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @return a TestAsyncResponse object associated with the test
+ * @throws InterruptedException
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey, String schemaVersion, String businessKey,
+ String request) throws InterruptedException {
+ return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
+ }
+
+ /**
+ * Invokes an asynchronous process. Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @return a TestAsyncResponse object associated with the test
+ * @throws InterruptedException
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey, String schemaVersion, String businessKey,
+ String request, Map<String, Object> injectedVariables) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.debug("JVM args = {}", arguments);
+
+ Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, false);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ logger.debug("Sending {} to {} process", request, processKey);
+
+ TestAsyncResponse asyncResponse = new TestAsyncResponse();
+
+ asyncResponse.setResponse(workflowResource.startProcessInstanceByKey(processKey, variableMapImpl));
+
+ return asyncResponse;
+ }
+
+ /**
+ * Invokes an asynchronous process. Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @param serviceInstantiationModel indicates whether this method is being invoked for a flow that is designed using
+ * the service instantiation model
+ * @return a TestAsyncResponse object associated with the test
+ * @throws InterruptedException
+ */
+ protected Response invokeAsyncProcess(String processKey, String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ logger.debug("JVM args = {}", arguments);
+
+ Map<String, Object> variables =
+ createVariables(schemaVersion, businessKey, request, injectedVariables, serviceInstantiationModel);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ logger.debug("Sending {} to {} process", request, processKey);
+
+ return workflowResource.startProcessInstanceByKey(processKey, variableMapImpl);
+
+ }
+
+ /**
+ * Private helper method that creates a variable map for a request. Errors are handled with junit assertions and
+ * will cause the test to fail.
+ *
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @param serviceInstantiationModel indicates whether this method is being invoked for a flow that is designed using
+ * the service instantiation model
+ * @return a variable map
+ */
+ private Map<String, Object> createVariables(String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
+
+ Map<String, Object> variables = new HashMap<>();
+
+ // These variables may be overridded by injected variables.
+ variables.put("mso-service-request-timeout", "180");
+ variables.put("isDebugLogEnabled", "true");
+
+ // These variables may not be overridded by injected variables.
+ String[] notAllowed = new String[] {"mso-schema-version", "mso-business-key", "bpmnRequest", "mso-request-id",
+ "mso-service-instance-id"};
+
+ if (injectedVariables != null) {
+ for (String key : injectedVariables.keySet()) {
+ for (String var : notAllowed) {
+ if (var.equals(key)) {
+ String msg = "Cannot specify " + var + " in injected variables";
+ logger.debug(msg);
+ fail(msg);
+ }
+ }
+
+ variables.put(key, injectedVariables.get(key));
+ }
+ }
+
+ variables.put("mso-schema-version", schemaVersion);
+ variables.put("mso-business-key", businessKey);
+ variables.put("bpmnRequest", request);
+
+ if (serviceInstantiationModel) {
+
+ /*
+ * The request ID and the service instance ID are generated for flows that follow the service instantiation
+ * model unless "requestId" and "serviceInstanceId" are injected variables.
+ */
+
+ try {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ variables.put("mso-request-id", msoRequestId);
+ msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ } catch (Exception e) {
+ }
+ if (msoRequestId == null || msoRequestId.trim().equals("")) {
+ logger.debug("No requestId element in injectedVariables");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+ if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
+ logger.debug("No seviceInstanceId element in injectedVariables");
+ variables.put("mso-service-instance-id", UUID.randomUUID().toString());
+ }
+
+ } else {
+ msoRequestId = getXMLTextElement(request, "request-id");
+
+ if (msoRequestId == null) {
+ // check in injected variables
+ try {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ } catch (Exception e) {
+ }
+ if (msoRequestId == null || msoRequestId.trim().equals("")) {
+ String msg = "No request-id element in " + request;
+ logger.debug(msg);
+ fail(msg);
+ }
+ }
+
+ variables.put("mso-request-id", msoRequestId);
+
+ // Note: some request types don't have a service-instance-id
+ msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
+
+ if (msoServiceInstanceId != null) {
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
+ }
+
+ return variables;
+ }
+
+ /**
+ * Private helper method that creates a camunda VariableMapImpl from a simple variable map.
+ *
+ * @param variables the simple variable map
+ * @return a VariableMap
+ */
+ private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
+ Map<String, Object> wrappedVariables = new HashMap<>();
+
+ for (String key : variables.keySet()) {
+ Object value = variables.get(key);
+ wrappedVariables.put(key, wrapVariableValue(value));
+ }
+
+ VariableMapImpl variableMapImpl = new VariableMapImpl();
+ variableMapImpl.put("variables", wrappedVariables);
+ return variableMapImpl;
+ }
+
+ /**
+ * Private helper method that wraps a variable value for inclusion in a camunda VariableMapImpl.
+ *
+ * @param value the variable value
+ * @return the wrapped variable
+ */
+ private Map<String, Object> wrapVariableValue(Object value) {
+ HashMap<String, Object> valueMap = new HashMap<>();
+ valueMap.put("value", value);
+ return valueMap;
+ }
+
+ /**
+ * Receives a response from an asynchronous process. Errors are handled with junit assertions and will cause the
+ * test to fail.
+ *
+ * @param businessKey the process business key
+ * @param asyncResponse the TestAsyncResponse object associated with the test
+ * @param timeout the timeout in milliseconds
+ * @return the WorkflowResponse
+ */
+ protected WorkflowResponse receiveResponse(String businessKey, TestAsyncResponse asyncResponse, long timeout) {
+ logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ Response response = asyncResponse.getResponse();
+
+ if (response != null) {
+ logger.debug("Received a response from process with business key {}", businessKey);
+
+ Object entity = response.getEntity();
+
+ if (!(entity instanceof WorkflowResponse)) {
+ String msg = "Response entity is " + (entity == null ? "null" : entity.getClass().getName())
+ + ", expected WorkflowResponse";
+ logger.debug(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ return (WorkflowResponse) entity;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for a response from process with business key " + businessKey;
+ logger.debug(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "No response received from process with business key " + businessKey + " within " + timeout + "ms";
+ logger.debug(msg);
+ fail("Process with business key " + businessKey + " did not end within 10000ms");
+ return null; // unreachable
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment. A program is essentially just a list of
+ * keys that identify callback data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else if ("ERR".equals(modifier)) {
+ content =
+ "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
+ contentType = JSON;
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ if (contentType == null) {
+ // Default for backward compatibility with existing tests.
+ contentType = JSON;
+ }
+
+ if (!injectSDNCRestCallback(contentType, content, 10000)) {
+ fail("Failed to inject SDNC '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of SDNC '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject SDNC events into the test environment. A program is essentially just a list of keys that
+ * identify event data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * event1, event2
+ * </pre>
+ *
+ * NOTE: Each callback must have a message type associated with it, e.g. "SDNCAEvent". Errors are handled with junit
+ * assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCEvents(CallbackSet callbacks, String program) {
+ injectWorkflowMessages(callbacks, program);
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment. A program is essentially just a list of
+ * keys that identify callback data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail. Uses the static/default timeout value
+ * for backward compatibility.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
+ injectSDNCCallbacks(callbacks, program, timeout);
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment. A program is essentially just a list of
+ * keys that identify callback data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ * @param timeout a timeout value to wait for the callback
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ int respCode = 200;
+ String respMsg = "OK";
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 200;
+ respMsg = "OK";
+ } else if ("CREATED".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 201;
+ respMsg = "Created";
+ } else if ("ERR".equals(modifier)) {
+ content =
+ "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
+ respCode = 500;
+ respMsg = "SERVER ERROR";
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
+ fail("Failed to inject SDNC '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of SDNC '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject VNF adapter REST callback data into the test environment. A program is essentially just
+ * a list of keys that identify callback data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * create, rollback
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' VNF REST request";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else if ("ERR".equals(modifier)) {
+ content = "SIMULATED ERROR FROM VNF ADAPTER";
+ contentType = "text/plain";
+ } else {
+ String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ if (contentType == null) {
+ // Default for backward compatibility with existing tests.
+ contentType = XML;
+ }
+
+ if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
+ fail("Failed to inject VNF REST '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of VNF REST '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject VNF callback data into the test environment. A program is essentially just a list of
+ * keys that identify callback data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * createVnf, deleteVnf
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail.
+ *
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' VNF request";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ } else if ("ERR".equals(modifier)) {
+ String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ } else {
+ String msg = "Invalid VNF program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ boolean injected = false;
+
+ if (content.contains("createVnfNotification")) {
+ injected = injectCreateVNFCallback(content, 10000);
+ } else if (content.contains("deleteVnfNotification")) {
+ injected = injectDeleteVNFCallback(content, 10000);
+ } else if (content.contains("updateVnfNotification")) {
+ injected = injectUpdateVNFCallback(content, 10000);
+ }
+
+ if (!injected) {
+ String msg = "Failed to inject VNF '" + action + "' callback";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of VNF '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Waits for the number of running processes with the specified process definition key to equal a particular count.
+ *
+ * @param processKey the process definition key
+ * @param count the desired count
+ * @param timeout the timeout in milliseconds
+ */
+ protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
+ logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+ int last = -1;
+
+ while (now <= endTime) {
+ int actual = runtimeService.createProcessInstanceQuery().processDefinitionKey(processKey).list().size();
+
+ if (actual != last) {
+ logger.debug("There are now {} {} instances", actual, processKey);
+ last = actual;
+ }
+
+ if (actual == count) {
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for there to be " + count + " " + processKey + " instances";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Timed out waiting for there to be " + count + " " + processKey + " instances";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Waits for the specified process variable to be set.
+ *
+ * @param processKey the process definition key
+ * @param variable the variable name
+ * @param timeout the timeout in milliseconds
+ * @return the variable value, or null if it cannot be obtained in the specified time
+ */
+ protected Object getProcessVariable(String processKey, String variable, long timeout) {
+
+ logger.debug("Waiting " + timeout + "ms for " + processKey + "." + variable + " to be set");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ ProcessInstance processInstance = null;
+ Object value = null;
+
+ while (value == null) {
+ if (now > endTime) {
+ if (processInstance == null) {
+ logger.debug("Timed out waiting for " + processKey + " to start");
+ } else {
+ logger.debug("Timed out waiting for " + processKey + "[" + processInstance.getId() + "]." + variable
+ + " to be set");
+ }
+
+ return null;
+ }
+
+ ProcessInstanceQuery processInstanceQuery = null;
+ if (processInstance == null) {
+ processInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionKey(processKey);
+ }
+
+ if (processInstanceQuery.count() == 1 || processInstanceQuery.count() == 0) {
+ processInstance = processInstanceQuery.singleResult();
+ } else {
+ // TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why
+ // happening and best way to get correct one from list
+ logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list",
+ processInstanceQuery.count());
+ List<ProcessInstance> processList = processInstanceQuery.list();
+ processInstance = processList.get((processList.size() - 1));
+ }
+
+
+ if (processInstance != null) {
+ value = runtimeService.getVariable(processInstance.getId(), variable);
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable);
+ return null;
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ logger.debug(processKey + "[" + processInstance.getId() + "]." + variable + "=" + value);
+
+ return value;
+ }
+
+ /**
+ * Injects a single SDNC adapter callback request. The specified callback data may contain the placeholder string
+ * ((REQUEST-ID)) which is replaced with the actual SDNC request ID. Note: this is not the requestId in the original
+ * MSO request.
+ *
+ * @param contentType the HTTP content type for the callback
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
+ String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", "SDNCAResponse_CORRELATOR", timeout);
+
+ if (sdncRequestId == null) {
+ sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV2", "SDNCAResponse_CORRELATOR", timeout);
+ }
+
+ if (sdncRequestId == null) {
+ return false;
+ }
+
+ content = content.replace("((REQUEST-ID))", sdncRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+ logger.debug("Injecting SDNC adapter callback");
+
+ Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
+ logger.debug("Workflow response to SDNC adapter callback: " + response);
+ return true;
+ }
+
+ /**
+ * Injects a single SDNC adapter callback request. The specified callback data may contain the placeholder string
+ * ((REQUEST-ID)) which is replaced with the actual SDNC request ID. Note: this is not the requestId in the original
+ * MSO request.
+ *
+ * @param content the content of the callback
+ * @param respCode the response code (normally 200)
+ * @param respMsg the response message (normally "OK")
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectSDNCCallback(int respCode, String respMsg, String content, long timeout) {
+
+ String sdncRequestId = (String) getProcessVariable("sdncAdapter", "SDNCA_requestId", timeout);
+
+ if (sdncRequestId == null) {
+ return false;
+ }
+
+ content = content.replace("((REQUEST-ID))", sdncRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+ // TODO this needs to be fixed. It is causing double tags and content
+ // Need to parse content before setting below since content includes not just RequestData or modify callback
+ // files to only contain RequestData contents.
+
+ logger.debug("Injecting SDNC adapter callback");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(sdncRequestId);
+ callbackHeader.setResponseCode(String.valueOf(respCode));
+ callbackHeader.setResponseMessage(respMsg);
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(content);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ logger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
+
+ return true;
+ }
+
+ /**
+ * Injects a single VNF adapter callback request. The specified callback data may contain the placeholder string
+ * ((MESSAGE-ID)) which is replaced with the actual message ID. Note: this is not the requestId in the original MSO
+ * request.
+ *
+ * @param contentType the HTTP content type for the callback
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
+ String messageId = (String) getProcessVariable("vnfAdapterRestV1", "VNFAResponse_CORRELATOR", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ logger.debug("Injecting VNF adapter callback");
+
+ Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
+ logger.debug("Workflow response to VNF adapter callback: {}", response);
+ return true;
+ }
+
+ /**
+ * Injects a Create VNF adapter callback request. The specified callback data may contain the placeholder string
+ * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ *
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectCreateVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterCreateV1", "VNFC_messageId", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ if (content.contains("((REQUEST-ID))")) {
+ content = content.replace("((REQUEST-ID))", msoRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", msoRequestId);
+ }
+
+ logger.debug("Injecting VNF adapter callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ CreateVnfNotification createVnfNotification = new CreateVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate("/tns:createVnfNotification/tns:completed/text()");
+ createVnfNotification.setCompleted("true".equals(completed));
+
+ String vnfId = xpathTool.evaluate("/tns:createVnfNotification/tns:vnfId/text()");
+ createVnfNotification.setVnfId(vnfId);
+
+ NodeList entries = (NodeList) xpathTool.evaluate("/tns:createVnfNotification/tns:outputs/tns:entry",
+ XPathConstants.NODESET);
+
+ CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
+
+ for (int i = 0; i < entries.getLength(); i++) {
+ Node node = entries.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+ String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+ outputs.add(key, value);
+ }
+ }
+
+ createVnfNotification.setOutputs(outputs);
+
+ VnfRollback rollback = new VnfRollback();
+
+ String cloudSiteId = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+ rollback.setCloudSiteId(cloudSiteId);
+
+ String cloudOwner = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
+ String requestId =
+ xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+ String serviceInstanceId = xpathTool
+ .evaluate("/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+ if (requestId != null || serviceInstanceId != null) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestId);
+ msoRequest.setServiceInstanceId(serviceInstanceId);
+ rollback.setMsoRequest(msoRequest);
+ }
+
+ String tenantCreated =
+ xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
+ rollback.setTenantCreated("true".equals(tenantCreated));
+
+ String tenantId = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
+ rollback.setTenantId(tenantId);
+
+ String vnfCreated = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
+ rollback.setVnfCreated("true".equals(vnfCreated));
+
+ String rollbackVnfId = xpathTool.evaluate("/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
+ rollback.setVnfId(rollbackVnfId);
+
+ createVnfNotification.setRollback(rollback);
+
+ } catch (Exception e) {
+ logger.debug("Failed to unmarshal VNF callback content:");
+ logger.debug(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+ notifyService.createVnfNotification(messageId, createVnfNotification.isCompleted(),
+ createVnfNotification.getException(), createVnfNotification.getErrorMessage(),
+ createVnfNotification.getVnfId(), createVnfNotification.getOutputs(),
+ createVnfNotification.getRollback());
+
+ return true;
}
- /**
- * A test implementation of AsynchronousResponse.
- */
- public class TestAsyncResponse {
- Response response = null;
-
- /**
- * {@inheritDoc}
- */
- public synchronized void setResponse(Response response) {
- this.response = response;
- }
-
- /**
- * Gets the response.
- * @return the response, or null if none has been produced yet
- */
- public synchronized Response getResponse() {
- return response;
- }
- }
-
- /**
- * An object that contains callback data for a "program".
- */
- public class CallbackSet {
- private final Map<String, CallbackData> map = new HashMap<>();
-
- /**
- * Add untyped callback data to the set.
- * @param action the action with which the data is associated
- * @param content the callback data
- */
- public void put(String action, String content) {
- map.put(action, new CallbackData(null, null, content));
- }
-
- /**
- * Add callback data to the set.
- * @param action the action with which the data is associated
- * @param messageType the callback message type
- * @param content the callback data
- */
- public void put(String action, String messageType, String content) {
- map.put(action, new CallbackData(null, messageType, content));
- }
-
- /**
- * Add callback data to the set.
- * @param action the action with which the data is associated
- * @param contentType the callback HTTP content type
- * @param messageType the callback message type
- * @param content the callback data
- */
- public void put(String action, String contentType, String messageType, String content) {
- map.put(action, new CallbackData(contentType, messageType, content));
- }
-
- /**
- * Retrieve callback data from the set.
- * @param action the action with which the data is associated
- * @return the callback data, or null if there is none for the specified operation
- */
- public CallbackData get(String action) {
- return map.get(action);
- }
- }
-
- /**
- * Represents a callback data item.
- */
- public class CallbackData {
- private final String contentType;
- private final String messageType;
- private final String content;
-
- /**
- * Constructor
- * @param contentType the HTTP content type (optional)
- * @param messageType the callback message type (optional)
- * @param content the content
- */
- public CallbackData(String contentType, String messageType, String content) {
- this.contentType = contentType;
- this.messageType = messageType;
- this.content = content;
- }
-
- /**
- * Gets the callback HTTP content type, possibly null.
- */
- public String getContentType() {
- return contentType;
- }
-
- /**
- * Gets the callback message type, possibly null.
- */
- public String getMessageType() {
- return messageType;
- }
-
- /**
- * Gets the callback content.
- */
- public String getContent() {
- return content;
- }
- }
-
- /**
- * A tool for evaluating XPath expressions.
- */
- protected class XPathTool {
- private final DocumentBuilderFactory factory;
- private final SimpleNamespaceContext context = new SimpleNamespaceContext();
- private final XPath xpath = XPathFactory.newInstance().newXPath();
- private String xml = null;
- private Document doc = null;
-
- /**
- * Constructor.
- */
- public XPathTool() {
- factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- xpath.setNamespaceContext(context);
- }
-
- /**
- * Adds a namespace.
- * @param prefix the namespace prefix
- * @param uri the namespace uri
- */
- public synchronized void addNamespace(String prefix, String uri) {
- context.add(prefix, uri);
- }
-
- /**
- * Sets the XML content to be operated on.
- * @param xml the XML content
- */
- public synchronized void setXML(String xml) {
- this.xml = xml;
- this.doc = null;
- }
-
- /**
- * Returns the document object.
- * @return the document object, or null if XML has not been set
- * @throws SAXException
- * @throws IOException
- * @throws ParserConfigurationException
- */
- public synchronized Document getDocument()
- throws ParserConfigurationException, IOException, SAXException {
- if (xml == null) {
- return null;
- }
-
- buildDocument();
- return doc;
- }
-
- /**
- * Evaluates the specified XPath expression and returns a string result.
- * This method throws exceptions on error.
- * @param expression the expression
- * @return the result object
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws XPathExpressionException on error
- */
- public synchronized String evaluate(String expression)
- throws ParserConfigurationException, SAXException,
- IOException, XPathExpressionException {
- return (String) evaluate(expression, XPathConstants.STRING);
- }
-
- /**
- * Evaluates the specified XPath expression.
- * This method throws exceptions on error.
- * @param expression the expression
- * @param returnType the return type
- * @return the result object
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws XPathExpressionException on error
- */
- public synchronized Object evaluate(String expression, QName returnType)
- throws ParserConfigurationException, SAXException,
- IOException, XPathExpressionException {
-
- buildDocument();
- XPathExpression expr = xpath.compile(expression);
- return expr.evaluate(doc, returnType);
- }
-
- /**
- * Private helper method that builds the document object.
- * Assumes the calling method is synchronized.
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- */
- private void buildDocument() throws ParserConfigurationException,
- IOException, SAXException {
- if (doc == null) {
- if (xml == null) {
- throw new IOException("XML input is null");
- }
-
- DocumentBuilder builder = factory.newDocumentBuilder();
- InputSource source = new InputSource(new StringReader(xml));
- doc = builder.parse(source);
- }
- }
- }
-
- /**
- * A NamespaceContext class based on a Map.
- */
- private class SimpleNamespaceContext implements NamespaceContext {
- private Map<String, String> prefixMap = new HashMap<>();
- private Map<String, String> uriMap = new HashMap<>();
-
- public synchronized void add(String prefix, String uri) {
- prefixMap.put(prefix, uri);
- uriMap.put(uri, prefix);
- }
-
- @Override
- public synchronized String getNamespaceURI(String prefix) {
- return prefixMap.get(prefix);
- }
-
- @Override
- public Iterator<String> getPrefixes(String uri) {
- List<String> list = new ArrayList<>();
- String prefix = uriMap.get(uri);
- if (prefix != null) {
- list.add(prefix);
- }
- return list.iterator();
- }
-
- @Override
- public String getPrefix(String uri) {
- return uriMap.get(uri);
- }
- }
-
- /**
- * A VnfNotify XPathTool.
- */
- protected class VnfNotifyXPathTool extends XPathTool {
- public VnfNotifyXPathTool() {
- addNamespace("tns", "http://org.onap.so/vnfNotify");
- }
- }
-
- /**
- * Helper class to make it easier to create this type.
- */
- private static class CreateVnfNotificationOutputs
- extends CreateVnfNotification.Outputs {
- public void add(String key, String value) {
- Entry entry = new Entry();
- entry.setKey(key);
- entry.setValue(value);
- getEntry().add(entry);
- }
- }
-
- /**
- * Helper class to make it easier to create this type.
- */
- private static class UpdateVnfNotificationOutputs
- extends UpdateVnfNotification.Outputs {
- public void add(String key, String value) {
- Entry entry = new Entry();
- entry.setKey(key);
- entry.setValue(value);
- getEntry().add(entry);
- }
- }
+ /**
+ * Injects a Delete VNF adapter callback request. The specified callback data may contain the placeholder string
+ * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ *
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectDeleteVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterDeleteV1", "VNFDEL_uuid", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ logger.debug("Injecting VNF adapter delete callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate("/tns:deleteVnfNotification/tns:completed/text()");
+ deleteVnfNotification.setCompleted("true".equals(completed));
+ // if notification failure, set the exception and error message
+ if (deleteVnfNotification.isCompleted() == false) {
+ deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
+ deleteVnfNotification
+ .setErrorMessage(xpathTool.evaluate("/tns:deleteVnfNotification/tns:errorMessage/text()"));
+ }
+
+ } catch (Exception e) {
+ logger.debug("Failed to unmarshal VNF Delete callback content:");
+ logger.debug(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+ notifyService.deleteVnfNotification(messageId, deleteVnfNotification.isCompleted(),
+ deleteVnfNotification.getException(), deleteVnfNotification.getErrorMessage());
+
+ return true;
+ }
+
+ /**
+ * Injects a Update VNF adapter callback request. The specified callback data may contain the placeholder string
+ * ((MESSAGE-ID)) which is replaced with the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ *
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectUpdateVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterUpdate", "VNFU_messageId", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ content = content.replace("((REQUEST-ID))", msoRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", msoRequestId);
+
+ logger.debug("Injecting VNF adapter callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate("/tns:updateVnfNotification/tns:completed/text()");
+ updateVnfNotification.setCompleted("true".equals(completed));
+
+ NodeList entries = (NodeList) xpathTool.evaluate("/tns:updateVnfNotification/tns:outputs/tns:entry",
+ XPathConstants.NODESET);
+
+ UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
+
+ for (int i = 0; i < entries.getLength(); i++) {
+ Node node = entries.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+ String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+ outputs.add(key, value);
+ }
+ }
+
+ updateVnfNotification.setOutputs(outputs);
+
+ VnfRollback rollback = new VnfRollback();
+
+ String cloudSiteId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+ rollback.setCloudSiteId(cloudSiteId);
+
+ String cloudOwner = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
+ String requestId =
+ xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+ String serviceInstanceId = xpathTool
+ .evaluate("/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+ if (requestId != null || serviceInstanceId != null) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestId);
+ msoRequest.setServiceInstanceId(serviceInstanceId);
+ rollback.setMsoRequest(msoRequest);
+ }
+
+ String tenantCreated =
+ xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
+ rollback.setTenantCreated("true".equals(tenantCreated));
+
+ String tenantId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
+ rollback.setTenantId(tenantId);
+
+ String vnfCreated = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
+ rollback.setVnfCreated("true".equals(vnfCreated));
+
+ String rollbackVnfId = xpathTool.evaluate("/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
+ rollback.setVnfId(rollbackVnfId);
+
+ updateVnfNotification.setRollback(rollback);
+
+ } catch (Exception e) {
+ logger.debug("Failed to unmarshal VNF callback content:");
+ logger.debug(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+ notifyService.updateVnfNotification(messageId, updateVnfNotification.isCompleted(),
+ updateVnfNotification.getException(), updateVnfNotification.getErrorMessage(),
+ updateVnfNotification.getOutputs(), updateVnfNotification.getRollback());
+
+ return true;
+ }
+
+ /**
+ * Runs a program to inject workflow messages into the test environment. A program is essentially just a list of
+ * keys that identify event data to be injected, in sequence. An example program:
+ *
+ * <pre>
+ * event1, event2
+ * </pre>
+ *
+ * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a
+ * workflow message type associated with it.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String messageType = null;
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No '" + action + "' workflow message callback is defined";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ messageType = callbackData.getMessageType();
+
+ if (messageType == null || messageType.trim().equals("")) {
+ String msg = "No workflow message type is defined in the '" + action + "' callback";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
+ fail("Failed to inject '" + action + "' workflow message");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of '" + action + "' workflow message");
+ }
+ }
+ }
+
+ /**
+ * Injects a workflow message. The specified callback data may contain the placeholder string ((CORRELATOR)) which
+ * is replaced with the actual correlator value.
+ *
+ * @param contentType the HTTP contentType for the message (possibly null)
+ * @param messageType the message type
+ * @param content the message content (possibly null)
+ * @param timeout the timeout in milliseconds
+ * @return true if the message could be injected, false otherwise
+ */
+ protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
+ String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout);
+
+ if (correlator == null) {
+ return false;
+ }
+
+ if (content != null) {
+ content = content.replace("((CORRELATOR))", correlator);
+ }
+
+ logger.debug("Injecting " + messageType + " message");
+
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ logger.debug("Workflow response to {} message: {}", messageType, response);
+ return true;
+ }
+
+ /**
+ * Runs a program to inject sniro workflow messages into the test environment. A program is essentially just a list
+ * of keys that identify event data to be injected, in sequence. For more details, see injectSNIROCallbacks(String
+ * contentType, String messageType, String content, long timeout)
+ *
+ * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a
+ * workflow message type associated with it.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String messageType = null;
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No '" + action + "' workflow message callback is defined";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ messageType = callbackData.getMessageType();
+
+ if (messageType == null || messageType.trim().equals("")) {
+ String msg = "No workflow message type is defined in the '" + action + "' callback";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
+ fail("Failed to inject '" + action + "' workflow message");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of '" + action + "' workflow message");
+ }
+ }
+ }
+
+ /**
+ * Injects a sniro workflow message. The specified callback response may contain the placeholder strings
+ * ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) The ((CORRELATOR)) is replaced with the actual correlator value from
+ * the request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId value from the sniro
+ * request. Currently this only works with sniro request that contain only 1 resource.
+ *
+ * @param contentType the HTTP contentType for the message (possibly null)
+ * @param messageType the message type
+ * @param content the message content (possibly null)
+ * @param timeout the timeout in milliseconds
+ * @return true if the message could be injected, false otherwise
+ */
+ protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
+ String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout);
+
+ if (correlator == null) {
+ return false;
+ }
+ if (content != null) {
+ content = content.replace("((CORRELATOR))", correlator);
+ if (messageType.equalsIgnoreCase("SNIROResponse")) {
+ ServiceDecomposition decomp =
+ (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
+ List<Resource> resourceList = decomp.getServiceResources();
+ if (resourceList.size() == 1) {
+ String resourceId = "";
+ for (Resource resource : resourceList) {
+ resourceId = resource.getResourceId();
+ }
+ String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+ JSONArray placementArr = null;
+ try {
+ placementArr = new JSONArray(homingList);
+ } catch (Exception e) {
+ return false;
+ }
+ if (placementArr.length() == 1) {
+ content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ }
+ String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+ JSONArray licenseArr = null;
+ try {
+ licenseArr = new JSONArray(licenseInfoList);
+ } catch (Exception e) {
+ return false;
+ }
+ if (licenseArr.length() == 1) {
+ content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ }
+ } else {
+ try {
+ String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+ String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+ JSONArray placementArr = new JSONArray(homingList);
+ JSONArray licenseArr = new JSONArray(licenseInfoList);
+ for (Resource resource : resourceList) {
+ String resourceModuleName = resource.getModelInfo().getModelInstanceName();
+ String resourceId = resource.getResourceId();
+
+ for (int i = 0; i < placementArr.length(); i++) {
+ JSONObject placementObj = placementArr.getJSONObject(i);
+ String placementModuleName = placementObj.getString("resourceModuleName");
+ if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
+ String placementString = placementObj.toString();
+ placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ JSONObject newPlacementObj = new JSONObject(placementString);
+ placementArr.put(i, newPlacementObj);
+ }
+ }
+
+ for (int i = 0; i < licenseArr.length(); i++) {
+ JSONObject licenseObj = licenseArr.getJSONObject(i);
+ String licenseModuleName = licenseObj.getString("resourceModuleName");
+ if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
+ String licenseString = licenseObj.toString();
+ licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ JSONObject newLicenseObj = new JSONObject(licenseString);
+ licenseArr.put(i, newLicenseObj);
+ }
+ }
+ }
+ String newPlacementInfos = placementArr.toString();
+ String newLicenseInfos = licenseArr.toString();
+ content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
+ content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
+ } catch (Exception e) {
+ return false;
+ }
+
+ }
+ }
+ }
+ logger.debug("Injecting " + messageType + " message");
+
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ logger.debug("Workflow response to {} message: {}", messageType, response);
+ return true;
+ }
+
+
+ /**
+ * Wait for the process to end.
+ *
+ * @param businessKey the process business key
+ * @param timeout the amount of time to wait, in milliseconds
+ */
+ protected void waitForProcessEnd(String businessKey, long timeout) {
+ logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey)) {
+ logger.debug("Process with business key {} has ended", businessKey);
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " + businessKey + " to end";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Wait for the process to end. Must be used when multiple process instances exist with this same business key such
+ * as when its passed to subflows or shared across multiple processes.
+ *
+ * @param businessKey the process business key
+ * @param processName the process definition name
+ * @param timeout the amount of time to wait, in milliseconds
+ * @author cb645j
+ */
+ protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
+ logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey);
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey, processName)) {
+ logger.debug("Process with business key {} has ended", businessKey);
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " + businessKey + " to end";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms";
+ logger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Verifies that the specified historic process variable has the specified value. If the variable does not have the
+ * specified value, the test is failed.
+ *
+ * @param businessKey the process business key
+ * @param variable the variable name
+ * @param value the expected variable value
+ */
+ protected void checkVariable(String businessKey, String variable, Object value) {
+ if (!isProcessEnded(businessKey)) {
+ fail("Cannot get historic variable " + variable + " because process with business key " + businessKey
+ + " has not ended");
+ }
+
+ Object variableValue = getVariableFromHistory(businessKey, variable);
+ assertEquals(value, variableValue);
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @param businessKey the process business Key
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEnded(String businessKey) {
+ HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+ .processInstanceBusinessKey(businessKey).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @param processInstanceId the process Instance Id
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
+ HistoricProcessInstance processInstance =
+ historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ *
+ * @author cb645j
+ */
+ // TODO combine into 1
+ private boolean isProcessEnded(String businessKey, String processName) {
+ HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+ .processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Gets a variable value from a historical process instance. The business key must be unique.
+ *
+ * @param businessKey the process business key
+ * @param variableName the variable name
+ * @return the variable value or null if the variable does not exist
+ */
+ protected Object getVariableFromHistory(String businessKey, String variableName) {
+ try {
+ HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+ .processInstanceBusinessKey(businessKey).singleResult();
+
+ if (processInstance == null) {
+ return null;
+ }
+
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName,
+ businessKey, e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets a variable value from a process instance based on businessKey and process name. Must be used when multiple
+ * instances exist with the same business key such as when business key is passed to subflows or shared across
+ * multiple processes. This method can obtain variables from mainflows and from subflows.
+ *
+ * @param businessKey the process business key
+ * @param processName the process definition name
+ * @param variableName the variable name
+ * @return the variable value or null if the variable does not exist
+ * @author cb645j
+ */
+ protected Object getVariableFromHistory(String businessKey, String processName, String variableName) {
+ try {
+ HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
+ .processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
+
+ if (processInstance == null) {
+ return null;
+ }
+ HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+
+ return variable == null ? null : variable.getValue();
+ } catch (ProcessEngineException e) {
+ logger.debug(
+ "Multiple proccess instances exist with process name {} and business key {}. Must pass instance "
+ + "index as a parameter.",
+ processName, businessKey);
+ return null;
+ } catch (Exception e) {
+ logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
+ variableName, processName, businessKey, e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets the value of a process variable from x instance of y process. Must be used when multiple instances exist
+ * with the same business key AND process name. This method shall be used primarily for obtaining subflow variables
+ * when the business key is passed to the subflow AND the subflow is called multiple times in a given flow.
+ *
+ * @param businessKey the process business key
+ * @param processName the name of the subflow that contains the variable
+ * @param variableName the variable name
+ * @param processInstanceIndex the instance in which the subprocess was called
+ * @return the variable value or null if the variable does not exist
+ * @author cb645j
+ */
+ protected Object getVariableFromHistory(String businessKey, int subflowInstanceIndex, String processName,
+ String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery()
+ .processInstanceBusinessKey(businessKey).processDefinitionName(processName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+ HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+
+ return variable == null ? null : variable.getValue();
+ } catch (Exception e) {
+ logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ",
+ variableName, processName, businessKey, e);
+ return null;
+ }
+ }
+
+
+ /**
+ * Gets the value of a subflow variable from the specified subflow's historical process instance.
+ *
+ * DEPRECATED - Use method getVariableFromHistory(businessKey, processName, variableName) instead
+ *
+ * @param subflowName - the name of the subflow that contains the variable
+ * @param variableName the variable name
+ *
+ * @return the variable value, or null if the variable could not be obtained
+ *
+ */
+ @Deprecated
+ protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList =
+ historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(0);
+
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName,
+ e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets the value of a subflow variable from the subflow's historical process x instance.
+ *
+ * DEPRECATED: Use method getVariableFromHistory(businessKey, processInstanceIndex, processName, variableName)
+ * instead
+ *
+ * @param subflowName - the name of the subflow that contains the variable
+ * @param variableName the variable name
+ * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from
+ * mainflow)
+ *
+ * @return the variable value, or null if the variable could not be obtained
+ */
+ @Deprecated
+ protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList =
+ historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ",
+ variableName, subflowInstanceIndex, subflowName, e);
+ return null;
+ }
+ }
+
+ /**
+ * Extracts text from an XML element. This method is not namespace aware (namespaces are ignored). The first
+ * matching element is selected.
+ *
+ * @param xml the XML document or fragment
+ * @param tag the desired element, e.g. "<name>"
+ * @return the element text, or null if the element was not found
+ */
+ protected String getXMLTextElement(String xml, String tag) {
+ xml = removeXMLNamespaces(xml);
+
+ if (!tag.startsWith("<")) {
+ tag = "<" + tag + ">";
+ }
+
+ int start = xml.indexOf(tag);
+
+ if (start == -1) {
+ return null;
+ }
+
+ int end = xml.indexOf('<', start + tag.length());
+
+ if (end == -1) {
+ return null;
+ }
+
+ return xml.substring(start + tag.length(), end);
+ }
+
+ /**
+ * Removes namespace definitions and prefixes from XML, if any.
+ */
+ private String removeXMLNamespaces(String xml) {
+ // remove xmlns declaration
+ xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
+
+ // remove opening tag prefix
+ xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
+
+ // remove closing tags prefix
+ xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
+
+ // remove extra spaces left when xmlns declarations are removed
+ xml = xml.replaceAll("\\s+>", ">");
+
+ return xml;
+ }
+
+ /**
+ * Asserts that two XML documents are semantically equivalent. Differences in whitespace or in namespace usage do
+ * not affect the comparison.
+ *
+ * @param expected the expected XML
+ * @param actual the XML to test
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static void assertXMLEquals(String expected, String actual) throws SAXException, IOException {
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreAttributeOrder(true);
+ DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
+ List<?> allDifferences = diff.getAllDifferences();
+ assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+ }
+
+ /**
+ * A test implementation of AsynchronousResponse.
+ */
+ public class TestAsyncResponse {
+ Response response = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void setResponse(Response response) {
+ this.response = response;
+ }
+
+ /**
+ * Gets the response.
+ *
+ * @return the response, or null if none has been produced yet
+ */
+ public synchronized Response getResponse() {
+ return response;
+ }
+ }
+
+ /**
+ * An object that contains callback data for a "program".
+ */
+ public class CallbackSet {
+ private final Map<String, CallbackData> map = new HashMap<>();
+
+ /**
+ * Add untyped callback data to the set.
+ *
+ * @param action the action with which the data is associated
+ * @param content the callback data
+ */
+ public void put(String action, String content) {
+ map.put(action, new CallbackData(null, null, content));
+ }
+
+ /**
+ * Add callback data to the set.
+ *
+ * @param action the action with which the data is associated
+ * @param messageType the callback message type
+ * @param content the callback data
+ */
+ public void put(String action, String messageType, String content) {
+ map.put(action, new CallbackData(null, messageType, content));
+ }
+
+ /**
+ * Add callback data to the set.
+ *
+ * @param action the action with which the data is associated
+ * @param contentType the callback HTTP content type
+ * @param messageType the callback message type
+ * @param content the callback data
+ */
+ public void put(String action, String contentType, String messageType, String content) {
+ map.put(action, new CallbackData(contentType, messageType, content));
+ }
+
+ /**
+ * Retrieve callback data from the set.
+ *
+ * @param action the action with which the data is associated
+ * @return the callback data, or null if there is none for the specified operation
+ */
+ public CallbackData get(String action) {
+ return map.get(action);
+ }
+ }
+
+ /**
+ * Represents a callback data item.
+ */
+ public class CallbackData {
+ private final String contentType;
+ private final String messageType;
+ private final String content;
+
+ /**
+ * Constructor
+ *
+ * @param contentType the HTTP content type (optional)
+ * @param messageType the callback message type (optional)
+ * @param content the content
+ */
+ public CallbackData(String contentType, String messageType, String content) {
+ this.contentType = contentType;
+ this.messageType = messageType;
+ this.content = content;
+ }
+
+ /**
+ * Gets the callback HTTP content type, possibly null.
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Gets the callback message type, possibly null.
+ */
+ public String getMessageType() {
+ return messageType;
+ }
+
+ /**
+ * Gets the callback content.
+ */
+ public String getContent() {
+ return content;
+ }
+ }
+
+ /**
+ * A tool for evaluating XPath expressions.
+ */
+ protected class XPathTool {
+ private final DocumentBuilderFactory factory;
+ private final SimpleNamespaceContext context = new SimpleNamespaceContext();
+ private final XPath xpath = XPathFactory.newInstance().newXPath();
+ private String xml = null;
+ private Document doc = null;
+
+ /**
+ * Constructor.
+ */
+ public XPathTool() {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ xpath.setNamespaceContext(context);
+ }
+
+ /**
+ * Adds a namespace.
+ *
+ * @param prefix the namespace prefix
+ * @param uri the namespace uri
+ */
+ public synchronized void addNamespace(String prefix, String uri) {
+ context.add(prefix, uri);
+ }
+
+ /**
+ * Sets the XML content to be operated on.
+ *
+ * @param xml the XML content
+ */
+ public synchronized void setXML(String xml) {
+ this.xml = xml;
+ this.doc = null;
+ }
+
+ /**
+ * Returns the document object.
+ *
+ * @return the document object, or null if XML has not been set
+ * @throws SAXException
+ * @throws IOException
+ * @throws ParserConfigurationException
+ */
+ public synchronized Document getDocument() throws ParserConfigurationException, IOException, SAXException {
+ if (xml == null) {
+ return null;
+ }
+
+ buildDocument();
+ return doc;
+ }
+
+ /**
+ * Evaluates the specified XPath expression and returns a string result. This method throws exceptions on error.
+ *
+ * @param expression the expression
+ * @return the result object
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException on error
+ */
+ public synchronized String evaluate(String expression)
+ throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
+ return (String) evaluate(expression, XPathConstants.STRING);
+ }
+
+ /**
+ * Evaluates the specified XPath expression. This method throws exceptions on error.
+ *
+ * @param expression the expression
+ * @param returnType the return type
+ * @return the result object
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException on error
+ */
+ public synchronized Object evaluate(String expression, QName returnType)
+ throws ParserConfigurationException, SAXException, IOException, XPathExpressionException {
+
+ buildDocument();
+ XPathExpression expr = xpath.compile(expression);
+ return expr.evaluate(doc, returnType);
+ }
+
+ /**
+ * Private helper method that builds the document object. Assumes the calling method is synchronized.
+ *
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ */
+ private void buildDocument() throws ParserConfigurationException, IOException, SAXException {
+ if (doc == null) {
+ if (xml == null) {
+ throw new IOException("XML input is null");
+ }
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ InputSource source = new InputSource(new StringReader(xml));
+ doc = builder.parse(source);
+ }
+ }
+ }
+
+ /**
+ * A NamespaceContext class based on a Map.
+ */
+ private class SimpleNamespaceContext implements NamespaceContext {
+ private Map<String, String> prefixMap = new HashMap<>();
+ private Map<String, String> uriMap = new HashMap<>();
+
+ public synchronized void add(String prefix, String uri) {
+ prefixMap.put(prefix, uri);
+ uriMap.put(uri, prefix);
+ }
+
+ @Override
+ public synchronized String getNamespaceURI(String prefix) {
+ return prefixMap.get(prefix);
+ }
+
+ @Override
+ public Iterator<String> getPrefixes(String uri) {
+ List<String> list = new ArrayList<>();
+ String prefix = uriMap.get(uri);
+ if (prefix != null) {
+ list.add(prefix);
+ }
+ return list.iterator();
+ }
+
+ @Override
+ public String getPrefix(String uri) {
+ return uriMap.get(uri);
+ }
+ }
+
+ /**
+ * A VnfNotify XPathTool.
+ */
+ protected class VnfNotifyXPathTool extends XPathTool {
+ public VnfNotifyXPathTool() {
+ addNamespace("tns", "http://org.onap.so/vnfNotify");
+ }
+ }
+
+ /**
+ * Helper class to make it easier to create this type.
+ */
+ private static class CreateVnfNotificationOutputs extends CreateVnfNotification.Outputs {
+ public void add(String key, String value) {
+ Entry entry = new Entry();
+ entry.setKey(key);
+ entry.setValue(value);
+ getEntry().add(entry);
+ }
+ }
+
+ /**
+ * Helper class to make it easier to create this type.
+ */
+ private static class UpdateVnfNotificationOutputs extends UpdateVnfNotification.Outputs {
+ public void add(String key, String value) {
+ Entry entry = new Entry();
+ entry.setKey(key);
+ entry.setValue(value);
+ getEntry().add(entry);
+ }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
index dbad35a6a4..794e772dcd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
@@ -26,16 +26,15 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Allows a subclass of WorkflowTest to specify one or more WireMock
- * response transformers. A transformer must be declared as a public
- * static field in the subclass. For example:
+ * Allows a subclass of WorkflowTest to specify one or more WireMock response transformers. A transformer must be
+ * declared as a public static field in the subclass. For example:
+ *
* <pre>
- * @WorkflowTestTransformer
- * public static final ResponseTransformer sdncAdapterMockTransformer =
- * new SDNCAdapterMockTransformer();
+ * &#64;WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer = new SDNCAdapterMockTransformer();
* </pre>
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface WorkflowTestTransformer {
-} \ No newline at end of file
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
index bdc48392af..d95a5883c8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.common.adapter.sdnc;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
index 051107bb13..c58af6b02f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerServiceTest.java
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.common.workflow.service;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
index ff5e18c210..62b582ea8e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
@@ -16,20 +16,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.so.bpmn.common.workflow.service;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import javax.ws.rs.core.Response;
-
import org.camunda.bpm.engine.test.Deployment;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.junit.Test;
@@ -38,41 +35,41 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
public class WorkflowAsyncResourceExceptionHandlingTest {
- @Test
- @Deployment(resources = { "testAsyncResource.bpmn" })
- public void asyncRequestSuccess() throws InterruptedException {
- VariableMapImpl variableMap = new VariableMapImpl();
+ @Test
+ @Deployment(resources = {"testAsyncResource.bpmn"})
+ public void asyncRequestSuccess() throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
- Map<String, Object> variableValueType = new HashMap<>();
+ Map<String, Object> variableValueType = new HashMap<>();
- Map<String, Object> requestMsg = new HashMap<>();
- requestMsg.put("value", "");
- requestMsg.put("type", "String");
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", "");
+ requestMsg.put("type", "String");
- Map<String, Object> msorequestId = new HashMap<>();
- msorequestId.put("type", "String");
- msorequestId.put("value",UUID.randomUUID().toString());
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value", UUID.randomUUID().toString());
- Map<String, Object> timeout = new HashMap<>();
- timeout.put("type", "String");
- timeout.put("value","5");
+ Map<String, Object> timeout = new HashMap<>();
+ timeout.put("type", "String");
+ timeout.put("value", "5");
- variableValueType.put("testAsyncRequestMsg", requestMsg);
- variableValueType.put("mso-request-id", msorequestId);
- variableValueType.put("mso-service-request-timeout", timeout);
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
- variableMap.put("variables", variableValueType);
- WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
- workflowAsyncResource.setProcessor(new WorkflowProcessor());
- Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
- assertEquals(500,res.getStatus());
- WorkflowResponse workflowResponse = (WorkflowResponse)res.getEntity();
- assertNotNull(workflowResponse);
- assertEquals(500, workflowResponse.getMessageCode());
- assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
- assertEquals("Fail", workflowResponse.getMessage());
+ variableMap.put("variables", variableValueType);
+ WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
+ workflowAsyncResource.setProcessor(new WorkflowProcessor());
+ Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
+ assertEquals(500, res.getStatus());
+ WorkflowResponse workflowResponse = (WorkflowResponse) res.getEntity();
+ assertNotNull(workflowResponse);
+ assertEquals(500, workflowResponse.getMessageCode());
+ assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
+ assertEquals("Fail", workflowResponse.getMessage());
- }
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
index 5b5e17c5fc..1c3583d452 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
@@ -21,5 +21,5 @@
package org.onap.so.bpmn.infrastructure;
public interface FlakyTests {
- /* category marker */
+ /* category marker */
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 5cc0281407..3734510eed 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -25,10 +25,8 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-
import java.util.HashMap;
import java.util.Map;
-
import java.util.UUID;
import org.assertj.core.api.Assertions;
import org.assertj.core.data.MapEntry;
@@ -64,25 +62,17 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
// when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ ProcessInstance instance =
+ runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
dmaapClientTestImpl.sendMessage();
// then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckInputs",
- "CheckAiiForPnfCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "AaiEntryExists",
- "InformDmaapClient",
- "WaitForDmaapPnfReadyNotification",
- "CreateRelationId",
- "AaiEntryUpdated"
- );
- Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
- containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
+ assertThat(instance).isEnded().hasPassedInOrder("CreateAndActivatePnf_StartEvent", "CheckInputs",
+ "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "AaiEntryExists", "InformDmaapClient",
+ "WaitForDmaapPnfReadyNotification", "CreateRelationId", "AaiEntryUpdated");
+ Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
+ .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
}
@Test
@@ -90,26 +80,17 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
// when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ ProcessInstance instance =
+ runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
dmaapClientTestImpl.sendMessage();
// then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckInputs",
- "CheckAiiForPnfCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "CreatePnfEntryInAai",
- "AaiEntryExists",
- "InformDmaapClient",
- "WaitForDmaapPnfReadyNotification",
- "CreateRelationId",
- "AaiEntryUpdated"
- );
+ assertThat(instance).isEnded().hasPassedInOrder("CreateAndActivatePnf_StartEvent", "CheckInputs",
+ "CheckAiiForPnfCorrelationId", "DoesAaiContainInfoAboutPnf", "CreatePnfEntryInAai", "AaiEntryExists",
+ "InformDmaapClient", "WaitForDmaapPnfReadyNotification", "CreateRelationId", "AaiEntryUpdated");
Assertions.assertThat(pnfManagementTest.getCreated()).containsOnlyKeys(PnfManagementTestImpl.ID_WITHOUT_ENTRY);
- Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
- containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
+ Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
+ .containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 6a5f9fac74..e7ff69ab3b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import java.util.Objects;
-
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
index 8c31a021ae..65b1962048 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -22,26 +17,25 @@ package org.onap.so.bpmn.vcpe;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.infrastructure.FlakyTests;
-
import groovy.lang.Category;
@Category(FlakyTests.class)
public class AbstractTestBase extends BaseIntegrationTest {
-
-
- public static final String CUST = "SDN-ETHERNET-INTERNET";
- public static final String SVC = "123456789";
- public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
- public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
- public static final String ARID = "arId-1";
- public static final String ARVERS = "1490627351232";
-
- public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
- public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
-
- public static final String VAR_SUCCESS_IND = "SuccessIndicator";
- public static final String VAR_WFEX = "SavedWorkflowException1";
- public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
- public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
+
+
+ public static final String CUST = "SDN-ETHERNET-INTERNET";
+ public static final String SVC = "123456789";
+ public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
+ public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
+ public static final String ARID = "arId-1";
+ public static final String ARVERS = "1490627351232";
+
+ public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
+ public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
+
+ public static final String VAR_SUCCESS_IND = "SuccessIndicator";
+ public static final String VAR_WFEX = "SavedWorkflowException1";
+ public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
+ public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
index aa65474acc..bdc24875f0 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -50,12 +45,10 @@ import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
@@ -65,58 +58,68 @@ import org.onap.so.bpmn.mock.StubResponseOof;
public class CreateVcpeResCustServiceIT extends AbstractTestBase {
- private static final String PROCNAME = "CreateVcpeResCustService";
- private static final String Prefix = "CVRCS_";
-
- private final CallbackSet callbacks = new CallbackSet();
- private final String request;
-
- @Before
- public void init(){
- BPMNUtil.cleanHistory(processEngine);
- }
-
- public CreateVcpeResCustServiceIT() throws IOException {
-
- callbacks.put("oof", JSON, "oofResponse", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json"));
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
- callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-
- callbacks.put("query", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
-
- request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
- }
-
- @Test
- public void testCreateVcpeResCustService_Success() throws Exception {
- System.out.println("starting: testCreateVcpeResCustService_Success\n");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
- StubResponseOof.mockOof(wireMockServer);
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ private static final String PROCNAME = "CreateVcpeResCustService";
+ private static final String Prefix = "CVRCS_";
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String request;
+
+ @Before
+ public void init() {
+ BPMNUtil.cleanHistory(processEngine);
+ }
+
+ public CreateVcpeResCustServiceIT() throws IOException {
+
+ callbacks.put("oof", JSON, "oofResponse",
+ FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json"));
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("queryTXC",
+ FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
+ callbacks.put("queryBRG",
+ FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
+ callbacks.put("deactivate",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+ callbacks.put("query", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("queryVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+ callbacks.put("queryModuleNoVnf",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+ callbacks.put("queryModule",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+
+ request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_Success() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_Success\n");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+ StubResponseOof.mockOof(wireMockServer);
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
MockGetGenericVnfByIdWithDepth(wireMockServer, ".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml");
- MockPutGenericVnf(wireMockServer, ".*");
+ MockPutGenericVnf(wireMockServer, ".*");
MockPatchGenericVnf(wireMockServer, ".*");
MockGetGenericVnfByIdWithPriority(wireMockServer, ".*", ".*", 200, "VfModularity/VfModule-new.xml", 5);
@@ -124,46 +127,52 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase {
MockPutVfModuleIdNoResponse(wireMockServer, ".*", "PCRF", ".*");
MockPutNetwork(wireMockServer, ".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockGetNetworkPolicyfqdn(wireMockServer, ".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200);
- MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*");
-
- mockVNFPost(wireMockServer, "", 202, ".*");
+ MockGetNetworkPolicyfqdn(wireMockServer, ".*",
+ "CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200);
+ MockNodeQueryServiceInstanceByName_404(wireMockServer, ".*");
+
+ mockVNFPost(wireMockServer, "", 202, ".*");
+
+ wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules"))
+ .willReturn(aResponse().withStatus(202)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB(wireMockServer);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(wireMockServer, 200);
- wireMockServer.stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202)));
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
- MockPostRequestDB(wireMockServer);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(wireMockServer, 200);
-
- Map<String, Object> variables = setupVariables();
+ Map<String, Object> variables = setupVariables();
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
injectWorkflowMessages(callbacks, "oof");
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
- // for TXC
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryTXC");
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+ // for TXC
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryTXC");
// For VNF
injectSDNCCallbacks(callbacks, "assign");
injectSDNCCallbacks(callbacks, "assign");
injectSDNCCallbacks(callbacks, "queryModule");
injectSDNCCallbacks(callbacks, "activate");
- //VF Module
+ // VF Module
injectSDNCCallbacks(callbacks, "queryModule");
injectSDNCCallbacks(callbacks, "assign");
injectSDNCCallbacks(callbacks, "queryModule");
injectSDNCCallbacks(callbacks, "queryModule");
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
injectVNFRestCallbacks(callbacks, "vnfCreate");
injectSDNCCallbacks(callbacks, "activate");
@@ -173,208 +182,233 @@ public class CreateVcpeResCustServiceIT extends AbstractTestBase {
injectSDNCCallbacks(callbacks, "activate");
injectSDNCCallbacks(callbacks, "queryBRG");
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, workflowException);
- assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
- assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
- assertTrue(completionReq.indexOf("source>VID<") >= 0);
-
- assertEquals("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
- }
-
- @Test
- public void testCreateVcpeResCustService_NoParts() throws Exception {
- System.out.println("starting: testCreateVcpeResCustService_NoParts\n" );
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
-
- // TODO: should these really be PARENT_INST, or should they be INST?
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+ assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+ assertTrue(completionReq.indexOf("source>VID<") >= 0);
+
+ assertEquals("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "VnfsCreatedCount"));
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_NoParts() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_NoParts\n");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+
+ // TODO: should these really be PARENT_INST, or should they be INST?
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
StubResponseOof.mockOof(wireMockServer);
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
MockPostRequestDB(wireMockServer);
mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = setupVariables();
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ injectWorkflowMessages(callbacks, "oof");
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+ assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+ assertTrue(completionReq.indexOf("source>VID<") >= 0);
+
+ assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "VnfsCreatedCount"));
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(wireMockServer, 404);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ StubResponseOof.mockOof(wireMockServer);
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB(wireMockServer);
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
injectWorkflowMessages(callbacks, "oof");
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, workflowException);
- assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
- assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
- assertTrue(completionReq.indexOf("source>VID<") >= 0);
-
- assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
- }
-
- @Test
- public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
- System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance_500(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
-
- mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ waitForProcessEnd(businessKey, 100000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceBRGRollback");
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateVnfAndModulesRollback");
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceTXCRollback");
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef",
+ "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"),
+ "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID,
+ "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS);
+
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
StubResponseOof.mockOof(wireMockServer);
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ wireMockServer.stubFor(put(urlMatching(
+ ".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship"))
+ .willReturn(aResponse().withStatus(200)));
wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
MockPostRequestDB(wireMockServer);
-
- Map<String, Object> variables = setupVariables();
+ String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
+
+ Map<String, Object> variables = setupVariables();
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
injectWorkflowMessages(callbacks, "oof");
-
- waitForProcessEnd(businessKey, 100000);
-
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertNotNull(workflowException);
-
- BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceBRGRollback");
- BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateVnfAndModulesRollback");
- BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceTXCRollback");
- }
-
- @Test
- public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
- System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetServiceResourcesCatalogData(wireMockServer, "uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
- MockGetCustomer(wireMockServer, CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
-
- // TODO: the SI should NOT have to be URL-encoded yet again!
- MockPutServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID, ARVERS);
-
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- StubResponseOof.mockOof(wireMockServer);
- wireMockServer.stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
- wireMockServer.stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
- MockPostRequestDB(wireMockServer);
- String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
-
- Map<String, Object> variables = setupVariables();
-
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
-
- injectWorkflowMessages(callbacks, "oof");
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- // for TXC
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
-
- waitForProcessEnd(businessKey, 10000);
-
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
-
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
-
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertEquals(null, completionReq);
- assertNotNull(workflowException);
-
- BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoCreateServiceInstanceRollback");
- }
-
- // *****************
- // Utility Section
- // *****************
-
- // Success Scenario
- private Map<String, Object> setupVariables() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("requestId", "testRequestId");
- variables.put("request-id", "testRequestId");
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("allottedResourceId", ARID);
- variables.put("URN_mso_workflow_aai_distribution_delay", "PT5S");
- return variables;
-
- }
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ // for TXC
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, completionReq);
+ assertNotNull(workflowException);
+
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoCreateServiceInstanceRollback");
+ }
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ // Success Scenario
+ private Map<String, Object> setupVariables() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("requestId", "testRequestId");
+ variables.put("request-id", "testRequestId");
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("allottedResourceId", ARID);
+ variables.put("URN_mso_workflow_aai_distribution_delay", "PT5S");
+ return variables;
+
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
index aaabf59e6b..4a03aa9fd4 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -37,255 +32,244 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById;
import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
import org.onap.so.bpmn.mock.FileUtil;
-
import com.github.tomakehurst.wiremock.stubbing.Scenario;
public class DeleteVcpeResCustServiceIT extends AbstractTestBase {
- private static final String PROCNAME = "DeleteVcpeResCustService";
- private static final String Prefix = "DVRCS_";
- private static final String AR_BRG_ID = "ar-brgB";
- private static final String AR_TXC_ID = "ar-txcA";
-
- private final CallbackSet callbacks = new CallbackSet();
- private final String request;
-
- public DeleteVcpeResCustServiceIT() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
-
- request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
- }
-
- @Before
- public void init(){
- BPMNUtil.cleanHistory(processEngine);
- }
-
- @Test
- public void testDeleteVcpeResCustService_Success() throws Exception {
- logStart();
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
-
- // TODO: use INST instead of DEC_INST
- /*
- * Seems to be a bug as they
- * fail to URL-encode the SI id before performing the query so we'll
- * add a stub for that case, too.
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- /*
- * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return
- * different responses as we traverse through the flow
- */
-
- // initially, the SI includes the ARs
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
- .inScenario("SI retrieval")
- .whenScenarioStateIs(Scenario.STARTED)
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
- .willSetStateTo("ARs Deleted"));
-
- // once the ARs have been deleted, the SI should be empty
- wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
- .inScenario("SI retrieval")
- .whenScenarioStateIs("ARs Deleted")
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
-
- // for BRG
- MockQueryAllottedResourceById(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS);
-
- // for TXC
- MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS);
-
- //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ private static final String PROCNAME = "DeleteVcpeResCustService";
+ private static final String Prefix = "DVRCS_";
+ private static final String AR_BRG_ID = "ar-brgB";
+ private static final String AR_TXC_ID = "ar-txcA";
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String request;
+
+ public DeleteVcpeResCustServiceIT() throws IOException {
+ callbacks.put("deactivate",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+ request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
+ }
+
+ @Before
+ public void init() {
+ BPMNUtil.cleanHistory(processEngine);
+ }
+
+ @Test
+ public void testDeleteVcpeResCustService_Success() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+
+ // TODO: use INST instead of DEC_INST
+ /*
+ * Seems to be a bug as they fail to URL-encode the SI id before performing the query so we'll add a stub for
+ * that case, too.
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ /*
+ * cannot use MockGetServiceInstance(wireMockServer, ), because we need to return different responses as we
+ * traverse through the flow
+ */
+
+ // initially, the SI includes the ARs
+ wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST
+ + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+ .inScenario("SI retrieval").whenScenarioStateIs(Scenario.STARTED)
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
+ .willSetStateTo("ARs Deleted"));
+
+ // once the ARs have been deleted, the SI should be empty
+ wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST
+ + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+ .inScenario("SI retrieval").whenScenarioStateIs("ARs Deleted")
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
+
+ // for BRG
+ MockQueryAllottedResourceById(wireMockServer, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID,
+ "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_BRG_ID, ARVERS);
+
+ // for TXC
+ MockQueryAllottedResourceById(wireMockServer, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID,
+ "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, AR_TXC_ID, ARVERS);
+
+ // MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
wireMockServer.stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
.withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
- wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
- .willReturn(aResponse()
- .withStatus(204)
- .withHeader("Content-Type", "text/xml")));
+ wireMockServer.stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .willReturn(aResponse().withStatus(204).withHeader("Content-Type", "text/xml")));
- MockDeleteServiceInstance(wireMockServer, CUST,SVC,INST,SVC);
+ MockDeleteServiceInstance(wireMockServer, CUST, SVC, INST, SVC);
mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariables(businessKey);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
- // for BRG
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
+ // for BRG
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for VNF1
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
+ // for VNF1
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for VNF2
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
+ // for VNF2
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for TXC
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
+ // for TXC
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
- // for SI
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 70000);
- assertTrue(isProcessEnded(businessKey));
+ waitForProcessEnd(businessKey, 70000);
+ assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertNull(workflowException);
- assertTrue(completionReq.contains("<request-id>"+businessKey+"<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNull(workflowException);
+ assertTrue(completionReq.contains("<request-id>" + businessKey + "<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
- assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+ assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "vnfsDeletedCount"));
- BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
- logEnd();
- }
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
+ logEnd();
+ }
- @Test
- public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
- logStart();
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ @Test
+ public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- // TODO: use INST instead of DEC_INST
- /*
- * Seems to be a bug as they
- * fail to URL-encode the SI id before performing the query so we'll
- * add a stub for that case, too.
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ // TODO: use INST instead of DEC_INST
+ /*
+ * Seems to be a bug as they fail to URL-encode the SI id before performing the query so we'll add a stub for
+ * that case, too.
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariables(businessKey);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
- // for SI
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 70000);
+ waitForProcessEnd(businessKey, 70000);
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertNull( workflowException);
- assertTrue(completionReq.contains("<request-id>"+businessKey+"<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNull(workflowException);
+ assertTrue(completionReq.contains("<request-id>" + businessKey + "<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
- assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+ assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + "vnfsDeletedCount"));
- BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
- logEnd();
- }
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
+ logEnd();
+ }
- @Test
- public void testDeleteVcpeResCustService_Fault() throws Exception {
- logStart();
- MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
+ @Test
+ public void testDeleteVcpeResCustService_Fault() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(wireMockServer, INST, "GenericFlows/getSIUrlById.xml");
- // TODO: use INST instead of DEC_INST
- /*
- * Seems to be a bug as they
- * fail to URL-encode the SI id before performing the query so we'll
- * add a stub for that case, too.
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ // TODO: use INST instead of DEC_INST
+ /*
+ * Seems to be a bug as they fail to URL-encode the SI id before performing the query so we'll add a stub for
+ * that case, too.
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
- // generate failure
- mockSDNCAdapter(wireMockServer, 404);
+ // generate failure
+ mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariables(businessKey);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
- waitForProcessEnd(businessKey, 70000);
+ waitForProcessEnd(businessKey, 70000);
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
- String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
- System.out.println("completionReq:\n" + completionReq);
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix + VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
- assertNotNull(workflowException);
- logEnd();
- }
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME + VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+ logEnd();
+ }
- private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("requestId", requestId);
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("sdncVersion", "1802");
- variables.put("serviceInstanceName", "some-junk-name");
- return variables;
- }
+ private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("requestId", requestId);
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("sdncVersion", "1802");
+ variables.put("serviceInstanceName", "some-junk-name");
+ return variables;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
index da9b45c8c8..291613bc1a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -29,10 +24,8 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
import org.onap.so.bpmn.mock.FileUtil;
@@ -40,227 +33,223 @@ import org.onap.so.bpmn.mock.FileUtil;
public class DoCreateAllottedResourceBRGIT extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceBRG";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceBRGIT() {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
- }
-
- @Test
- public void testDoCreateAllottedResourceBRG_Success() throws InterruptedException {
- logStart();
-
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables,"testRequestId123");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "query");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNull(workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables,"testRequestId124");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNotNull(workflowException);
-
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables,"testRequestId125");
-
- variables.put("failExists", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
-
-
- injectSDNCCallbacks(callbacks, "query");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNull( workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables,"testRequestId126");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNotNull(workflowException);
-
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables,"testRequestId127");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNotNull(workflowException);
-
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failExists", "true");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("sourceNetworkId", "snId");
- variables.put("sourceNetworkRole", "snRole");
- variables.put("allottedResourceRole", "txc");
- variables.put("allottedResourceType", "BRG");
- variables.put("allottedResourceId", ARID);
- variables.put("vni", "BRG");
- variables.put("vgmuxBearerIP", "bearerip");
- variables.put("brgWanMacAddress", "wanmac");
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- variables.put("serviceChainServiceInstanceId", "scsiId");
-
- String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("allottedResourceModelInfo", arModelInfo);
- }
+ private static final String PROCNAME = "DoCreateAllottedResourceBRG";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceBRGIT() {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query",
+ FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_Success() throws InterruptedException {
+ logStart();
+
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNull(workflowException);
+
+ assertEquals("namefromrequest",
+ BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_NoSI() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId124");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNotNull(workflowException);
+
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId125");
+
+ variables.put("failExists", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+
+
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNull(workflowException);
+
+ assertEquals("namefromrequest",
+ BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId126");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNotNull(workflowException);
+
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 404);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId127");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNotNull(workflowException);
+
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failExists", "true");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("sourceNetworkId", "snId");
+ variables.put("sourceNetworkRole", "snRole");
+ variables.put("allottedResourceRole", "txc");
+ variables.put("allottedResourceType", "BRG");
+ variables.put("allottedResourceId", ARID);
+ variables.put("vni", "BRG");
+ variables.put("vgmuxBearerIP", "bearerip");
+ variables.put("brgWanMacAddress", "wanmac");
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ variables.put("serviceChainServiceInstanceId", "scsiId");
+
+ String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\","
+ + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\","
+ + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + "\"modelName\": \"vSAMP12\","
+ + "\"modelVersion\": \"1.0\"," + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + "}";
+ variables.put("allottedResourceModelInfo", arModelInfo);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
index f0d275c5cc..cd7004e3aa 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -24,12 +19,10 @@ import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
import org.onap.so.bpmn.core.RollbackData;
import org.onap.so.bpmn.mock.FileUtil;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -43,281 +36,295 @@ import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
- private static final String RbType = "DCARBRG_";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceBRGRollbackIT() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
+ private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
+ private static final String RbType = "DCARBRG_";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceBRGRollbackIT() throws IOException {
+ callbacks.put("deactivate",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackAAI", "false");
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ // this will cause "rollbackSDNC" to be set to false
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ /*
+ * Note: if assign == false then the flow/script will set "skipRollback" to false, which will cause ALL of the
+ * SDNC steps to be skipped, not just the unassign step.
+ */
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, businessKey);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackAAI", "false");
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- // this will cause "rollbackSDNC" to be set to false
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackSDNCactivate", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackSDNCcreate", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- /*
- * Note: if assign == false then the flow/script will set
- * "skipRollback" to false, which will cause ALL of the SDNC steps
- * to be skipped, not just the unassign step.
- */
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, businessKey);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, businessKey);
-
- variables.put("rollbackData", "string instead of rollback data");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
- rollbackData.put(RbType, "serviceSubscriptionType", SVC);
- rollbackData.put(RbType, "disablerollback", "false");
- rollbackData.put(RbType, "rollbackAAI", "true");
- rollbackData.put(RbType, "rollbackSDNCassign", "true");
- rollbackData.put(RbType, "rollbackSDNCactivate", "true");
- rollbackData.put(RbType, "rollbackSDNCcreate", "true");
- rollbackData.put(RbType, "aaiARPath", "business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
-
- rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
-
- variables.put("rollbackData",rollbackData);
-
- return rollbackData;
- }
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ variables.put("rollbackData", "string instead of rollback data");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+ rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+ rollbackData.put(RbType, "disablerollback", "false");
+ rollbackData.put(RbType, "rollbackAAI", "true");
+ rollbackData.put(RbType, "rollbackSDNCassign", "true");
+ rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+ rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+ rollbackData.put(RbType, "aaiARPath",
+ "business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC
+ + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/"
+ + ARID);
+
+ rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil
+ .readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil
+ .readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil
+ .readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
+
+ variables.put("rollbackData", rollbackData);
+
+ return rollbackData;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
index 6ecec3240d..80c3fa16e8 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -31,12 +26,10 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Ignore;
@@ -46,231 +39,227 @@ import org.onap.so.bpmn.mock.FileUtil;
public class DoCreateAllottedResourceTXCIT extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceTXC";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceTXCIT() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
- }
-
- @Test
- public void testDoCreateAllottedResourceTXC_Success() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "query");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
-
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertEquals(null, workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId));
- assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId));
- assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- variables.put("failExists", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "query");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- assertEquals(null, workflowException);
-
- assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId));
- assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId));
- assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
-
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{
- logStart();
- // TODO: use INST instead of DEC_INST
- /*
- * should be INST instead of DEC_INST, but AAI utilities appear to
- * have a bug in that they don't URL-encode the SI id before using
- * it in the query
- */
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
- MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
-
- MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
- MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
- MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
- mockSDNCAdapter(wireMockServer, 404);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- assertNotNull(workflowException);
-
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
- logEnd();
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
- // TODO: need all of these?
- variables.put("isDebugLogEnabled", "true");
- variables.put("failExists", "true");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("sourceNetworkId", "snId");
- variables.put("sourceNetworkRole", "snRole");
- variables.put("allottedResourceRole", "brg");
- variables.put("allottedResourceType", "TXC");
- variables.put("allottedResourceId", ARID);
- variables.put("brgWanMacAddress", "wanmac");
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- variables.put("serviceChainServiceInstanceId", "scsiId");
-
- String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("allottedResourceModelInfo", arModelInfo);
- }
+ private static final String PROCNAME = "DoCreateAllottedResourceTXC";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceTXCIT() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query",
+ FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_Success() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest",
+ BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni", processId));
+ assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP", processId));
+ assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_NoSI() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ variables.put("failExists", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest",
+ BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni", processId));
+ assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP", processId));
+ assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception {
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to have a bug in that they don't URL-encode the
+ * SI id before using it in the query
+ */
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(wireMockServer, DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(wireMockServer, CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(wireMockServer, CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(wireMockServer, 404);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName", processId));
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ // TODO: need all of these?
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failExists", "true");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("sourceNetworkId", "snId");
+ variables.put("sourceNetworkRole", "snRole");
+ variables.put("allottedResourceRole", "brg");
+ variables.put("allottedResourceType", "TXC");
+ variables.put("allottedResourceId", ARID);
+ variables.put("brgWanMacAddress", "wanmac");
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ variables.put("serviceChainServiceInstanceId", "scsiId");
+
+ String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\","
+ + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\","
+ + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + "\"modelName\": \"vSAMP12\","
+ + "\"modelVersion\": \"1.0\"," + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + "}";
+ variables.put("allottedResourceModelInfo", arModelInfo);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
index 4f81a4f725..0b64f4938e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -24,12 +19,10 @@ import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
import org.onap.so.bpmn.core.RollbackData;
import org.onap.so.bpmn.mock.FileUtil;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -43,281 +36,295 @@ import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase {
- private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
- private static final String RbType = "DCARTXC_";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateAllottedResourceTXCRollbackIT() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, businessKey);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackAAI", "false");
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- // this will cause "rollbackSDNC" to be set to false
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackSDNCactivate", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackSDNCcreate", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
-
- rollbackData.put(RbType, "rollbackSDNCassign", "false");
-
- /*
- * Note: if assign == false then the flow/script will set
- * "skipRollback" to false, which will cause ALL of the SDNC steps
- * to be skipped, not just the unassign step.
- */
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 404);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, businessKey);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- @Test
- public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
- logStart();
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, businessKey);
-
- variables.put("rollbackData", "string instead of rollback data");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- waitForWorkflowToFinish(processEngine,processId);
-
- assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
- assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
- assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
- logEnd();
- }
-
- private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
- rollbackData.put(RbType, "serviceSubscriptionType", SVC);
- rollbackData.put(RbType, "disablerollback", "false");
- rollbackData.put(RbType, "rollbackAAI", "true");
- rollbackData.put(RbType, "rollbackSDNCassign", "true");
- rollbackData.put(RbType, "rollbackSDNCactivate", "true");
- rollbackData.put(RbType, "rollbackSDNCcreate", "true");
- rollbackData.put(RbType, "aaiARPath", "/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
-
- rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml"));
- rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
-
- variables.put("rollbackData",rollbackData);
-
- return rollbackData;
- }
+ private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
+ private static final String RbType = "DCARTXC_";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceTXCRollbackIT() throws IOException {
+ callbacks.put("deactivate",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackAAI", "false");
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ // this will cause "rollbackSDNC" to be set to false
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ /*
+ * Note: if assign == false then the flow/script will set "skipRollback" to false, which will cause ALL of the
+ * SDNC steps to be skipped, not just the unassign step.
+ */
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
+ logStart();
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ variables.put("rollbackData", "string instead of rollback data");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine, processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX, processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack", processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError", processId));
+ logEnd();
+ }
+
+ private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+ rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+ rollbackData.put(RbType, "disablerollback", "false");
+ rollbackData.put(RbType, "rollbackAAI", "true");
+ rollbackData.put(RbType, "rollbackSDNCassign", "true");
+ rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+ rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+ rollbackData.put(RbType, "aaiARPath",
+ "/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC
+ + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/"
+ + ARID);
+
+ rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil
+ .readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil
+ .readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil
+ .readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
+
+ variables.put("rollbackData", rollbackData);
+
+ return rollbackData;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
index 42f32b8ecc..e4dc5add03 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -24,11 +19,9 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
import org.onap.so.bpmn.mock.FileUtil;
-
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import static org.junit.Assert.*;
import static org.onap.so.bpmn.mock.StubResponseAAI.*;
import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
@@ -37,109 +30,114 @@ import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase {
- private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteAllottedResourceBRGIT() {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- public void testDoDeleteAllottedResourceBRG_Success() {
- logStart();
- MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables);
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertNull(workflowException);
- logEnd();
- }
-
- @Test
- public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() {
- logStart();
- MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables);
-
- variables.put("failNotFound", "false");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivateNF");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
- System.out.println("workflowException:\n" + workflowException);
- assertNull(workflowException);
- logEnd();
- }
-
-
- @Test
- public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
- logStart();
- MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 500);
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
-
- BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
-
- Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(workflowException);
- logEnd();
- }
-
- private void setVariablesSuccess(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", "testRequestId1");
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
- }
+ private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteAllottedResourceBRGIT() {
+ callbacks.put("deactivate",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceBRG_Success() {
+ logStart();
+ MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNull(workflowException);
+ logEnd();
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() {
+ logStart();
+ MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ variables.put("failNotFound", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNull(workflowException);
+ logEnd();
+ }
+
+
+ @Test
+ public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 500);
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException", processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", "testRequestId1");
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
index 13ca58be03..106c2f0611 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2017 AT&T Intellectual
+ * Property. All rights reserved. ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
+ * 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=========================================================
*/
@@ -24,10 +19,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.so.bpmn.common.BPMNUtil;
import org.onap.so.bpmn.mock.FileUtil;
-
import java.util.HashMap;
import java.util.Map;
-
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.onap.so.bpmn.mock.StubResponseAAI.*;
@@ -37,104 +30,109 @@ import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase {
- private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteAllottedResourceTXCIT() {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
- logStart();
- MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
-
- Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
- System.out.println("workflowException:\n" + workflowException);
- assertNull(workflowException);
- logEnd();
- }
-
- @Test
- public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
- logStart();
- MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockSDNCAdapter(wireMockServer, 200);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables);
-
- variables.put("failNotFound", "false");
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- injectSDNCCallbacks(callbacks, "deactivateNF");
-
- BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
-
- Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
- logEnd();
- }
-
-
- @Test
- public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
- logStart();
- MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
- MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
- MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
- mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
-
- mockSDNCAdapter(wireMockServer, 500);
-
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables);
-
- String processId = invokeSubProcess(PROCNAME, variables);
-
- BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
-
- Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
- String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(workflowException);
- logEnd();
- }
-
- private void setVariablesSuccess(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failNotFound", "true");
- variables.put("msoRequestId", "testRequestId1");
- variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", ARID);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
- }
+ private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteAllottedResourceTXCIT() {
+ callbacks.put("deactivate",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF",
+ FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException", processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNull(workflowException);
+ logEnd();
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(wireMockServer, 200);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ variables.put("failNotFound", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ logEnd();
+ }
+
+
+ @Test
+ public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(wireMockServer, ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(wireMockServer, CUST, SVC, INST, ARID,
+ "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(wireMockServer, CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(wireMockServer, CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(wireMockServer, 200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(wireMockServer, 500);
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine, processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException", processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", "testRequestId1");
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+ }
}