You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:05:58 UTC
[73/79] incubator-taverna-language git commit: validation moved into
api
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyTopNode.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyTopNode.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyTopNode.java
deleted file mode 100644
index 803a854..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyTopNode.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.PortMentionedTwiceProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestIterationStrategyTopNode {
-
- @Test
- public void testValidIterationStrategyTopNode() {
- Processor p = new Processor();
- IterationStrategyStack iss = new IterationStrategyStack();
- iss.setParent(p);
-
- InputProcessorPort p1 = new InputProcessorPort();
- p1.setParent(p);
- InputProcessorPort p2 = new InputProcessorPort();
- p2.setParent(p);
- InputProcessorPort p3 = new InputProcessorPort();
- p3.setParent(p);
-
- // Do a crossproduct with a portnode and a dotproduct
- CrossProduct cp = new CrossProduct();
- PortNode pNode1 = new PortNode();
- pNode1.setInputProcessorPort(p1);
- cp.add(pNode1);
- iss.add(cp);
-
- DotProduct dp = new DotProduct();
- PortNode pNode2 = new PortNode();
- pNode2.setInputProcessorPort(p2);
- PortNode pNode3 = new PortNode();
- pNode3.setInputProcessorPort(p3);
- dp.add(pNode2);
- dp.add(pNode3);
- cp.add(dp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, false, rcvl);
-
- Set<PortMentionedTwiceProblem> problems = rcvl.getPortMentionedTwiceProblems();
- assertEquals(Collections.EMPTY_SET, problems);
-
- }
-
- @Test
- public void testInvalidAtTopIterationStrategyTopNode() {
- Processor p = new Processor();
- IterationStrategyStack iss = new IterationStrategyStack();
- iss.setParent(p);
-
- InputProcessorPort p1 = new InputProcessorPort();
- p1.setParent(p);
- InputProcessorPort p2 = new InputProcessorPort();
- p2.setParent(p);
- InputProcessorPort p3 = new InputProcessorPort();
- p3.setParent(p);
-
- // Do a crossproduct with a portnode and a dotproduct
- CrossProduct cp = new CrossProduct();
- PortNode pNode1 = new PortNode();
- pNode1.setInputProcessorPort(p1);
- cp.add(pNode1);
- PortNode duplicateNode = new PortNode();
- duplicateNode.setInputProcessorPort(p1);
- cp.add(duplicateNode);
- iss.add(cp);
-
- DotProduct dp = new DotProduct();
- PortNode pNode2 = new PortNode();
- pNode2.setInputProcessorPort(p2);
- PortNode pNode3 = new PortNode();
- pNode3.setInputProcessorPort(p3);
- dp.add(pNode2);
- dp.add(pNode3);
- cp.add(dp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, false, rcvl);
-
- Set<PortMentionedTwiceProblem> problems = rcvl.getPortMentionedTwiceProblems();
- assertFalse(problems.isEmpty());
- boolean problemDetected = false;
- for (PortMentionedTwiceProblem problem : problems) {
- if (problem.getBean().equals(pNode1) && problem.getDuplicateNode().equals(duplicateNode)) {
- problemDetected = true;
- }
- }
- assertTrue(problemDetected);
-
- }
-
- @Test
- public void testInvalidDeepInIterationStrategyTopNode() {
- Processor p = new Processor();
- IterationStrategyStack iss = new IterationStrategyStack();
- iss.setParent(p);
-
- InputProcessorPort p1 = new InputProcessorPort();
- p1.setParent(p);
- InputProcessorPort p2 = new InputProcessorPort();
- p2.setParent(p);
- InputProcessorPort p3 = new InputProcessorPort();
- p3.setParent(p);
-
- // Do a crossproduct with a portnode and a dotproduct
- CrossProduct cp = new CrossProduct();
- PortNode pNode1 = new PortNode();
- pNode1.setInputProcessorPort(p1);
- cp.add(pNode1);
- iss.add(cp);
-
- DotProduct dp = new DotProduct();
- PortNode pNode2 = new PortNode();
- pNode2.setInputProcessorPort(p2);
- PortNode pNode3 = new PortNode();
- pNode3.setInputProcessorPort(p3);
- dp.add(pNode2);
- dp.add(pNode3);
- PortNode duplicateNode = new PortNode();
- duplicateNode.setInputProcessorPort(p1);
- cp.add(duplicateNode);
- cp.add(dp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, false, rcvl);
-
- Set<PortMentionedTwiceProblem> problems = rcvl.getPortMentionedTwiceProblems();
- assertFalse(problems.isEmpty());
- boolean problemDetected = false;
- for (PortMentionedTwiceProblem problem : problems) {
- if (problem.getBean().equals(pNode1) && problem.getDuplicateNode().equals(duplicateNode)) {
- problemDetected = true;
- }
- }
- assertTrue(problemDetected);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestNamed.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestNamed.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestNamed.java
deleted file mode 100644
index 0082d1e..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestNamed.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestNamed {
-
- @Test
- public void testValidName() {
- DummyWorkflow w = new DummyWorkflow();
- w.setName("fred");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
-
- }
-
- @Test
- public void testCorrectnessOfInvalidName() {
- DummyWorkflow w = new DummyWorkflow();
- w.setName("");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
-
- }
-
- @Test
- public void testCorrectnessOfMissingName() {
- DummyWorkflow w = new DummyWorkflow();
- w.setName(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfInvalidName() {
- DummyWorkflow w = new DummyWorkflow();
- w.setName("");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
-
- Set<NullFieldProblem> problems = rcvl.getNullFieldProblems();
- assertFalse(problems.isEmpty());
- boolean problemDetected = false;
- for (NullFieldProblem problem : problems) {
- if (problem.getBean().equals(w) && problem.getFieldName().equals("name")) {
- problemDetected = true;
- }
- }
- assertTrue(problemDetected);
- }
-
- @Test
- public void testCompletenessOfMissingName() {
- DummyWorkflow w = new DummyWorkflow();
- w.setName(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
-
- Set<NullFieldProblem> problems = rcvl.getNullFieldProblems();
- assertFalse(problems.isEmpty());
- boolean problemDetected = false;
- for (NullFieldProblem problem : problems) {
- if (problem.getBean().equals(w) && problem.getFieldName().equals("name")) {
- problemDetected = true;
- }
- }
- assertTrue(problemDetected);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPortNode.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPortNode.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPortNode.java
deleted file mode 100644
index 26db7e0..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPortNode.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NegativeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestPortNode {
-
- @Test
- public void testCorrectnessOfDesiredDepthSpecifiedIncorrectly() {
- PortNode pn = new PortNode();
- Integer desiredDepth = new Integer(-3);
- pn.setDesiredDepth(desiredDepth);
- InputProcessorPort ipp = new InputProcessorPort();
- pn.setInputProcessorPort(ipp);
-
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), pn);
- assertEquals(problem.getFieldName(), "desiredDepth");
- assertEquals(problem.getFieldValue(), desiredDepth);
- }
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfDepthSpecifiedIncorrectly() {
- PortNode pn = new PortNode();
- Integer desiredDepth = new Integer(-3);
- pn.setDesiredDepth(desiredDepth);
- InputProcessorPort ipp = new InputProcessorPort();
- pn.setInputProcessorPort(ipp);
-
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, true, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), pn);
- assertEquals(problem.getFieldName(), "desiredDepth");
- assertEquals(problem.getFieldValue(), desiredDepth);
- }
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty()); // parent
- boolean depthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pn) && nlp.getFieldName().equals("desiredDepth")) {
- depthFieldProblem = true;
- }
- }
- assertFalse(depthFieldProblem);
- }
-
- @Test
- public void testCorrectnessOfMissingDepth() {
- PortNode pn = new PortNode();
- InputProcessorPort ipp = new InputProcessorPort();
- pn.setInputProcessorPort(ipp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(Collections.EMPTY_SET, negativeValueProblems);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfMissingDepth() {
- PortNode pn = new PortNode();
- InputProcessorPort ipp = new InputProcessorPort();
- pn.setInputProcessorPort(ipp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, true, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(Collections.EMPTY_SET, negativeValueProblems);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean depthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pn) && nlp.getFieldName().equals("desiredDepth")) {
- depthFieldProblem = true;
- }
- }
- assertTrue(depthFieldProblem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingInputProcessorPort() {
- PortNode pn = new PortNode();
- Integer desiredDepth = new Integer(-3);
- pn.setDesiredDepth(desiredDepth);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertTrue(nullFieldProblems.isEmpty());
- }
-
- @Test
- public void testCompletenessOfMissingInputProcessorPort() {
- PortNode pn = new PortNode();
- Integer desiredDepth = new Integer(-3);
- pn.setDesiredDepth(desiredDepth);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean depthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pn) && nlp.getFieldName().equals("inputProcessorPort")) {
- depthFieldProblem = true;
- }
- }
- assertTrue(depthFieldProblem);
-
- }
-
- @Test
- public void testOutOfScopeInputProcessorPort() {
- Processor p = new Processor();
- InputProcessorPort ipp = new InputProcessorPort();
-// ipp.setParent(p);
- IterationStrategyStack iss = new IterationStrategyStack();
- p.setIterationStrategyStack(iss);
- CrossProduct cp = new CrossProduct();
- iss.add(cp);
- cp.setParent(iss);
- PortNode pn = new PortNode();
- pn.setInputProcessorPort(ipp);
- cp.add(pn);
- pn.setParent(cp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pn) && nlp.getFieldName().equals("inputProcessorPort") && nlp.getValue().equals(ipp)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testInScopeInputProcessorPort() {
- Processor p = new Processor();
- InputProcessorPort ipp = new InputProcessorPort();
- ipp.setParent(p);
- IterationStrategyStack iss = new IterationStrategyStack();
- p.setIterationStrategyStack(iss);
- CrossProduct cp = new CrossProduct();
- iss.add(cp);
- cp.setParent(iss);
- PortNode pn = new PortNode();
- pn.setInputProcessorPort(ipp);
- cp.add(pn);
- pn.setParent(cp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pn, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPorted.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPorted.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPorted.java
deleted file mode 100644
index 2daf6c5..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestPorted.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestPorted {
-
- @Test
- public void testCorrectnessOfMissingInputPorts() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setOutputPorts(new NamedSet<OutputWorkflowPort>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfMissingInputPorts() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setOutputPorts(new NamedSet<OutputWorkflowPort>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("inputPorts")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedInputPorts() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setInputPorts(new NamedSet<InputWorkflowPort>());
- dw.setOutputPorts(new NamedSet<OutputWorkflowPort>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("inputPorts")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingOutputPorts() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setInputPorts(new NamedSet<InputWorkflowPort>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfMissingOutputPorts() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setInputPorts(new NamedSet<InputWorkflowPort>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("outputPorts")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedOutputPorts() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setInputPorts(new NamedSet<InputWorkflowPort>());
- dw.setOutputPorts(new NamedSet<OutputWorkflowPort>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("outputPorts")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessor.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessor.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessor.java
deleted file mode 100644
index 22e61fb..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessor.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestProcessor {
-
- @Test
- public void testCorrectnessOfMissingIterationStrategyStack() {
- Processor p = new Processor();
- p.setIterationStrategyStack(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfMissingIterationStrategyStack() {
- Processor p = new Processor();
- p.setIterationStrategyStack(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(p) && nlp.getFieldName().equals("iterationStrategyStack")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedIterationStrategyStack() {
- Processor p = new Processor();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(p) && nlp.getFieldName().equals("iterationStrategyStack")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedDispatchStack() {
- Processor p = new Processor();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(p) && nlp.getFieldName().equals("dispatchStack")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorBinding.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorBinding.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorBinding.java
deleted file mode 100644
index 210e292..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorBinding.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NegativeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestProcessorBinding {
-
- @Test
- public void testCorrectnessOfMissingBoundProcessor() {
- ProcessorBinding pb = new ProcessorBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingBoundProcessor() {
- ProcessorBinding pb = new ProcessorBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedBoundProcessor() {
- ProcessorBinding pb = new ProcessorBinding();
- pb.setBoundProcessor(new Processor());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingBoundActivity() {
- ProcessorBinding pb = new ProcessorBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingBoundActivity() {
- ProcessorBinding pb = new ProcessorBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundActivity")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedBoundActivity() {
- ProcessorBinding pb = new ProcessorBinding();
- pb.setBoundActivity(new Activity());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundActivity")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingInputPortBindings() {
- ProcessorBinding pb = new ProcessorBinding();
- pb.setInputPortBindings(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingInputPortBindings() {
- ProcessorBinding pb = new ProcessorBinding();
- pb.setInputPortBindings(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("inputPortBindings")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedInputPortBindings() {
- ProcessorBinding pb = new ProcessorBinding();
- // No need to specify as default constructor does it
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("inputPortBindings")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingOutputPortBindings() {
- ProcessorBinding pb = new ProcessorBinding();
- pb.setOutputPortBindings(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingOutputPortBindings() {
- ProcessorBinding pb = new ProcessorBinding();
- pb.setOutputPortBindings(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("outputPortBindings")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedOutputPortBindings() {
- ProcessorBinding pb = new ProcessorBinding();
- // No need to specify as default constructor does it
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("outputPortBindings")) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-
- @Test
- public void testCompletenessOfMissingActivityPosition() {
- // should be OK
- ProcessorBinding pb = new ProcessorBinding();
- pb.setActivityPosition(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("activityPosition")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfInvalidActivityPosition() {
- ProcessorBinding pb = new ProcessorBinding();
- Integer activityPosition = Integer.valueOf(-3);
- pb.setActivityPosition(activityPosition);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- boolean problem = false;
- for (NegativeValueProblem nlp : negativeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("activityPosition") && nlp.getFieldValue().equals(activityPosition)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCorrectnessOfValidActivityPosition() {
- ProcessorBinding pb = new ProcessorBinding();
- Integer activityPosition = Integer.valueOf(3);
- pb.setActivityPosition(activityPosition);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(Collections.EMPTY_SET, negativeValueProblems);
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeBoundProcessor1() {
- WorkflowBundle wb = new WorkflowBundle();
- Profile profile = new Profile();
- profile.setParent(wb);
- ProcessorBinding pb = new ProcessorBinding();
- Processor orphanProcessor = new Processor();
- pb.setBoundProcessor(orphanProcessor);
- pb.setParent(profile);
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(orphanProcessor)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeBoundProcessor2() {
- WorkflowBundle wb = new WorkflowBundle();
- Profile profile = new Profile();
- profile.setParent(wb);
- ProcessorBinding pb = new ProcessorBinding();
-
- Workflow w = new Workflow();
- Processor processor = new Processor();
- processor.setParent(w);
-
- pb.setBoundProcessor(processor);
- pb.setParent(profile);
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(processor)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCorrectnessOfInScopeBoundProcessor() {
- WorkflowBundle wb = new WorkflowBundle();
- Profile profile = new Profile();
- profile.setParent(wb);
- ProcessorBinding pb = new ProcessorBinding();
-
- Workflow w = new Workflow();
- Processor processor = new Processor();
- processor.setParent(w);
- w.setParent(wb);
-
- pb.setBoundProcessor(processor);
- pb.setParent(profile);
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
-// assertFalse(outOfScopeValueProblems.isEmpty());
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(processor)) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeBoundActivity() {
- WorkflowBundle wb = new WorkflowBundle();
- Profile profile = new Profile();
- profile.setParent(wb);
- ProcessorBinding pb = new ProcessorBinding();
- Activity orphanActivity = new Activity();
- pb.setBoundActivity(orphanActivity);
- pb.setParent(profile);
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundActivity") && nlp.getValue().equals(orphanActivity)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCorrectnessOfInScopeBoundActivity1() {
- // Test when in same profile
- WorkflowBundle wb = new WorkflowBundle();
- Profile profile = new Profile();
- profile.setParent(wb);
- ProcessorBinding pb = new ProcessorBinding();
- Activity activity = new Activity();
- activity.setParent(profile);
- pb.setBoundActivity(activity);
- pb.setParent(profile);
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundActivity") && nlp.getValue().equals(activity)) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-
- @Test
- public void testCorrectnessOfInScopeBoundActivity2() {
- // Test when in same profile
- WorkflowBundle wb = new WorkflowBundle();
- Profile profile = new Profile();
- profile.setParent(wb);
- ProcessorBinding pb = new ProcessorBinding();
-
- Profile otherProfile = new Profile();
- otherProfile.setParent(wb);
- Activity activity = new Activity();
- activity.setParent(otherProfile);
- pb.setBoundActivity(activity);
- pb.setParent(profile);
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundActivity") && nlp.getValue().equals(activity)) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorInputPortBinding.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorInputPortBinding.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorInputPortBinding.java
deleted file mode 100644
index 4c79970..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorInputPortBinding.java
+++ /dev/null
@@ -1,332 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.junit.Test;
-
-
-public class TestProcessorInputPortBinding {
-
- @Test
- public void testCorrectnessOfMissingBoundProcessorPort() {
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingBoundProcessorPort() {
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedBoundProcessorPort() {
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setBoundProcessorPort(new InputProcessorPort());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingBoundActivityPort() {
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingBoundActivityPort() {
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedBoundActivityPort() {
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setBoundActivityPort(new InputActivityPort());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeProcessorPort1() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setParent(pb);
-
- InputProcessorPort orphanPort = new InputProcessorPort();
- pipb.setBoundProcessorPort(orphanPort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(orphanPort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeProcessorPort2() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setParent(pb);
-
- Processor otherProcessor = new Processor();
- InputProcessorPort elsewherePort = new InputProcessorPort();
- elsewherePort.setParent(otherProcessor);
-
- pipb.setBoundProcessorPort(elsewherePort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(elsewherePort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfInScopeProcessorPort() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setParent(pb);
-
- InputProcessorPort port = new InputProcessorPort();
- port.setParent(processor);
-
- pipb.setBoundProcessorPort(port);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(port)) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeActivityPort1() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setParent(pb);
-
- InputActivityPort orphanPort = new InputActivityPort();
- pipb.setBoundActivityPort(orphanPort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort") && nlp.getValue().equals(orphanPort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeActivityPort2() {
- ProcessorBinding pb = new ProcessorBinding();
- Activity activity = new Activity();
- pb.setBoundActivity(activity);
-
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setParent(pb);
-
- Activity otherActivity = new Activity();
- InputActivityPort elsewherePort = new InputActivityPort();
- elsewherePort.setParent(otherActivity);
-
- pipb.setBoundActivityPort(elsewherePort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort") && nlp.getValue().equals(elsewherePort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfInScopeActivityPort() {
- ProcessorBinding pb = new ProcessorBinding();
- Activity activity = new Activity();
- pb.setBoundActivity(activity);
-
- ProcessorInputPortBinding pipb = new ProcessorInputPortBinding();
- pipb.setParent(pb);
-
- InputActivityPort port = new InputActivityPort();
- port.setParent(activity);
-
- pipb.setBoundActivityPort(port);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort") && nlp.getValue().equals(port)) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorOutputPortBinding.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorOutputPortBinding.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorOutputPortBinding.java
deleted file mode 100644
index 74b4a2f..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProcessorOutputPortBinding.java
+++ /dev/null
@@ -1,332 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.junit.Test;
-
-
-public class TestProcessorOutputPortBinding {
-
- @Test
- public void testCorrectnessOfMissingBoundProcessorPort() {
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingBoundProcessorPort() {
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedBoundProcessorPort() {
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setBoundProcessorPort(new OutputProcessorPort());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfMissingBoundActivityPort() {
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingBoundActivityPort() {
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedBoundActivityPort() {
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setBoundActivityPort(new OutputActivityPort());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeProcessorPort1() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setParent(pb);
-
- OutputProcessorPort orphanPort = new OutputProcessorPort();
- pipb.setBoundProcessorPort(orphanPort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(orphanPort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeProcessorPort2() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setParent(pb);
-
- Processor otherProcessor = new Processor();
- OutputProcessorPort elsewherePort = new OutputProcessorPort();
- elsewherePort.setParent(otherProcessor);
-
- pipb.setBoundProcessorPort(elsewherePort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(elsewherePort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfInScopeProcessorPort() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setParent(pb);
-
- OutputProcessorPort port = new OutputProcessorPort();
- port.setParent(processor);
-
- pipb.setBoundProcessorPort(port);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundProcessorPort") && nlp.getValue().equals(port)) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeActivityPort1() {
- ProcessorBinding pb = new ProcessorBinding();
- Processor processor = new Processor();
- pb.setBoundProcessor(processor);
-
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setParent(pb);
-
- OutputActivityPort orphanPort = new OutputActivityPort();
- pipb.setBoundActivityPort(orphanPort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort") && nlp.getValue().equals(orphanPort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfOutOfScopeActivityPort2() {
- ProcessorBinding pb = new ProcessorBinding();
- Activity activity = new Activity();
- pb.setBoundActivity(activity);
-
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setParent(pb);
-
- Activity otherActivity = new Activity();
- OutputActivityPort elsewherePort = new OutputActivityPort();
- elsewherePort.setParent(otherActivity);
-
- pipb.setBoundActivityPort(elsewherePort);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort") && nlp.getValue().equals(elsewherePort)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCorrectnessOfInScopeActivityPort() {
- ProcessorBinding pb = new ProcessorBinding();
- Activity activity = new Activity();
- pb.setBoundActivity(activity);
-
- ProcessorOutputPortBinding pipb = new ProcessorOutputPortBinding();
- pipb.setParent(pb);
-
- OutputActivityPort port = new OutputActivityPort();
- port.setParent(activity);
-
- pipb.setBoundActivityPort(port);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(pipb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(pipb) && nlp.getFieldName().equals("boundActivityPort") && nlp.getValue().equals(port)) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProfile.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProfile.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProfile.java
deleted file mode 100644
index cc15708..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestProfile.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NegativeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestProfile {
-
- @Test
- public void testCompletenessOfMissingProfilePosition() {
- // should be OK
- Profile profile = new Profile();
- profile.setProfilePosition(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("profilePosition")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCorrectnessOfInvalidProfilePosition() {
- Profile profile = new Profile();
- Integer profilePosition = Integer.valueOf(-3);
- profile.setProfilePosition(profilePosition);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- boolean problem = false;
- for (NegativeValueProblem nlp : negativeValueProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("profilePosition") && nlp.getFieldValue().equals(profilePosition)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCorrectnessOfValidProfilePosition() {
- Profile profile = new Profile();
- Integer profilePosition = Integer.valueOf(3);
- profile.setProfilePosition(profilePosition);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(Collections.EMPTY_SET, negativeValueProblems);
- }
-
- @Test
- public void testCorrectnessOfMissingFieldss() {
- DummyProfile profile = new DummyProfile();
- // The fields will default to null
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingFields() {
- DummyProfile profile = new DummyProfile();
- // The fields will default to null
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("processorBindings")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("configurations")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("activities")) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCompletenessOfSpecifiedProcessorBindings() {
- DummyProfile profile = new DummyProfile();
- // The fields will default to null
- profile.setProcessorBindings(new NamedSet<ProcessorBinding>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("processorBindings")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedConfigurations() {
- DummyProfile profile = new DummyProfile();
- // The fields will default to null
- profile.setConfigurations(new NamedSet<Configuration>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("configurations")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-
- @Test
- public void testCompletenessOfSpecifiedActivities() {
- DummyProfile profile = new DummyProfile();
- // The fields will default to null
- profile.setActivities(new NamedSet<Activity>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(profile, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(profile) && nlp.getFieldName().equals("activities")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestRoot.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestRoot.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestRoot.java
deleted file mode 100644
index beea5a7..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestRoot.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-
-import static org.junit.Assert.*;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.NonAbsoluteURIProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestRoot {
-
- @Test
- public void testCorrectnessOfMissingGlobalBaseURI() {
- WorkflowBundle wb = new WorkflowBundle();
- wb.setGlobalBaseURI(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(wb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingGlobalBaseURI() {
- WorkflowBundle wb = new WorkflowBundle();
- wb.setGlobalBaseURI(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(wb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(wb) && nlp.getFieldName().equals("globalBaseURI")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfGlobalBaseURI() throws URISyntaxException {
- WorkflowBundle wb = new WorkflowBundle();
- wb.setGlobalBaseURI(new URI("http://www.taverna.org.uk"));
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(wb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(wb) && nlp.getFieldName().equals("globalBaseURI")) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-
- @Test
- public void testNonAbsoluteURI() throws URISyntaxException {
- WorkflowBundle wb = new WorkflowBundle();
- URI globalBaseURI = new URI("fred/soup");
- wb.setGlobalBaseURI(globalBaseURI);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(wb, false, rcvl);
-
- Set<NonAbsoluteURIProblem> problems = rcvl.getNonAbsoluteURIProblems();
- boolean problem = false;
- for (NonAbsoluteURIProblem p : problems) {
- if (p.getBean().equals(wb) && p.getFieldName().equals("globalBaseURI") && p.getFieldValue().equals(globalBaseURI)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testFileURI() throws URISyntaxException {
- WorkflowBundle wb = new WorkflowBundle();
- URI globalBaseURI = new URI("file:///fred/soup");
- wb.setGlobalBaseURI(globalBaseURI);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(wb, false, rcvl);
-
- Set<NonAbsoluteURIProblem> problems = rcvl.getNonAbsoluteURIProblems();
- boolean problem = false;
- for (NonAbsoluteURIProblem p : problems) {
- if (p.getBean().equals(wb) && p.getFieldName().equals("globalBaseURI") && p.getFieldValue().equals(globalBaseURI)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-}