diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-11 21:35:13 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-11 21:37:03 -0500 |
commit | c286ac0022ccef0ea4f7d74f8626fba6e3060b86 (patch) | |
tree | 16da38bb91a2d8c6030394480e00a85c1bce91ca /bpmn/MSOCommonBPMN/src/test/java/org | |
parent | 801cddd65cad0bd01ea8fec5d33f9e53e17aa62b (diff) |
refactored validator to be more generic
removed overloaded method from class for JUEL
changed test back to DelegateExecution
added methods to allow validations with DelegateExecution
refactored validator to be more generic
Change-Id: I6c6d7a50e8b5470ffa5619cc83966f5ad68e66fe
Issue-ID: SO-1383
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java/org')
8 files changed, 17 insertions, 18 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..7246af0cb5 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,7 +75,7 @@ public class BuildingBlockValidatorRunnerTest { runner.preValidate("test", execution); fail("exception not thrown"); } catch (BpmnError e) { - WorkflowException workflowException = execution.getVariable("WorkflowException"); + WorkflowException workflowException = (WorkflowException)execution.getVariable("WorkflowException"); assertEquals("Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo\norg.onap.so.bpmn.common.validation.MyPreValidatorOne", 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..7aa42248ac 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 @@ -30,7 +30,7 @@ import org.springframework.stereotype.Component; public class MyPreValidatorFour implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test2"); } 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..302bb2b023 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 @@ -30,7 +30,7 @@ import org.springframework.stereotype.Component; public class MyPreValidatorOne implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test"); } 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..ca1a959104 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 @@ -30,7 +30,7 @@ import org.springframework.stereotype.Component; public class MyPreValidatorThree implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test2"); } 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..b74c91433f 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 @@ -33,7 +33,7 @@ import org.springframework.stereotype.Component; public class MyPreValidatorTwo implements PreBuildingBlockValidator { @Override - public Set<String> forBuildingBlock() { + public Set<String> forItems() { return Collections.singleton("test"); } 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..6538fe5378 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 @@ -23,20 +23,20 @@ package org.onap.so.bpmn.common.validation; import java.util.Collections; 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) { + public boolean validate(BuildingBlockExecution exeuction) { return false; } 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..e20f0f2b0e 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 @@ -25,7 +25,7 @@ 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,12 +33,12 @@ 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) { + public boolean validate(BuildingBlockExecution execution) { return false; } 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..0dd2f410f3 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); } |