summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-10-23 18:08:00 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-23 18:08:00 +0000
commit0116cbfe7836b05381fe5632e0e536a625789b31 (patch)
tree7ec477214ba3d9f89f3444ef39639f698096b2bb
parent7817a1f47f74beae38974ec958a49640b7c2492c (diff)
parent5aaf7f76c6632dcd4bea56b227648482ddde3a50 (diff)
Merge "Bug fixes October 23rd" into casablanca
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy27
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java20
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java9
4 files changed, 43 insertions, 19 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy
index b43a96bdb0..ec2fed50c3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy
@@ -200,6 +200,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
try {
String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
String source = execution.getVariable("source")
String msoCompletionRequest =
"""<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
@@ -209,8 +210,9 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
<action>DELETE</action>
<source>${MsoUtils.xmlEscape(source)}</source>
</request-info>
- <aetgt:status-message>Service Instance was deleted successfully.</aetgt:status-message>
- <aetgt:mso-bpel-name>DeleteGenericALaCarteServiceInstance</aetgt:mso-bpel-name>
+ <status-message>Service Instance was deleted successfully.</status-message>
+ <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId>
+ <mso-bpel-name>DeleteGenericALaCarteServiceInstance</mso-bpel-name>
</aetgt:MsoCompletionRequest>"""
// Format Response
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index 38836c3650..6d41923bdf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -94,6 +94,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
try {
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("prefix", Prefix)
+
+ def rollbackData = execution.getVariable("rollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData()
+ }
+ execution.setVariable("rollbackData", rollbackData)
setBasicDBAuthHeader(execution, isDebugEnabled)
//Inputs
@@ -409,7 +415,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex) {
//start rollback set up
- RollbackData rollbackData = new RollbackData()
+ def rollbackData = execution.getVariable("rollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData()
+ }
def disableRollback = execution.getVariable("disableRollback")
rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
@@ -506,11 +515,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
def sdncRequestId3 = UUID.randomUUID().toString()
String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<")
def rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
- rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
- execution.setVariable("rollbackData", rollbackData)
+ if (rollbackData != null) {
+ rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
+ rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
+ execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ }
} catch (BpmnError e) {
throw e;
@@ -541,8 +552,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
msoLogger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response)
def rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
- execution.setVariable("rollbackData", rollbackData)
+ if (rollbackData != null) {
+ rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
+ execution.setVariable("rollbackData", rollbackData)
+ }
}else{
msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign")
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index d66e378146..951f02e5d8 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -172,6 +172,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class);
final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class);
+ InfraActiveRequests infraActiveRequests = null;
if (instanceName != null && !instanceName.equals("")) {
@@ -229,18 +230,17 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
}
}
}
-
- predicates.add(tableRoot.get(REQUEST_STATUS)
+ if(!predicates.isEmpty()){
+ predicates.add(tableRoot.get(REQUEST_STATUS)
.in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK")));
- final Order order = cb.desc(tableRoot.get(START_TIME));
-
- final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order);
-
- InfraActiveRequests infraActiveRequests = null;
-
- if (dupList != null && !dupList.isEmpty()) {
- infraActiveRequests = dupList.get(0);
+ final Order order = cb.desc(tableRoot.get(START_TIME));
+
+ final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order);
+
+ if (dupList != null && !dupList.isEmpty()) {
+ infraActiveRequests = dupList.get(0);
+ }
}
return infraActiveRequests;
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
index b7eb7642a2..4097aee7d5 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
@@ -22,6 +22,7 @@ package org.onap.so.db.request.data.repository;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.ACTION;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID;
@@ -181,4 +182,12 @@ public class InfraActiveRequestsRepositoryImplTest {
objUnderTest.getInfraActiveRequests(null, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT);
assertTrue(actualRequests.isEmpty());
}
+
+ @Test
+ public void checkInstanceNameDuplicateNullInstanceNameTest(){
+ Map<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "e05864f0-ab35-47d0-8be4-56fd9619ba3b");
+ InfraActiveRequests results = objUnderTest.checkInstanceNameDuplicate((HashMap<String, String>)instanceIdMap, null, "vnf");
+ assertNull(results);
+ }
}