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:59 UTC
[74/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/main/java/org/apache/taverna/scufl2/validation/correctness/report/MismatchConfigurableTypeProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/MismatchConfigurableTypeProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/MismatchConfigurableTypeProblem.java
deleted file mode 100644
index d39850d..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/MismatchConfigurableTypeProblem.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-public class MismatchConfigurableTypeProblem extends ValidationProblem {
- private final Configurable configurable;
-
- public MismatchConfigurableTypeProblem(Configuration configuration,
- Configurable configurable) {
- super(configuration);
- this.configurable = configurable;
- }
-
- /**
- * @return the configurable
- */
- public Configurable getConfigurable() {
- return configurable;
- }
-
- @Override
- public String toString() {
- return "The types of " + getBean() + " and " + configurable
- + " are mismatched";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NegativeValueProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NegativeValueProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NegativeValueProblem.java
deleted file mode 100644
index 226edf4..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NegativeValueProblem.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-public class NegativeValueProblem extends ValidationProblem {
- private final String fieldName;
- private final Integer fieldValue;
-
- public NegativeValueProblem(WorkflowBean bean, String fieldName,
- Integer fieldValue) {
- super(bean);
- this.fieldName = fieldName;
- this.fieldValue = fieldValue;
- }
-
- /**
- * @return the fieldName
- */
- public String getFieldName() {
- return fieldName;
- }
-
- /**
- * @return the fieldValue
- */
- public Integer getFieldValue() {
- return fieldValue;
- }
-
- @Override
- public String toString() {
- return getBean() + " has " + fieldName + " of value " + fieldValue;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NonAbsoluteURIProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NonAbsoluteURIProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NonAbsoluteURIProblem.java
deleted file mode 100644
index 7aa54b2..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NonAbsoluteURIProblem.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 java.net.URI;
-
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-public class NonAbsoluteURIProblem extends ValidationProblem {
- private String fieldName;
- private URI fieldValue;
-
- public NonAbsoluteURIProblem(WorkflowBean bean, String fieldName,
- URI fieldValue) {
- super(bean);
- this.fieldName = fieldName;
- this.fieldValue = fieldValue;
- }
-
- /**
- * @return the fieldName
- */
- public String getFieldName() {
- return fieldName;
- }
-
- /**
- * @return the fieldValue
- */
- public URI getFieldValue() {
- return fieldValue;
- }
-
- @Override
- public String toString() {
- return getBean() + "has a non-absolute URI in field " + fieldName
- + " of value " + fieldValue;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NullFieldProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NullFieldProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NullFieldProblem.java
deleted file mode 100644
index 6c2801d..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/NullFieldProblem.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-public class NullFieldProblem extends ValidationProblem {
- private final String fieldName;
-
- public NullFieldProblem(WorkflowBean bean, String fieldName) {
- super(bean);
- this.fieldName = fieldName;
- }
-
- /**
- * @return the fieldName
- */
- public String getFieldName() {
- return fieldName;
- }
-
- @Override
- public String toString() {
- return getBean() + " has a null " + fieldName;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/OutOfScopeValueProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/OutOfScopeValueProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/OutOfScopeValueProblem.java
deleted file mode 100644
index 7d6973d..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/OutOfScopeValueProblem.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-/**
- * @author alanrw
- */
-public class OutOfScopeValueProblem extends ValidationProblem {
- private final String fieldName;
- private final Object value;
-
- public OutOfScopeValueProblem(WorkflowBean bean, String fieldName,
- Object value) {
- super(bean);
- this.fieldName = fieldName;
- this.value = value;
- }
-
- /**
- * @return the fieldName
- */
- public String getFieldName() {
- return fieldName;
- }
-
- /**
- * @return the value
- */
- public Object getValue() {
- return value;
- }
-
- @Override
- public String toString() {
- return getBean() + " has " + fieldName + " with out of scope value " + value;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMentionedTwiceProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMentionedTwiceProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMentionedTwiceProblem.java
deleted file mode 100644
index af5f36c..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMentionedTwiceProblem.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-/**
- * @author alanrw
- */
-public class PortMentionedTwiceProblem extends ValidationProblem {
- private final IterationStrategyNode duplicateNode;
-
- public PortMentionedTwiceProblem(IterationStrategyNode originalNode,
- IterationStrategyNode duplicateNode) {
- super(originalNode);
- this.duplicateNode = duplicateNode;
- }
-
- /**
- * @return the iterationStrategyNode
- */
- public IterationStrategyNode getDuplicateNode() {
- return duplicateNode;
- }
-
- @Override
- public String toString() {
- return (getBean() + " and " + duplicateNode + " reference the same port");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMissingFromIterationStrategyStackProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMissingFromIterationStrategyStackProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMissingFromIterationStrategyStackProblem.java
deleted file mode 100644
index 502a023..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/PortMissingFromIterationStrategyStackProblem.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-/**
- * @author alanrw
- *
- */
-public class PortMissingFromIterationStrategyStackProblem extends
- ValidationProblem {
- private final Port port;
-
- public PortMissingFromIterationStrategyStackProblem(Port port,
- IterationStrategyStack iterationStrategyStack) {
- super(iterationStrategyStack);
- this.port = port;
- }
-
- /**
- * @return the port
- */
- public Port getPort() {
- return port;
- }
-
- @Override
- public String toString() {
- return getBean() + " does not include " + port;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/WrongParentProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/WrongParentProblem.java b/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/WrongParentProblem.java
deleted file mode 100644
index bb4b40e..0000000
--- a/taverna-scufl2-validation-correctness/src/main/java/org/apache/taverna/scufl2/validation/correctness/report/WrongParentProblem.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.correctness.report;
-/*
- *
- * 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 org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.validation.ValidationProblem;
-
-
-public class WrongParentProblem extends ValidationProblem {
- public WrongParentProblem(WorkflowBean bean) {
- super(bean);
- }
-
- @Override
- public String toString() {
- return getBean() + " does not have the correct parent";
- }
-}
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/DummyProfile.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyProfile.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyProfile.java
deleted file mode 100644
index 2e0f630..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyProfile.java
+++ /dev/null
@@ -1,117 +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 java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Visitor;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-
-class DummyProfile extends Profile {
-
- private NamedSet<ProcessorBinding> processorBindings = null;
-
- private NamedSet<Configuration> configurations = null;
-
- private NamedSet<Activity> activities = null;
-
- /**
- * @return the processorBindings
- */
- @Override
- public NamedSet<ProcessorBinding> getProcessorBindings() {
- return processorBindings;
- }
-
- /**
- * @param processorBindings the processorBindings to set
- */
- public void setProcessorBindings(NamedSet<ProcessorBinding> processorBindings) {
- this.processorBindings = processorBindings;
- }
-
- /**
- * @return the configurations
- */
- @Override
- public NamedSet<Configuration> getConfigurations() {
- return configurations;
- }
-
- /**
- * @param configurations the configurations to set
- */
- public void setConfigurations(NamedSet<Configuration> configurations) {
- this.configurations = configurations;
- }
-
- /**
- * @return the activities
- */
- @Override
- public NamedSet<Activity> getActivities() {
- return activities;
- }
-
- /**
- * @param activities the activities to set
- */
- public void setActivities(NamedSet<Activity> activities) {
- this.activities = activities;
- }
-
- @Override
- public boolean accept(Visitor visitor) {
- if (visitor.visitEnter(this)) {
- List<Iterable<? extends WorkflowBean>> children = new ArrayList<Iterable<? extends WorkflowBean>>();
- if (getActivities() != null) {
- children.add(getActivities());
- }
- if (getProcessorBindings() != null) {
- children.add(getProcessorBindings());
- }
- if (getConfigurations() != null) {
- children.add(getConfigurations());
- }
- outer: for (Iterable<? extends WorkflowBean> it : children) {
- for (WorkflowBean bean : it) {
- if (!bean.accept(visitor)) {
- break outer;
- }
- }
- }
- }
- return visitor.visitLeave(this);
- }
-
-
-}
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/DummyWorkflow.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyWorkflow.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyWorkflow.java
deleted file mode 100644
index 8a069d3..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyWorkflow.java
+++ /dev/null
@@ -1,195 +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 java.util.ArrayList;
-import java.util.List;
-import java.util.TreeSet;
-
-import org.apache.taverna.scufl2.api.annotation.Revision;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Visitor;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-
-class DummyWorkflow extends Workflow {
-
- private TreeSet<DataLink> dataLinks = null;
-
- private TreeSet<ControlLink> controlLinks = null;
- private NamedSet<InputWorkflowPort> inputPorts = null;
- private NamedSet<OutputWorkflowPort> outputPorts = null;
- private NamedSet<Processor> processors = null;
- private Revision currentRevision = null;
- @Override
- public Revision getCurrentRevision() {
- return currentRevision;
- }
-
- @Override
- public void setCurrentRevision(Revision currentRevision) {
- this.currentRevision = currentRevision;
- }
-
- private WorkflowBundle dummyParent = new WorkflowBundle();
-
- private String name2;
-
- public DummyWorkflow() {
-
- }
-
- public DummyWorkflow(WorkflowBundle parent) {
- super.setParent(parent);
- }
-
- @Override
- public WorkflowBundle getParent() {
- return dummyParent;
- }
-
- @Override
- public String getName() {
- return name2;
- }
-
- @Override
- public void setName(String name) {
- name2 = name;
- }
- /**
- * @return the inputPorts
- */
- @Override
- public NamedSet<InputWorkflowPort> getInputPorts() {
- return inputPorts;
- }
-
- /**
- * @return the outputPorts
- */
- @Override
- public NamedSet<OutputWorkflowPort> getOutputPorts() {
- return outputPorts;
- }
-
- /**
- * @param inputPorts the inputPorts to set
- */
- public void setInputPorts(NamedSet<InputWorkflowPort> inputPorts) {
- this.inputPorts = inputPorts;
- }
-
- /**
- * @param outputPorts the outputPorts to set
- */
- public void setOutputPorts(NamedSet<OutputWorkflowPort> outputPorts) {
- this.outputPorts = outputPorts;
- }
-
- @Override
- public boolean accept(Visitor visitor) {
- if (visitor.visitEnter(this)) {
- List<Iterable<? extends WorkflowBean>> children = new ArrayList<Iterable<? extends WorkflowBean>>();
- if (getInputPorts() != null) {
- children.add(getInputPorts());
- }
- if (getOutputPorts() != null) {
- children.add(getOutputPorts());
- }
- if (getProcessors() != null) {
- children.add(getProcessors());
- }
- if (getDataLinks() != null) {
- children.add(getDataLinks());
- }
- if (getControlLinks() != null) {
- children.add(getControlLinks());
- }
- outer: for (Iterable<? extends WorkflowBean> it : children) {
- for (WorkflowBean bean : it) {
- if (!bean.accept(visitor)) {
- break outer;
- }
- }
- }
- }
- return visitor.visitLeave(this);
- }
-
- /**
- * @return the dataLinks
- */
- @Override
- public TreeSet<DataLink> getDataLinks() {
- return dataLinks;
- }
-
- /**
- * @param dataLinks the dataLinks to set
- */
- public void setDataLinks(TreeSet<DataLink> dataLinks) {
- this.dataLinks = dataLinks;
- }
-
- /**
- * @return the controlLinks
- */
- @Override
- public TreeSet<ControlLink> getControlLinks() {
- return controlLinks;
- }
-
- /**
- * @param controlLinks the controlLinks to set
- */
- public void setControlLinks(TreeSet<ControlLink> controlLinks) {
- this.controlLinks = controlLinks;
- }
-
- /**
- * @return the processors
- */
- @Override
- public NamedSet<Processor> getProcessors() {
- return processors;
- }
-
- /**
- * @param processors the processors to set
- */
- public void setProcessors(NamedSet<Processor> processors) {
- this.processors = processors;
- }
-
-
-}
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/DummyWorkflowBundle.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyWorkflowBundle.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyWorkflowBundle.java
deleted file mode 100644
index 16d15a8..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/DummyWorkflowBundle.java
+++ /dev/null
@@ -1,133 +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 java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Visitor;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-
-/**
- * @author alanrw
- *
- */
-public class DummyWorkflowBundle extends WorkflowBundle {
-
- private NamedSet<Profile> profiles = null;
- private NamedSet<Workflow> workflows = null;
- private Workflow mainWorkflow;
- private Profile mainProfile;
-
- @Override
- public boolean accept(Visitor visitor) {
- if (visitor.visitEnter(this)) {
- List<Iterable<? extends WorkflowBean>> children = new ArrayList<Iterable<? extends WorkflowBean>>();
- if (getWorkflows() != null) {
- children.add(getWorkflows());
- }
- if (getProfiles() != null) {
- children.add(getProfiles());
- }
- outer: for (Iterable<? extends WorkflowBean> it : children) {
- for (WorkflowBean bean : it) {
- if (!bean.accept(visitor)) {
- break outer;
- }
- }
- }
- }
- return visitor.visitLeave(this);
- }
-
- /**
- * @return the profiles
- */
- @Override
- public NamedSet<Profile> getProfiles() {
- return profiles;
- }
-
- /**
- * @param profiles the profiles to set
- */
- public void setProfiles(NamedSet<Profile> profiles) {
- this.profiles = profiles;
- }
-
- /**
- * @return the workflows
- */
- @Override
- public NamedSet<Workflow> getWorkflows() {
- return workflows;
- }
-
- /**
- * @param workflows the workflows to set
- */
- public void setWorkflows(NamedSet<Workflow> workflows) {
- this.workflows = workflows;
- }
-
- /**
- * @return the mainWorkflow
- */
- @Override
- public Workflow getMainWorkflow() {
- return mainWorkflow;
- }
-
- /**
- * @param mainWorkflow the mainWorkflow to set
- */
- @Override
- public void setMainWorkflow(Workflow mainWorkflow) {
- this.mainWorkflow = mainWorkflow;
- }
-
- /**
- * @return the mainProfile
- */
- @Override
- public Profile getMainProfile() {
- return mainProfile;
- }
-
- /**
- * @param mainProfile the mainProfile to set
- */
- @Override
- public void setMainProfile(Profile mainProfile) {
- this.mainProfile = mainProfile;
- }
-
-
-}
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/TestAbstractDepthPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestAbstractDepthPort.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestAbstractDepthPort.java
deleted file mode 100644
index ecf3252..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestAbstractDepthPort.java
+++ /dev/null
@@ -1,143 +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.port.InputActivityPort;
-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;
-
-
-
-public class TestAbstractDepthPort {
-
- @Test
- public void testCorrectnessOfDepthSpecifiedIncorrectly() {
- InputActivityPort iap = new InputActivityPort();
- iap.setDepth(new Integer(-3));
- iap.setName("fred");
- iap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(iap, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), iap);
- assertEquals(problem.getFieldName(), "depth");
- assertEquals(problem.getFieldValue(), Integer.valueOf("-3"));
- }
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfDepthSpecifiedIncorrectly() {
- InputActivityPort iap = new InputActivityPort();
- iap.setDepth(new Integer(-3));
- iap.setName("fred");
- iap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(iap, true, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), iap);
- assertEquals(problem.getFieldName(), "depth");
- assertEquals(problem.getFieldValue(), Integer.valueOf("-3"));
- }
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty()); // parent
- boolean depthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(iap) && nlp.getFieldName().equals("depth")) {
- depthFieldProblem = true;
- }
- }
- assertFalse(depthFieldProblem);
- }
-
- @Test
- public void testCorrectnessOfMissingDepth() {
- InputActivityPort iap = new InputActivityPort();
- iap.setDepth(null);
- iap.setName("fred");
- iap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(iap, 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() {
- InputActivityPort iap = new InputActivityPort();
- iap.setDepth(null);
- iap.setName("fred");
- iap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(iap, true, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(0, negativeValueProblems.size());
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty()); // depth and parent
- boolean depthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(iap) && nlp.getFieldName().equals("depth")) {
- depthFieldProblem = true;
- }
- }
- assertTrue(depthFieldProblem);
-
- }
-
-}
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/TestAbstractGranularDepthPort.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestAbstractGranularDepthPort.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestAbstractGranularDepthPort.java
deleted file mode 100644
index 9586f26..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestAbstractGranularDepthPort.java
+++ /dev/null
@@ -1,189 +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.Set;
-
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.IncompatibleGranularDepthProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NegativeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Test;
-
-
-
-public class TestAbstractGranularDepthPort {
-
- @Test
- public void testCorrectnessOfGranularDepthSpecifiedIncorrectly() {
- OutputActivityPort oap = new OutputActivityPort();
- oap.setDepth(new Integer(3));
- oap.setGranularDepth(new Integer(-2));
- oap.setName("fred");
- oap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(oap, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), oap);
- assertEquals(problem.getFieldName(), "granularDepth");
- assertEquals(problem.getFieldValue(), Integer.valueOf("-2"));
- }
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
-
- assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size());
- }
-
- @Test
- public void testCompletenessOfGranularDepthSpecifiedIncorrectly() {
- OutputActivityPort oap = new OutputActivityPort();
- oap.setDepth(new Integer(3));
- oap.setGranularDepth(new Integer(-2));
- oap.setName("fred");
- oap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(oap, true, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), oap);
- assertEquals(problem.getFieldName(), "granularDepth");
- assertEquals(problem.getFieldValue(), Integer.valueOf("-2"));
- }
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(1, nullFieldProblems.size()); // parent
- boolean granularDepthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(oap) && nlp.getFieldName().equals("granularDepth")) {
- granularDepthFieldProblem = true;
- }
- }
- assertFalse(granularDepthFieldProblem);
- assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size());
- }
-
- @Test
- public void testCorrectnessOfMissingGranularDepth() {
- OutputActivityPort oap = new OutputActivityPort();
- oap.setDepth(new Integer(3));
- oap.setGranularDepth(null);
- oap.setName("fred");
- oap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(oap, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(0, negativeValueProblems.size());
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
- assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size());
- }
-
- @Test
- public void testCompletenessOfMissingGranularDepth() {
- OutputActivityPort oap = new OutputActivityPort();
- oap.setDepth(new Integer(3));
- oap.setGranularDepth(null);
- oap.setName("fred");
- oap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(oap, true, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(0, negativeValueProblems.size());
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(2, nullFieldProblems.size()); // granular depth and parent
- boolean granularDepthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(oap) && nlp.getFieldName().equals("granularDepth")) {
- granularDepthFieldProblem = true;
- }
- }
- assertTrue(granularDepthFieldProblem);
- assertEquals(0, rcvl.getIncompatibleGranularDepthProblems().size());
-
- }
-
- @Test
- public void testIncompatibleGranularDepth() {
- OutputActivityPort oap = new OutputActivityPort();
- oap.setDepth(new Integer(0));
- oap.setGranularDepth(new Integer(1));
- oap.setName("fred");
- oap.setParent(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(oap, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(0, negativeValueProblems.size());
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
- boolean granularDepthFieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(oap) && nlp.getFieldName().equals("granularDepth")) {
- granularDepthFieldProblem = true;
- }
- }
- assertFalse(granularDepthFieldProblem);
-
- Set<IncompatibleGranularDepthProblem> incompatibleGranularDepthProblems = rcvl.getIncompatibleGranularDepthProblems();
- assertEquals(1, incompatibleGranularDepthProblems.size());
- boolean incompatibleGranularDepthProblem = false;
- for (IncompatibleGranularDepthProblem nlp : incompatibleGranularDepthProblems) {
- if (nlp.getBean().equals(oap) && nlp.getDepth().equals(Integer.valueOf(0)) && nlp.getGranularDepth().equals(Integer.valueOf(1))) {
- incompatibleGranularDepthProblem = true;
- }
- }
- assertTrue(incompatibleGranularDepthProblem);
- }
-
-}
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/TestBlockingControlLink.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestBlockingControlLink.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestBlockingControlLink.java
deleted file mode 100644
index ae1d155..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestBlockingControlLink.java
+++ /dev/null
@@ -1,159 +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.Set;
-
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-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;
-
-
-
-/**
- * @author alanrw
- *
- */
-public class TestBlockingControlLink {
-
- @Test
- public void testCorrectnessOfMissingBlock() {
- BlockingControlLink bcl = new BlockingControlLink();
- Processor untilFinished = new Processor();
- bcl.setUntilFinished(untilFinished);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bcl, false, rcvl);
- assertEquals(0, rcvl.getNullFieldProblems().size());
-
- }
-
- @Test
- public void testCompletenessOfMissingBlock() {
- BlockingControlLink bcl = new BlockingControlLink();
- Processor untilFinished = new Processor();
- bcl.setUntilFinished(untilFinished);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bcl, true, rcvl);
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(2, rcvl.getNullFieldProblems().size()); // parent and block
- boolean nullFieldProblem = false;
- for (NullFieldProblem nfp : nullFieldProblems) {
- if (nfp.getBean().equals(bcl) && nfp.getFieldName().equals("block")) {
- nullFieldProblem = true;
- }
- }
- assertTrue(nullFieldProblem);
- }
-
- @Test
- public void testCorrectnessOfMissingUntilFinished() {
- BlockingControlLink bcl = new BlockingControlLink();
- Processor block = new Processor();
- bcl.setBlock(block);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bcl, false, rcvl);
- assertEquals(0, rcvl.getNullFieldProblems().size());
-
- }
-
- @Test
- public void testCompletenessOfMissingUntilFinished() {
- BlockingControlLink bcl = new BlockingControlLink();
- Processor block = new Processor();
- bcl.setBlock(block);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bcl, true, rcvl);
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(2, rcvl.getNullFieldProblems().size()); // parent and untilFinished
- boolean nullFieldProblem = false;
- for (NullFieldProblem nfp : nullFieldProblems) {
- if (nfp.getBean().equals(bcl) && nfp.getFieldName().equals("untilFinished")) {
- nullFieldProblem = true;
- }
- }
- assertTrue(nullFieldProblem);
- }
-
- @Test
- public void testWronglyScopedBlock() {
- Workflow wf = new Workflow();
- BlockingControlLink bcl = new BlockingControlLink();
- bcl.setParent(wf);
- Processor block = new Processor();
- Workflow otherWorkflow = new Workflow();
- block.setParent(otherWorkflow);
- bcl.setBlock(block);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bcl, false, rcvl);
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertEquals(1, outOfScopeValueProblems.size());
- boolean outOfScopeValueProblem = false;
- for (OutOfScopeValueProblem oosvp : outOfScopeValueProblems) {
- if (oosvp.getBean().equals(bcl) && oosvp.getFieldName().equals("block") && oosvp.getValue().equals(block)) {
- outOfScopeValueProblem = true;
- }
- }
- assertTrue(outOfScopeValueProblem);
- }
-
- @Test
- public void testValidlyScopedBlock() {
- Workflow wf = new Workflow();
- BlockingControlLink bcl = new BlockingControlLink();
- bcl.setParent(wf);
- Processor block = new Processor();
- block.setParent(wf);
- bcl.setBlock(block);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bcl, false, rcvl);
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertEquals(0, outOfScopeValueProblems.size());
- }
-}
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/TestChild.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestChild.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestChild.java
deleted file mode 100644
index 0373f4c..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestChild.java
+++ /dev/null
@@ -1,140 +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.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-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.WrongParentProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestChild {
-
-
-
- /**
- * Test method for {@link org.apache.taverna.scufl2.validation.correctness.CorrectnessVisitor#visitChild(org.apache.taverna.scufl2.api.common.Child)}.
- */
- @Test
- public void testCorrectnessOfMissingParent() {
- Workflow w = new Workflow();
- w.setName("fred");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
- }
-
- @Test
- public void testCompletenessOfMissingParent() {
- Workflow w = new Workflow();
- w.setName("fred");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(1, nullFieldProblems.size()); // parent
- boolean parentProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(w) && nlp.getFieldName().equals("parent")) {
- parentProblem = true;
- }
- }
- assertTrue(parentProblem);
- }
-
- @Test
- public void testCompletenessOfSpecifiedParent() {
- Workflow w = new Workflow();
- w.setName("fred");
- WorkflowBundle wb = new WorkflowBundle();
- w.setParent(wb);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(w, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size());
- }
-
- @Test
- public void testValidParent() {
- WorkflowBundle parent = new WorkflowBundle();
- Workflow fw = new Workflow();
- fw.setParent(parent);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(parent, false, rcvl);
- Set<WrongParentProblem> wrongParentProblems = rcvl.getWrongParentProblems();
- assertEquals(Collections.EMPTY_SET, wrongParentProblems);
- }
-
- @Test
- public void testInvalidParent() {
-
- WorkflowBundle parent = new WorkflowBundle();
- DummyWorkflow fw = new DummyWorkflow(parent);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(parent, false, rcvl);
- Set<WrongParentProblem> wrongParentProblems = rcvl.getWrongParentProblems();
- assertEquals(1, wrongParentProblems.size());
- boolean parentProblem = false;
- for (WrongParentProblem p : wrongParentProblems) {
- if (p.getBean().equals(fw)) {
- parentProblem = true;
- }
- }
- assertTrue(parentProblem);
- }
-
-
-
-}
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/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestConfiguration.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestConfiguration.java
deleted file mode 100644
index 9a20101..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestConfiguration.java
+++ /dev/null
@@ -1,172 +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.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.correctness.report.MismatchConfigurableTypeProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.junit.Ignore;
-import org.junit.Test;
-
-
-
-/**
- * @author alanrw
- *
- */
-public class TestConfiguration {
-
- @Test
- public void testIdenticalConfigurableTypes() {
- Configuration configuration = new Configuration();
- Activity a = new Activity();
- URI tavernaUri = null;
- try {
- tavernaUri = new URI("http://www.taverna.org.uk");
- } catch (URISyntaxException e) {
- return;
- }
- configuration.setConfigures(a);
- configuration.setType(tavernaUri);
- a.setType(tavernaUri);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(configuration, false, rcvl);
-
- Set<MismatchConfigurableTypeProblem> mismatchConfigurableTypeProblems = rcvl.getMismatchConfigurableTypeProblems();
- assertEquals(0, mismatchConfigurableTypeProblems.size());
- }
-
- @Ignore
- public void testEqualConfigurableTypes() {
- Configuration configuration = new Configuration();
- Activity a = new Activity();
- URI tavernaUri = null;
- URI tavernaUri2 = null;
- try {
- tavernaUri = new URI("http://www.taverna.org.uk");
- tavernaUri2 = new URI("http://www.taverna.org.uk");
- } catch (URISyntaxException e) {
- return;
- }
- configuration.setConfigures(a);
- configuration.setType(tavernaUri);
- a.setType(tavernaUri2);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(configuration, false, rcvl);
-
- Set<MismatchConfigurableTypeProblem> mismatchConfigurableTypeProblems = rcvl.getMismatchConfigurableTypeProblems();
- assertEquals(0, mismatchConfigurableTypeProblems.size());
- }
-
- @Ignore
- public void testMismatchingConfigurableTypes() {
- Configuration configuration = new Configuration();
- Activity a = new Activity();
- URI tavernaUri = null;
- URI myGridUri = null;
- try {
- tavernaUri = new URI("http://www.taverna.org.uk");
- myGridUri = new URI("http://www.mygrid.org.uk");
- } catch (URISyntaxException e) {
- return;
- }
- configuration.setConfigures(a);
- configuration.setType(tavernaUri);
- a.setType(myGridUri);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(configuration, false, rcvl);
-
- Set<MismatchConfigurableTypeProblem> mismatchConfigurableTypeProblems = rcvl.getMismatchConfigurableTypeProblems();
- assertEquals(1, mismatchConfigurableTypeProblems.size());
- boolean mismatchProblem = false;
- for (MismatchConfigurableTypeProblem nlp : mismatchConfigurableTypeProblems) {
- if (nlp.getBean().equals(configuration) && nlp.getConfigurable().equals(a)) {
- mismatchProblem = true;
- }
- }
- assertTrue(mismatchProblem);
- }
-
- @Test
- public void testCorrectnessOfMissingConfigures() {
- Configuration configuration = new Configuration();
- configuration.setType(URI.create("http://www.example.com/"));
- configuration.setJson("{ \"hello\": 1337 }");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(configuration, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
-
- }
-
- @Test
- public void testCompletenessOfMissingConfigures() {
- Configuration configuration = new Configuration();
- configuration.setType(URI.create("http://www.example.com/"));
- configuration.setJson("{ \"hello\": 1337 }");
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(configuration, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty()); // only done when completeness check
-
- boolean fieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(configuration) && nlp.getFieldName().equals("configures")) {
- fieldProblem = true;
- }
- }
- assertTrue(fieldProblem);
- }
-
- // Cannot check propertyResource because of SCUFL2-97
-}
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/TestDataLink.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestDataLink.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestDataLink.java
deleted file mode 100644
index 460379a..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestDataLink.java
+++ /dev/null
@@ -1,389 +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.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-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.NegativeValueProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.junit.Test;
-
-
-
-public class TestDataLink {
-
- @Test
- public void testCorrectnessOfMissingSendsTo() {
- DataLink dataLink = new DataLink();
- InputWorkflowPort iwp = new InputWorkflowPort();
- dataLink.setReceivesFrom(iwp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
-
- }
-
- @Test
- public void testCompletenessOfMissingSendsTo() {
- DataLink dataLink = new DataLink();
- InputWorkflowPort iwp = new InputWorkflowPort();
- dataLink.setReceivesFrom(iwp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty()); // only done when completeness check
-
- boolean fieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dataLink) && nlp.getFieldName().equals("sendsTo")) {
- fieldProblem = true;
- }
- }
- assertTrue(fieldProblem);
- }
-
- @Test
- public void testCorrectnessOfMissingReceivesFrom() {
- DataLink dataLink = new DataLink();
- OutputWorkflowPort owp = new OutputWorkflowPort();
- dataLink.setSendsTo(owp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(0, nullFieldProblems.size()); // only done when completeness check
-
- }
-
- @Test
- public void testCompletenessOfMissingReceivesFrom() {
- DataLink dataLink = new DataLink();
- OutputWorkflowPort owp = new OutputWorkflowPort();
- dataLink.setSendsTo(owp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty()); // only done when completeness check
-
- boolean fieldProblem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dataLink) && nlp.getFieldName().equals("receivesFrom")) {
- fieldProblem = true;
- }
- }
- assertTrue(fieldProblem);
- }
-
- @Test
- public void testInScopePorts() {
- Workflow w = new Workflow();
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- InputWorkflowPort iwp = new InputWorkflowPort();
- iwp.setParent(w);
-
- OutputWorkflowPort owp = new OutputWorkflowPort();
- owp.setParent(w);
-
- dataLink.setReceivesFrom(iwp);
- dataLink.setSendsTo(owp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems);
- }
-
- @Test
- public void testOutOfScopeReceivesFrom() {
- Workflow w = new Workflow();
-
- Workflow otherWorkflow = new Workflow();
-
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- InputWorkflowPort iwp = new InputWorkflowPort();
- iwp.setParent(otherWorkflow);
-
- OutputWorkflowPort owp = new OutputWorkflowPort();
- owp.setParent(w);
-
- dataLink.setReceivesFrom(iwp);
- dataLink.setSendsTo(owp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dataLink) && nlp.getFieldName().equals("receivesFrom") && nlp.getValue().equals(iwp)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testOutOfScopeSendsTo() {
- Workflow w = new Workflow();
-
- Workflow otherWorkflow = new Workflow();
-
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- InputWorkflowPort iwp = new InputWorkflowPort();
- iwp.setParent(w);
-
- OutputWorkflowPort owp = new OutputWorkflowPort();
- owp.setParent(otherWorkflow);
-
- dataLink.setReceivesFrom(iwp);
- dataLink.setSendsTo(owp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dataLink) && nlp.getFieldName().equals("sendsTo") && nlp.getValue().equals(owp)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testInScopeProcessorPorts() {
- Workflow w = new Workflow();
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- Processor p1 = new Processor();
- p1.setParent(w);
-
- InputProcessorPort ipp = new InputProcessorPort();
- ipp.setParent(p1);
-
- Processor p2 = new Processor();
- p2.setParent(w);
-
- OutputProcessorPort opp = new OutputProcessorPort();
- opp.setParent(p2);
-
- dataLink.setReceivesFrom(opp);
- dataLink.setSendsTo(ipp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertEquals(Collections.EMPTY_SET, outOfScopeValueProblems);
- }
-
- @Test
- public void testOutOfScopeReceivesFromProcessorPort() {
- Workflow w = new Workflow();
- Workflow otherWorkflow = new Workflow();
-
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- Processor p1 = new Processor();
- p1.setParent(w);
-
- InputProcessorPort ipp = new InputProcessorPort();
- ipp.setParent(p1);
-
- Processor p2 = new Processor();
- p2.setParent(otherWorkflow);
-
- OutputProcessorPort opp = new OutputProcessorPort();
- opp.setParent(p2);
-
- dataLink.setReceivesFrom(opp);
- dataLink.setSendsTo(ipp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dataLink) && nlp.getFieldName().equals("receivesFrom") && nlp.getValue().equals(opp)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testOutOfScopeSendsToProcessorPort() {
- Workflow w = new Workflow();
- Workflow otherWorkflow = new Workflow();
-
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- Processor p1 = new Processor();
- p1.setParent(otherWorkflow);
-
- InputProcessorPort ipp = new InputProcessorPort();
- ipp.setParent(p1);
-
- Processor p2 = new Processor();
- p2.setParent(w);
-
- OutputProcessorPort opp = new OutputProcessorPort();
- opp.setParent(p2);
-
- dataLink.setReceivesFrom(opp);
- dataLink.setSendsTo(ipp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, true, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dataLink) && nlp.getFieldName().equals("sendsTo") && nlp.getValue().equals(ipp)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCorrectnessOfMergePositionSpecifiedIncorrectly() {
- Workflow w = new Workflow();
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- InputWorkflowPort iwp = new InputWorkflowPort();
- iwp.setParent(w);
-
- OutputWorkflowPort owp = new OutputWorkflowPort();
- owp.setParent(w);
-
- dataLink.setReceivesFrom(iwp);
- dataLink.setSendsTo(owp);
-
- Integer mergePosition = Integer.valueOf(-3);
- dataLink.setMergePosition(mergePosition);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(1, negativeValueProblems.size());
- if (!negativeValueProblems.isEmpty()) {
- NegativeValueProblem problem = negativeValueProblems.iterator().next();
- assertEquals(problem.getBean(), dataLink);
- assertEquals(problem.getFieldName(), "mergePosition");
- assertEquals(problem.getFieldValue(), mergePosition);
- }
- }
-
- @Test
- public void testCorrectnessOfMergePositionSpecifiedCorrectly() {
- Workflow w = new Workflow();
- DataLink dataLink = new DataLink();
- dataLink.setParent(w);
-
- InputWorkflowPort iwp = new InputWorkflowPort();
- iwp.setParent(w);
-
- OutputWorkflowPort owp = new OutputWorkflowPort();
- owp.setParent(w);
-
- dataLink.setReceivesFrom(iwp);
- dataLink.setSendsTo(owp);
-
- Integer mergePosition = Integer.valueOf(3);
- dataLink.setMergePosition(mergePosition);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dataLink, false, rcvl);
-
- Set<NegativeValueProblem> negativeValueProblems = rcvl.getNegativeValueProblems();
- assertEquals(Collections.EMPTY_SET, negativeValueProblems);
- }
-
-}
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/TestIterationStrategyStack.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyStack.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyStack.java
deleted file mode 100644
index 1be2a5c..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestIterationStrategyStack.java
+++ /dev/null
@@ -1,130 +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.PortMissingFromIterationStrategyStackProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestIterationStrategyStack {
-
- @Test
- public void testValidIterationStrategyStack() {
- 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);
-
- 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);
- iss.add(dp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, true, rcvl);
-
- Set<PortMissingFromIterationStrategyStackProblem> problems = rcvl.getPortMissingFromIterationStrategyStackProblems();
- assertEquals(Collections.EMPTY_SET, problems);
-
- }
-
- @Test
- public void testInvalidIterationStrategyStack() {
- 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);
-
- 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);
- dp.add(pNode2);
- iss.add(dp);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(p, true, rcvl);
-
- Set<PortMissingFromIterationStrategyStackProblem> problems = rcvl.getPortMissingFromIterationStrategyStackProblems();
- assertFalse(problems.isEmpty());
-
- boolean problem = false;
- for (PortMissingFromIterationStrategyStackProblem nlp : problems) {
- if (nlp.getPort().equals(p3) && nlp.getBean().equals(iss)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
-}