summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java60
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java29
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java4
11 files changed, 31 insertions, 115 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java
deleted file mode 100644
index 3c36052dca..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java
+++ /dev/null
@@ -1,60 +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.bpmn.common.listener;
-
-import java.lang.annotation.Annotation;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Optional;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import javax.annotation.Priority;
-import org.onap.so.client.exception.ExceptionBuilder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-
-public abstract class ListenerRunner {
-
- @Autowired
- protected ApplicationContext context;
-
- @Autowired
- protected ExceptionBuilder exceptionBuilder;
-
- protected <T> List<T> filterListeners(List<T> validators, Predicate<T> predicate) {
- return validators.stream().filter(item -> {
- return !item.getClass().isAnnotationPresent(Skip.class) && predicate.test(item);
- }).sorted(Comparator.comparing(item -> {
- Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() {
- public int value() {
- return 1000;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return Priority.class;
- }
- });
- return p.value();
- })).collect(Collectors.toList());
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java
deleted file mode 100644
index a0543fd3cc..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java
+++ /dev/null
@@ -1,29 +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.bpmn.common.listener;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Skip {
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
index 68cda5c22b..69151ff74f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
@@ -27,9 +27,9 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index 5f4dc871fb..ea7de687ee 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -27,8 +27,8 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java
index 040522b576..02cddf3655 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java
@@ -28,9 +28,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -47,6 +49,9 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo
private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class);
+ @Autowired
+ protected ExceptionBuilder exceptionBuilder;
+
protected List<S> preFlowValidators;
protected List<E> postFlowValidators;
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 09a5424d47..be53e505ac 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
@@ -104,6 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default serviceType value
+ logger.error("Exception in serviceType retrivel", ex);
}
String vnfType = ASTERISK;
try {
@@ -115,6 +116,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default vnfType value
+ logger.error("Exception in vnfType retrivel", ex);
}
String errorCode = ASTERISK;
@@ -122,12 +124,14 @@ public class ExecuteBuildingBlockRainyDay {
errorCode = "" + workflowException.getErrorCode();
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
String workStep = ASTERISK;
@@ -135,6 +139,7 @@ public class ExecuteBuildingBlockRainyDay {
workStep = workflowException.getWorkStep();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in workStep retrivel", ex);
}
String errorMessage = ASTERISK;
@@ -142,6 +147,7 @@ public class ExecuteBuildingBlockRainyDay {
errorMessage = workflowException.getErrorMessage();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in errorMessage retrivel", ex);
}
String serviceRole = ASTERISK;
@@ -177,14 +183,14 @@ public class ExecuteBuildingBlockRainyDay {
logger.error("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
}
- if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
+ if ("RollbackToAssigned".equals(handlingCode) && !aLaCarte) {
handlingCode = "Rollback";
}
if (handlingCode.startsWith("Rollback")) {
String targetState = "";
- if (handlingCode.equalsIgnoreCase("RollbackToAssigned")) {
+ if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
- } else if (handlingCode.equalsIgnoreCase("RollbackToCreated")) {
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_CREATED.toString();
} else {
targetState = Status.ROLLED_BACK.toString();
@@ -204,7 +210,7 @@ public class ExecuteBuildingBlockRainyDay {
int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
execution.setVariable("maxRetries", envMaxRetries);
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
execution.setVariable("maxRetries", 5);
}
}
@@ -247,8 +253,7 @@ public class ExecuteBuildingBlockRainyDay {
request.setLastModifiedBy("CamundaBPMN");
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
- logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: "
- + e.getMessage());
+ logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: ", e);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index b2dbd97bfc..aee28cae00 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -90,7 +90,6 @@ public class ExtractPojosForBB {
result = lookupObjectInList(serviceInstance.getConfigurations(), value);
break;
case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
break;
case VPN_BONDING_LINK_ID:
@@ -107,8 +106,9 @@ public class ExtractPojosForBB {
} catch (BBObjectNotFoundException e) { // re-throw parent object not found
throw e;
} catch (Exception e) { // convert all other exceptions to object not found
- logger.warn("BBObjectNotFoundException in ExtractPojosForBB",
- "BBObject " + key + " was not found in " + "gBBInput using reference value: " + value);
+ logger.warn(
+ "BBObjectNotFoundException in ExtractPojosForBB, BBObject {} was not found in gBBInput using reference value: {} {}",
+ key, value, e);
throw new BBObjectNotFoundException(key, value);
}
@@ -119,13 +119,8 @@ public class ExtractPojosForBB {
}
}
- protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- return findValue(obj, value);
- }
-
- protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ protected <T> Optional<T> lookupObjectInList(List<?> list, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Optional<T> result = Optional.empty();
for (Object obj : list) {
result = findValue(obj, value);
@@ -137,8 +132,8 @@ public class ExtractPojosForBB {
}
- protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ protected <T> Optional<T> findValue(Object obj, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
for (Field field : obj.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Id.class)) {
String fieldName = field.getName();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
index 2c0377d11c..f4fe6d7158 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ValidationConfig.class})
-public class BuildingBlockValidatorRunnerTest {
+public class BuildingBlockValidatorRunnerTest extends BuildingBlockValidatorRunner {
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
index 0143e567af..596eced1d1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
@@ -45,7 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ValidationConfig.class})
-public class WorkflowValidatorRunnerTest {
+public class WorkflowValidatorRunnerTest extends WorkflowValidatorRunner {
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
index af64ed2de6..544d370a3c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
@@ -23,8 +23,8 @@ package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.Skip;
import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
+import org.onap.so.listener.Skip;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
index 068f433dd5..a3692a50b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
@@ -21,13 +21,13 @@
package org.onap.so.bpmn.common.listener.validation;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.ListenerRunner;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ComponentScan(basePackageClasses = {ExceptionBuilder.class, ListenerRunner.class},
+@ComponentScan(basePackageClasses = {ExceptionBuilder.class, ListenerRunner.class, WorkflowValidatorRunner.class},
nameGenerator = DefaultToShortClassNameBeanNameGenerator.class)
public class ValidationConfig {