aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java9
8 files changed, 35 insertions, 30 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
index 9478b8f1f6..617f63f6f8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
@@ -57,11 +57,11 @@ public class BuildingBlockValidatorRunnerTest {
MyPreValidatorOne one = new MyPreValidatorOne();
MyPreValidatorTwo two = new MyPreValidatorTwo();
MyPreValidatorThree three = new MyPreValidatorThree();
- List<BuildingBlockValidator> validators = Arrays.asList(one, two, three);
+ List<FlowValidator> validators = Arrays.asList(one, two, three);
- List<BuildingBlockValidator> result = runner.filterValidators(validators, "test");
+ List<FlowValidator> result = runner.filterValidators(validators, "test");
- List<BuildingBlockValidator> expected = Arrays.asList(two, one);
+ List<FlowValidator> expected = Arrays.asList(two, one);
assertEquals(expected, result);
}
@@ -75,8 +75,8 @@ public class BuildingBlockValidatorRunnerTest {
runner.preValidate("test", execution);
fail("exception not thrown");
} catch (BpmnError e) {
- WorkflowException workflowException = execution.getVariable("WorkflowException");
- assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo\norg.onap.so.bpmn.common.validation.MyPreValidatorOne", workflowException.getErrorMessage());
+ WorkflowException workflowException = (WorkflowException)execution.getVariable("WorkflowException");
+ assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.MyPreValidatorOne: my-error-one", workflowException.getErrorMessage());
}
runner.preValidate("test2", mock(BuildingBlockExecution.class));
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
index 1b52f049b3..fbd709b058 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.common.validation;
import java.util.Collections;
+import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -30,13 +31,13 @@ import org.springframework.stereotype.Component;
public class MyPreValidatorFour implements PreBuildingBlockValidator {
@Override
- public Set<String> forBuildingBlock() {
+ public Set<String> forItems() {
return Collections.singleton("test2");
}
@Override
- public boolean validate(BuildingBlockExecution exeuction) {
- return true;
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-four");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
index d6afea9b19..f642f915b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.common.validation;
import java.util.Collections;
+import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -30,14 +31,14 @@ import org.springframework.stereotype.Component;
public class MyPreValidatorOne implements PreBuildingBlockValidator {
@Override
- public Set<String> forBuildingBlock() {
+ public Set<String> forItems() {
return Collections.singleton("test");
}
@Override
- public boolean validate(BuildingBlockExecution exeuction) {
- return false;
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-one");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
index f7e93d5bd2..780fb43c2a 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.common.validation;
import java.util.Collections;
+import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -30,13 +31,13 @@ import org.springframework.stereotype.Component;
public class MyPreValidatorThree implements PreBuildingBlockValidator {
@Override
- public Set<String> forBuildingBlock() {
+ public Set<String> forItems() {
return Collections.singleton("test2");
}
@Override
- public boolean validate(BuildingBlockExecution exeuction) {
- return true;
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-three");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
index 0c15fd8589..c8ff6ef848 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.common.validation;
import java.util.Collections;
+import java.util.Optional;
import java.util.Set;
import javax.annotation.Priority;
@@ -33,13 +34,13 @@ import org.springframework.stereotype.Component;
public class MyPreValidatorTwo implements PreBuildingBlockValidator {
@Override
- public Set<String> forBuildingBlock() {
+ public Set<String> forItems() {
return Collections.singleton("test");
}
@Override
- public boolean validate(BuildingBlockExecution exeuction) {
- return false;
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-two");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
index 9ad87b5aeb..bfe3ec06a3 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
@@ -21,23 +21,24 @@
package org.onap.so.bpmn.common.validation;
import java.util.Collections;
+import java.util.Optional;
import java.util.Set;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@Component
public class WorkflowPreValidatorOne implements PreWorkflowValidator {
@Override
- public Set<String> forWorkflowAction() {
+ public Set<String> forItems() {
return Collections.singleton("test");
}
@Override
- public boolean validate(DelegateExecution exeuction) {
- return false;
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-one");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
index 2157c673dc..ddf5f22f00 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
@@ -21,11 +21,12 @@
package org.onap.so.bpmn.common.validation;
import java.util.Collections;
+import java.util.Optional;
import java.util.Set;
import javax.annotation.Priority;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.stereotype.Component;
@Priority(1)
@@ -33,13 +34,13 @@ import org.springframework.stereotype.Component;
public class WorkflowPreValidatorTwo implements PreWorkflowValidator {
@Override
- public Set<String> forWorkflowAction() {
+ public Set<String> forItems() {
return Collections.singleton("test");
}
@Override
- public boolean validate(DelegateExecution execution) {
- return false;
+ public Optional<String> validate(BuildingBlockExecution exeuction) {
+ return Optional.of("my-error-two");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
index 313fe6b0c3..5629f99feb 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
@@ -36,7 +36,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.core.WorkflowException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
@@ -57,11 +56,11 @@ public class WorkflowValidatorRunnerTest {
WorkflowPreValidatorOne one = new WorkflowPreValidatorOne();
WorkflowPreValidatorTwo two = new WorkflowPreValidatorTwo();
- List<WorkflowValidator> validators = Arrays.asList(one, two);
+ List<FlowValidator> validators = Arrays.asList(one, two);
- List<WorkflowValidator> result = runner.filterValidators(validators, "test");
+ List<FlowValidator> result = runner.filterValidators(validators, "test");
- List<WorkflowValidator> expected = Arrays.asList(two, one);
+ List<FlowValidator> expected = Arrays.asList(two, one);
assertEquals(expected, result);
}
@@ -76,7 +75,7 @@ public class WorkflowValidatorRunnerTest {
fail("exception not thrown");
} catch (BpmnError e) {
WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorTwo\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorOne", workflowException.getErrorMessage());
+ assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorOne: my-error-one", workflowException.getErrorMessage());
}
runner.preValidate("test2", mock(DelegateExecution.class));
}