aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java30
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml21
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java17
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java29
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java58
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java67
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn114
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json12
30 files changed, 405 insertions, 155 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 025b533dc0..750f25532c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -154,7 +156,7 @@ public class ResourceRequestBuilder {
}
}
- if (resourceInputStr != null || !resourceInputStr.equals("")) {
+ if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
return getResourceInput(resourceInputStr, serviceInputs);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
index f1534ab60f..6a4fa50020 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.servicedecomposition.homingobjects;
+import com.fasterxml.jackson.annotation.JsonValue;
+
public enum CandidateType{
@@ -35,11 +37,8 @@ public enum CandidateType{
}
@Override
+ @JsonValue
public String toString() {
return name;
}
-
- public String getName(){
- return name;
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index b210b5ed2f..ee7999f995 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -55,6 +55,7 @@ public class ExecuteBuildingBlockRainyDay {
private Environment environment;
protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier";
protected String defaultCode = "mso.rainyDay.defaultCode";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
public void setRetryTimer(DelegateExecution execution) {
try {
@@ -172,10 +173,17 @@ public class ExecuteBuildingBlockRainyDay {
msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode);
execution.setVariable(HANDLING_CODE, handlingCode);
} catch (Exception e) {
- msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort", e);
String code = this.environment.getProperty(defaultCode);
+ msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = "+ code, e);
execution.setVariable(HANDLING_CODE, code);
}
+ try{
+ int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ execution.setVariable("maxRetries", envMaxRetries);
+ } catch (Exception ex) {
+ msoLogger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ execution.setVariable("maxRetries", 5);
+ }
}
public void setHandlingStatusSuccess(DelegateExecution execution) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java
index 382852886e..17b99e2741 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisher.java
@@ -38,22 +38,21 @@ public class GlobalDmaapPublisher extends DmaapPublisher {
}
@Override
- public String getUserName() {
+ public String getAuth() {
- return UrnPropertiesReader.getVariable("mso.global.dmaap.username");
+ return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
}
@Override
- public String getPassword() {
+ public String getKey() {
- return UrnPropertiesReader.getVariable("mso.global.dmaap.password");
+ return UrnPropertiesReader.getVariable("mso.msoKey");
}
@Override
public String getTopic() {
-
return UrnPropertiesReader.getVariable("mso.global.dmaap.publisher.topic");
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
index 55f68f665e..dac038fab3 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy
@@ -97,7 +97,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{
@Test
void testCreateGenericVnf(){
when(mockExecution.getVariable("CAAIVfMod_vnfName")).thenReturn("vnfName")
- Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject())
+ Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject())
createAAIVfModule.createGenericVnf(mockExecution)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponseCode", 201)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponse","Vnf Created")
@@ -112,7 +112,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{
when(mockExecution.getVariable("CAAIVfMod_personaId")).thenReturn("model1")
when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName")
- Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject())
+ Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject())
createAAIVfModule.createVfModule(mockExecution,false)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created")
@@ -173,7 +173,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{
Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnfVfModule.json");
when(mockExecution.getVariable("CAAIVfMod_queryGenericVnfResponse")).thenReturn(genericVnf.get())
when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName")
- Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject())
+ Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject())
createAAIVfModule.createVfModule(mockExecution,true)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201)
Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created")
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy
index 4b6f8aa918..2a872511e7 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy
@@ -92,7 +92,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
void testDeleteGenericVnf() {
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
- doNothing().when(client).delete(isA(AAIResourceUri.class))
+ doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteGenericVnf(mockExecution)
Mockito.verify(mockExecution).setVariable(prefix + "deleteGenericVnfResponseCode", 200)
}
@@ -169,7 +169,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
try {
- doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class))
+ doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteGenericVnf(mockExecution)
} catch (Exception ex) {
println " Test End - Handle catch-throw BpmnError()! "
@@ -186,7 +186,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1")
- doNothing().when(client).delete(isA(AAIResourceUri.class))
+ doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteVfModule(mockExecution)
Mockito.verify(mockExecution).setVariable(prefix + "deleteVfModuleResponseCode", 200)
}
@@ -197,7 +197,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{
when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1")
when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1")
try {
- doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class))
+ doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri)
deleteAAIVfModule.deleteVfModule(mockExecution)
} catch (Exception ex) {
println " Test End - Handle catch-throw BpmnError()! "
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
index 2d2f58b415..72bcfcf359 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
@@ -111,7 +111,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
vfModule.setVfModuleId("supercool")
vfModule.setResourceVersion("12345")
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
- doNothing().when(client).update(isA(AAIResourceUri.class), anyObject())
+ doNothing().when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
updateAAIVfModule.updateVfModule(mockExecution)
verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200)
}
@@ -126,7 +126,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
vfModule.setVfModuleId("supercool")
vfModule.setResourceVersion("12345")
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
- doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class), anyObject())
+ doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404)
@@ -143,7 +143,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest {
vfModule.setVfModuleId("supercool")
vfModule.setResourceVersion("12345")
when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule)
- doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class), anyObject())
+ doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject())
thrown.expect(BpmnError.class)
updateAAIVfModule.updateVfModule(mockExecution)
verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500)
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
index e5e13268b2..ddca319708 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
@@ -405,4 +405,32 @@ public class ResourceRequestBuilderTest extends BaseTest {
assertEquals(resourceSequence.get(0), "res1");
assertEquals(resourceSequence.get(1), "res2");
}
-} \ No newline at end of file
+
+ @Test
+ public void getResourceInputWithEmptyServiceResourcesTest() throws Exception {
+
+ stubFor(get(urlEqualTo("/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok("{ \"serviceResources\" : {\n" +
+ "\t\"modelInfo\" : {\n" +
+ "\t\t\"modelName\" : \"demoVFWCL\",\n" +
+ "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n" +
+ "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n" +
+ "\t\t\"modelVersion\" : \"1.0\"\n" +
+ "\t},\n" +
+ "\t\"serviceType\" : \"\",\n" +
+ "\t\"serviceRole\" : \"\",\n" +
+ "\t\"environmentContext\" : null,\n" +
+ "\t\"workloadContext\" : \"Production\",\n" +
+ "\t\"serviceVnfs\": [], \n" +
+ "\t\"serviceNetworks\": [],\n" +
+ "\t\"serviceAllottedResources\": []\n" +
+ "\t}}")));
+
+ HashMap serviceInput = new HashMap();
+ serviceInput.put("key1", "value");
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ assertEquals(0, stringObjectMap.size());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 868aabf6a9..6344a3f1a6 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -131,6 +131,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution,true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ assertEquals(5,delegateExecution.getVariable("maxRetries"));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
index 4d7c85efdb..fc69f812be 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
@@ -35,8 +35,8 @@ public class GlobalDmaapPublisherTest extends BaseTest{
@Test
public void testGetters() {
- assertEquals("dmaapUsername", globalDmaapPublisher.getUserName());
- assertEquals("ZG1hYXBQYXNzd29yZA==", globalDmaapPublisher.getPassword());
+ assertEquals("81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54", globalDmaapPublisher.getAuth());
+ assertEquals("07a7159d3bf51a0e53be7a8f89699be7", globalDmaapPublisher.getKey());
assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get());
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index 945972c9e2..afdb800ffe 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -146,6 +146,7 @@ mso:
host: http://localhost:${wiremock.server.port}
publisher:
topic: com.att.mso.asyncStatusUpdate
+ auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
oof:
auth: test
timeout: PT10S
@@ -163,6 +164,16 @@ sdnc:
auth: Basic YWRtaW46YWRtaW4=
host: http://localhost:8446
path: /restconf/operations/GENERIC-RESOURCE-API
+sdno:
+ health-check:
+ dmaap:
+ password: alRyMzJ3NUNeakxl
+ publisher:
+ topic: com.att.sdno.test-health-diagnostic-v02
+ host: https://olsd004.wnsnet.attws.com:3905
+ subscriber:
+ topic: com.att.sdno.test-health-diagnostic-v02
+ auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
sniro:
conductor:
enabled: true
@@ -178,7 +189,15 @@ sniro:
headers.patchVersion: 1
headers.minorVersion: 1
headers.latestVersion: 2
-
+ruby:
+ create-ticket-request:
+ dmaap:
+ username: m04768@mso.ecomp.att.com
+ password: alRyMzJ3NUNeakxl
+ publisher:
+ topic: com.att.pdas.exp.msoCMFallout-v1
+ host: https://olsd004.wnsnet.attws.com:3905
+ auth: 81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
spring:
datasource:
jdbc-url: jdbc:mariadb://localhost:3307/camundabpmn
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
index 70d94052e1..4e0bf02685 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -20,12 +20,10 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.springframework.context.annotation.Primary;
@@ -39,9 +37,10 @@ public class AaiConnectionTestImpl implements AaiConnection {
public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
private Map<String, Pnf> created = new HashMap<>();
+ private Map<String, String> serviceAndPnfRelationMap = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ public Optional<Pnf> getEntryFor(String correlationId) {
if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
@@ -50,15 +49,25 @@ public class AaiConnectionTestImpl implements AaiConnection {
}
@Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
+ public void createEntry(String correlationId, Pnf entry) {
created.put(correlationId, entry);
}
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) {
+ serviceAndPnfRelationMap.put(serviceInstanceId, pnfName);
+ }
+
public Map<String, Pnf> getCreated() {
return created;
}
+ public Map<String, String> getServiceAndPnfRelationMap() {
+ return serviceAndPnfRelationMap;
+ }
+
public void reset() {
created.clear();
+ serviceAndPnfRelationMap.clear();
}
}
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 2d0d4b51a9..db6cbe06ae 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
@@ -31,15 +31,19 @@ import java.util.Map;
import java.util.UUID;
import org.assertj.core.api.Assertions;
+import org.assertj.core.data.MapEntry;
import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.springframework.beans.factory.annotation.Autowired;
public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
- private static final String TIMEOUT_10_S = "PT10S";
private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
+ private static final String SERVICE_INSTANCE_ID = "serviceForInstance";
+
+ private Map<String, Object> variables;
@Autowired
private AaiConnectionTestImpl aaiConnection;
@@ -47,14 +51,18 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@Autowired
private DmaapClientTestImpl dmaapClientTestImpl;
+ @Before
+ public void setup() {
+ aaiConnection.reset();
+ variables = new HashMap<>();
+ variables.put("serviceInstanceId", SERVICE_INSTANCE_ID);
+ variables.put(PNF_UUID, VALID_UUID);
+ }
+
@Test
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
- aaiConnection.reset();
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY);
- variables.put(PNF_UUID, VALID_UUID);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -70,19 +78,17 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
"AaiEntryExists",
"InformDmaapClient",
"WaitForDmaapPnfReadyNotification",
+ "CreateRelationId",
"AaiEntryUpdated"
);
+ Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
+ containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITH_ENTRY));
}
@Test
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
- aaiConnection.reset();
-
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
- variables.put(PNF_UUID, VALID_UUID);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -99,8 +105,11 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
"AaiEntryExists",
"InformDmaapClient",
"WaitForDmaapPnfReadyNotification",
+ "CreateRelationId",
"AaiEntryUpdated"
);
Assertions.assertThat(aaiConnection.getCreated()).containsOnlyKeys(AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
+ Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
+ containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITHOUT_ENTRY));
}
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
index 943ce12a8a..5189f8b48a 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2">
<bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true">
<bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start">
<bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing>
@@ -73,7 +73,7 @@
<bpmn:sequenceFlow id="SequenceFlow_0ndt8ft" sourceRef="Task_SetRetryTimer" targetRef="IntermediateCatchEvent_RetryTimer" />
<bpmn:sequenceFlow id="SequenceFlow_07a1ytc" sourceRef="IntermediateCatchEvent_RetryTimer" targetRef="EndEvent_1sez2lh" />
<bpmn:sequenceFlow id="SequenceFlow_1wbevp0" name="yes" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="Task_SetRetryTimer">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<5}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<execution.getVariable("maxRetries")}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="EndEvent_0mvmk3i">
<bpmn:incoming>SequenceFlow_0h8v45y</bpmn:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
index d57e48781d..1bf2a290cb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
@@ -23,7 +23,11 @@ package org.onap.so.bpmn.infrastructure.pnf.aai;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIRestClientImpl;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.springframework.stereotype.Component;
@Component
@@ -40,4 +44,12 @@ public class AaiConnectionImpl implements AaiConnection {
AAIRestClientImpl restClient = new AAIRestClientImpl();
restClient.createPnf(correlationId, entry);
}
+
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) {
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstanceId);
+ AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName);
+ new AAIResourcesClient().connect(serviceInstanceURI, pnfUri);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
new file mode 100644
index 0000000000..21d43964f8
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateRelation implements JavaDelegate {
+
+ private static final Logger logger = LoggerFactory.getLogger(CreateRelation.class);
+
+ private AaiConnection aaiConnectionImpl;
+
+ @Autowired
+ public CreateRelation(AaiConnection aaiConnectionImpl) {
+ this.aaiConnectionImpl = aaiConnectionImpl;
+ }
+
+ @Override
+ public void execute(DelegateExecution delegateExecution) {
+ String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId");
+ String pnfName = (String) delegateExecution.getVariable("correlationId");
+ try {
+ aaiConnectionImpl.createRelation(serviceInstanceId, pnfName);
+ } catch (Exception e) {
+ new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
+ "An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
+ }
+ logger.debug("The relation has been made between service with id: {} and pnf with name: {}",
+ serviceInstanceId, pnfName);
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
index 5165912653..eaabb2bfbb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
@@ -29,4 +29,6 @@ public interface AaiConnection {
Optional<Pnf> getEntryFor(String correlationId) throws IOException;
void createEntry(String correlationId, Pnf entry) throws IOException;
+
+ void createRelation(String serviceInstanceId, String pnfName) throws IOException;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
index 201e791a24..76b62a9cea 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -37,7 +37,7 @@ public class AaiConnectionTestImpl implements AaiConnection {
private Map<String, Pnf> created = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ public Optional<Pnf> getEntryFor(String correlationId) {
if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
@@ -50,6 +50,10 @@ public class AaiConnectionTestImpl implements AaiConnection {
created.put(correlationId, entry);
}
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) {
+ }
+
public Map<String, Pnf> getCreated() {
return created;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
index 7df6757817..300d1e4c9b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
@@ -36,4 +36,10 @@ public class AaiConnectionThrowingException implements AaiConnection {
public void createEntry(String correlationId, Pnf entry) throws IOException {
throw new IOException();
}
+
+ @Override
+ public void createRelation(String serviceInstanceId, String pnfName) throws IOException {
+ throw new IOException();
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
new file mode 100644
index 0000000000..2dd3e23828
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.io.IOException;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.infrastructure.pnf.aai.AaiConnectionImpl;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class CreateRelationTest {
+
+ private static final String SERVICE_INSTANCE_ID = "serviceTest";
+ private static final String PNF_NAME = "pnfNameTest";
+
+ private DelegateExecutionFake executionFake;
+
+ @Before
+ public void setUp() {
+ executionFake = new DelegateExecutionFake();
+ executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID);
+ executionFake.setVariable("correlationId", PNF_NAME);
+ }
+
+ @Test
+ public void createRelationSuccessful() throws IOException {
+ // given
+ AaiConnection aaiConnectionMock = mock(AaiConnectionImpl.class);
+ CreateRelation testedObject = new CreateRelation(aaiConnectionMock);
+ // when
+ testedObject.execute(executionFake);
+ // then
+ verify(aaiConnectionMock).createRelation(SERVICE_INSTANCE_ID, PNF_NAME);
+ }
+
+ @Test
+ public void shouldThrowBpmnErrorWhenExceptionOccurred() {
+ CreateRelation testedObject = new CreateRelation(new AaiConnectionThrowingException());
+ executionFake.setVariable("testProcessKey", "testProcessKeyValue");
+
+ assertThatThrownBy(() -> testedObject.execute(executionFake)).isInstanceOf(BpmnError.class);
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
index d8079174c1..5defe2121b 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
<bpmn:collaboration id="Collaboration_1d0w8lf">
<bpmn:participant id="Participant_1egg397" name="SO&#10;Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" />
<bpmn:participant id="Participant_0atuyq0" name="AAI" />
@@ -17,7 +17,7 @@
<bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreatePnfEntryInAai">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" />
+ <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="CreateRelationId" />
<bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" />
<bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
<bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
@@ -59,9 +59,6 @@
<bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming>
<bpmn:errorEventDefinition errorRef="Error_1" />
</bpmn:endEvent>
- <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
- <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
- </bpmn:endEvent>
<bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
<bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
@@ -77,13 +74,20 @@
<bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
</bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0o6zhjk" sourceRef="CreateRelationId" targetRef="AaiEntryUpdated" />
+ <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
+ <bpmn:incoming>SequenceFlow_0o6zhjk</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="CreateRelationId" name="Create Relation" camunda:delegateExpression="${CreateRelation}">
+ <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0o6zhjk</bpmn:outgoing>
+ </bpmn:serviceTask>
<bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
- <bpmn:text>Inputs:
+ <bpmn:text><![CDATA[Inputs:
 - timeoutForPnfEntryNotification - String
- correlationId - String
- - uuid - String
-</bpmn:text>
+ - uuid - String]]></bpmn:text>
</bpmn:textAnnotation>
</bpmn:process>
<bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -100,9 +104,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
- <dc:Bounds x="1312" y="189" width="36" height="36" />
+ <dc:Bounds x="1364" y="189" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1287" y="230" width="88" height="14" />
+ <dc:Bounds x="1339" y="230" width="89" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent">
@@ -118,38 +122,38 @@
<dc:Bounds x="511" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt">
- <di:waypoint x="319" y="207" />
- <di:waypoint x="390" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="319" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="390" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="309.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak">
- <di:waypoint x="415" y="182" />
- <di:waypoint x="415" y="66" />
- <di:waypoint x="711" y="66" />
- <di:waypoint x="711" y="182" />
+ <di:waypoint xsi:type="dc:Point" x="415" y="182" />
+ <di:waypoint xsi:type="dc:Point" x="415" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="711" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="711" y="182" />
<bpmndi:BPMNLabel>
<dc:Bounds x="430" y="159" width="19" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe">
- <di:waypoint x="440" y="207" />
- <di:waypoint x="511" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="440" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="511" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="448" y="210" width="14" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf">
- <di:waypoint x="611" y="207" />
- <di:waypoint x="686" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="611" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="686" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="605" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1">
- <di:waypoint x="-18" y="207" />
- <di:waypoint x="48" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="-18" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="48" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-30" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -158,22 +162,22 @@
<dc:Bounds x="123" y="523" width="502" height="60" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88">
- <di:waypoint x="561" y="247" />
- <di:waypoint x="561" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="531" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a">
- <di:waypoint x="250" y="247" />
- <di:waypoint x="250" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="250" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="250" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="220" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t">
- <di:waypoint x="289" y="523" />
- <di:waypoint x="289" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="247" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -191,19 +195,19 @@
<dc:Bounds x="-37" y="70" width="243" height="82" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz">
- <di:waypoint x="-36" y="189" />
- <di:waypoint x="-36" y="152" />
+ <di:waypoint xsi:type="dc:Point" x="-36" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="-36" y="152" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
- <di:waypoint x="1060" y="523" />
- <di:waypoint x="1060" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="247" />
<bpmndi:BPMNLabel>
<dc:Bounds x="996" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025">
- <di:waypoint x="736" y="207" />
- <di:waypoint x="803" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="736" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="803" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="719" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -215,9 +219,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
- <di:waypoint x="1092" y="265" />
- <di:waypoint x="1092" y="363" />
- <di:waypoint x="1145" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1092" y="265" />
+ <di:waypoint xsi:type="dc:Point" x="1092" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1145" y="363" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1028" y="309" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -226,22 +230,22 @@
<dc:Bounds x="1008" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
- <di:waypoint x="1108" y="207" />
- <di:waypoint x="1312" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1108" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1195" y="207" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1148" y="187" width="90" height="10" />
+ <dc:Bounds x="1106.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e">
- <di:waypoint x="903" y="207" />
- <di:waypoint x="1008" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="903" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1008" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="893.5" y="187" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9">
- <di:waypoint x="853" y="247" />
- <di:waypoint x="853" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="853" y="247" />
+ <di:waypoint xsi:type="dc:Point" x="853" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="823" y="380" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -250,15 +254,15 @@
<dc:Bounds x="803" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe">
- <di:waypoint x="1245" y="363" />
- <di:waypoint x="1312" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1245" y="363" />
+ <di:waypoint xsi:type="dc:Point" x="1312" y="363" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1233.5" y="343" width="90" height="10" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr">
- <di:waypoint x="1195" y="403" />
- <di:waypoint x="1195" y="523" />
+ <di:waypoint xsi:type="dc:Point" x="1195" y="403" />
+ <di:waypoint xsi:type="dc:Point" x="1195" y="523" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1165" y="458" width="90" height="10" />
</bpmndi:BPMNLabel>
@@ -267,8 +271,8 @@
<dc:Bounds x="1145" y="323" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0967g8p_di" bpmnElement="SequenceFlow_0967g8p">
- <di:waypoint x="148" y="207" />
- <di:waypoint x="219" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="148" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="219" y="207" />
<bpmndi:BPMNLabel>
<dc:Bounds x="183.5" y="187" width="0" height="10" />
</bpmndi:BPMNLabel>
@@ -282,6 +286,16 @@
<dc:Bounds x="672" y="242" width="77" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o6zhjk_di" bpmnElement="SequenceFlow_0o6zhjk">
+ <di:waypoint xsi:type="dc:Point" x="1295" y="207" />
+ <di:waypoint xsi:type="dc:Point" x="1364" y="207" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1329.5" y="186" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0xn3ug6_di" bpmnElement="CreateRelationId">
+ <dc:Bounds x="1195" y="167" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index 92b4e211d5..cb893ce950 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -403,9 +403,7 @@ public class SniroHomingV2 {
List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
for(Candidate c:required){
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
- type.setName(c.getIdentifierType().getName());
- can.setIdentifierType(type);
+ can.setIdentifierType(c.getIdentifierType());
can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
cans.add(can);
@@ -416,9 +414,7 @@ public class SniroHomingV2 {
List<org.onap.so.client.sniro.beans.Candidate> cans = new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
for(Candidate c:excluded){
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
- type.setName(c.getIdentifierType().getName());
- can.setIdentifierType(type);
+ can.setIdentifierType(c.getIdentifierType());
can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
cans.add(can);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index 18230c4d07..fec7e8456f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -35,6 +35,9 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkError;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkError;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
import org.slf4j.Logger;
@@ -115,6 +118,14 @@ public class NetworkAdapterRestV1 {
DeleteNetworkResponse deleteNetworkResponse = (DeleteNetworkResponse) unmarshalXml(callback, DeleteNetworkResponse.class);
execution.setVariable("deleteNetworkResponse", deleteNetworkResponse);
}
+ } else if (networkAdapterRequest instanceof UpdateNetworkRequest) {
+ if (callback.contains("updateNetworkError")) {
+ UpdateNetworkError updateNetworkError = (UpdateNetworkError) unmarshalXml(callback, UpdateNetworkError.class);
+ throw new Exception(updateNetworkError.getMessage());
+ } else {
+ UpdateNetworkResponse updateNetworkResponse = (UpdateNetworkResponse) unmarshalXml(callback, UpdateNetworkResponse.class);
+ execution.setVariable("updateNetworkResponse", updateNetworkResponse);
+ }
}
}
} catch (Exception e) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 78a84b1772..f6c9597de8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -41,6 +41,7 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -54,6 +55,7 @@ public class WorkflowActionBBTasks {
private static final String G_ALACARTE = "aLaCarte";
private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
+ protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@Autowired
@@ -62,6 +64,8 @@ public class WorkflowActionBBTasks {
private WorkflowAction workflowAction;
@Autowired
private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
+ private Environment environment;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
@@ -215,17 +219,24 @@ public class WorkflowActionBBTasks {
String requestId = (String) execution.getVariable(G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
+ int envMaxRetries;
+ try{
+ envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
+ } catch (Exception ex) {
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ envMaxRetries = 5;
+ }
int nextCount = retryCount +1;
if (handlingCode.equals("Retry")){
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
try{
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- request.setRetryStatusMessage("Retry " + nextCount + "/5 will be started in " + retryDuration);
+ request.setRetryStatusMessage("Retry " + nextCount + "/" + envMaxRetries + " will be started in " + retryDuration);
requestDbclient.updateInfraActiveRequests(request);
} catch(Exception ex){
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status",ex);
}
- if(retryCount<5){
+ if(retryCount<envMaxRetries){
int currSequence = (int) execution.getVariable("gCurrentSequence");
execution.setVariable("gCurrentSequence", currSequence-1);
execution.setVariable(RETRY_COUNT, nextCount);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index 1f8c56e727..3b7e509752 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -23,6 +23,8 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import java.util.List;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public class Candidate implements Serializable{
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
deleted file mode 100644
index d8984c0b83..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class CandidateType implements Serializable{
-
- private static final long serialVersionUID = 2273215496314532173L;
-
- @JsonProperty("name")
- private String name;
-
-
- public String getName(){
- return name;
- }
-
- public void setName(String name){
- this.name = name;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 278afc733a..516c9480ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -20,12 +20,18 @@
package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
+
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.bind.JAXBException;
import org.junit.Test;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
public class NetworkAdapterRestV1Test {
@@ -36,4 +42,17 @@ public class NetworkAdapterRestV1Test {
String returnedXml = response.toXmlString();
System.out.println(returnedXml);
}
+
+ @Test
+ public void testUnmarshalXmlUpdate() throws IOException, JAXBException {
+ UpdateNetworkResponse expectedResponse = new UpdateNetworkResponse();
+ expectedResponse.setMessageId("ec100bcc-2659-4aa4-b4d8-3255715c2a51");
+ expectedResponse.setNetworkId("80de31e3-cc78-4111-a9d3-5b92bf0a39eb");
+ Map<String,String>subnetMap = new HashMap<String,String>();
+ subnetMap.put("95cd8437-25f1-4238-8720-cbfe7fa81476", "d8d16606-5d01-4822-b160-9a0d257303e0");
+ expectedResponse.setSubnetMap(subnetMap);
+ String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><updateNetworkResponse><messageId>ec100bcc-2659-4aa4-b4d8-3255715c2a51</messageId><networkId>80de31e3-cc78-4111-a9d3-5b92bf0a39eb</networkId><subnetMap><entry><key>95cd8437-25f1-4238-8720-cbfe7fa81476</key><value>d8d16606-5d01-4822-b160-9a0d257303e0</value></entry></subnetMap></updateNetworkResponse>";
+ UpdateNetworkResponse response = (UpdateNetworkResponse) new NetworkAdapterRestV1().unmarshalXml(xml, UpdateNetworkResponse.class);
+ assertThat(expectedResponse, sameBeanAs(response));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index f3b094f645..2fc62978fb 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
+import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
@@ -46,6 +47,7 @@ import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.core.env.Environment;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -64,6 +66,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
private DelegateExecution execution;
+ @Mock
+ protected Environment environment;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -287,6 +292,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
execution.setVariable("handlingCode","Retry");
execution.setVariable("retryCount", 1);
execution.setVariable("gCurrentSequence",1);
@@ -297,6 +303,25 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void checkRetryStatusTestExceededMaxRetries(){
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+ doReturn("6").when(environment).getProperty("mso.rainyDay.maxRetries");
+ execution.setVariable("handlingCode","Retry");
+ execution.setVariable("retryCount", 6);
+ execution.setVariable("gCurrentSequence",1);
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ try{
+ workflowActionBBTasks.checkRetryStatus(execution);
+ } catch (BpmnError e) {
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("Exceeded maximum retries. Ending flow with status Abort",exception.getErrorMessage());
+ }
+ }
+
+ @Test
public void checkRetryStatusNoRetryTest(){
String reqId = "reqId123";
execution.setVariable("mso-request-id", reqId);
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
index 83ecd6add1..6713f80ad9 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
@@ -42,9 +42,7 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "identifierType" : {
- "name" : "vnfId"
- },
+ "identifierType" : "vnfId",
"identifiers" : [ "testVnfId" ]
} ]
} ],
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
index c3c5c0771a..14a89c90fc 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
@@ -42,9 +42,7 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "identifierType" : {
- "name" : "vnfId"
- },
+ "identifierType" : "vnfId",
"identifiers" : [ "testVnfId" ]
} ]
}, {
@@ -66,9 +64,7 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "identifierType" : {
- "name" : "vnfId"
- },
+ "identifierType" : "vnfId",
"identifiers" : [ "testVnfId" ]
} ]
}, {
@@ -90,9 +86,7 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "identifierType" : {
- "name" : "vnfId"
- },
+ "identifierType" : "vnfId",
"identifiers" : [ "testVnfId" ]
} ]
} ],