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:57 UTC
[72/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/TestTyped.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestTyped.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestTyped.java
deleted file mode 100644
index e35b58c..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestTyped.java
+++ /dev/null
@@ -1,145 +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.activity.Activity;
-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 TestTyped {
-
- @Test
- public void testCorrectnessOfMissingConfigurableType() {
- Activity a = new Activity();
- a.setType(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(a, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingConfigurableType() {
- Activity a = new Activity();
- a.setType(null);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(a, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(a) && nlp.getFieldName().equals("configurableType")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testCompletenessOfConfigurableType() throws URISyntaxException {
- Activity a = new Activity();
- a.setType(new URI("http://www.taverna.org.uk"));
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(a, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(a) && nlp.getFieldName().equals("configurableType")) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-
- @Test
- public void testNonAbsoluteURI() throws URISyntaxException {
- Activity a = new Activity();
- URI type = new URI("fred/soup");
- a.setType(type);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(a, false, rcvl);
-
- Set<NonAbsoluteURIProblem> problems = rcvl.getNonAbsoluteURIProblems();
- boolean problem = false;
- for (NonAbsoluteURIProblem p : problems) {
- if (p.getBean().equals(a) && p.getFieldName().equals("configurableType") && p.getFieldValue().equals(type)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testFileURI() throws URISyntaxException {
- Activity a = new Activity();
- URI type = new URI("file:///fred/soup");
- a.setType(type);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(a, false, rcvl);
-
- Set<NonAbsoluteURIProblem> problems = rcvl.getNonAbsoluteURIProblems();
- boolean problem = false;
- for (NonAbsoluteURIProblem p : problems) {
- if (p.getBean().equals(a) && p.getFieldName().equals("configurableType") && p.getFieldValue().equals(type)) {
- problem = true;
- }
- }
- assertTrue(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/TestWorkflow.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestWorkflow.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestWorkflow.java
deleted file mode 100644
index 33f80f5..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestWorkflow.java
+++ /dev/null
@@ -1,242 +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 java.util.TreeSet;
-
-import org.apache.taverna.scufl2.api.common.NamedSet;
-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.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 TestWorkflow {
-
- @Test
- public void testCorrectnessOfMissingFields() {
- DummyWorkflow dw = new DummyWorkflow();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingFields() {
- DummyWorkflow dw = new DummyWorkflow();
-
- 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("dataLinks")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("controlLinks")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("processors")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dw) && nlp.getFieldName().equals("workflowIdentifier")) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testCompletenessOfSpecifiedDataLinks() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setDataLinks(new TreeSet<DataLink>());
-
- 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("dataLinks")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-
- @Test
- public void testCompletenessOfSpecifiedControlLinks() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setControlLinks(new TreeSet<ControlLink>());
-
- 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("controlLinks")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-
- @Test
- public void testCompletenessOfSpecifiedProcessors() {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setProcessors(new NamedSet<Processor>());
-
- 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("processors")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-
- @Test
- public void testCompletenessOfSpecifiedWorkflowIdentifier() throws URISyntaxException {
- DummyWorkflow dw = new DummyWorkflow();
- dw.setIdentifier(new URI("http://www.mygrid.org.uk/fred/"));
-
- 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("workflowIdentifier")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testNonAbsoluteURI() throws URISyntaxException {
- DummyWorkflow dw = new DummyWorkflow();
- URI workflowIdentifier = new URI("fred/soup");
- dw.setIdentifier(workflowIdentifier);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, false, rcvl);
-
- Set<NonAbsoluteURIProblem> problems = rcvl.getNonAbsoluteURIProblems();
- boolean problem = false;
- for (NonAbsoluteURIProblem p : problems) {
- if (p.getBean().equals(dw) && p.getFieldName().equals("workflowIdentifier") && p.getFieldValue().equals(workflowIdentifier)) {
- problem = true;
- }
- }
- assertTrue(problem);
- }
-
- @Test
- public void testFileURI() throws URISyntaxException {
- DummyWorkflow dw = new DummyWorkflow();
- URI workflowIdentifier = new URI("file:///fred/soup");
- dw.setIdentifier(workflowIdentifier);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dw, false, rcvl);
-
- Set<NonAbsoluteURIProblem> problems = rcvl.getNonAbsoluteURIProblems();
- boolean problem = false;
- for (NonAbsoluteURIProblem p : problems) {
- if (p.getBean().equals(dw) && p.getFieldName().equals("workflowIdentifier") && p.getFieldValue().equals(workflowIdentifier)) {
- problem = true;
- }
- }
- assertTrue(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/TestWorkflowBundle.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestWorkflowBundle.java b/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestWorkflowBundle.java
deleted file mode 100644
index 3147fa0..0000000
--- a/taverna-scufl2-validation-correctness/src/test/java/org/apache/taverna/scufl2/validation/correctness/TestWorkflowBundle.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.common.NamedSet;
-import org.apache.taverna.scufl2.api.core.Workflow;
-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.NullFieldProblem;
-import org.apache.taverna.scufl2.validation.correctness.report.OutOfScopeValueProblem;
-import org.junit.Test;
-
-
-/**
- * @author alanrw
- *
- */
-public class TestWorkflowBundle {
-
- @Test
- public void testCorrectnessOfMissingFields() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, false, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertEquals(Collections.EMPTY_SET, nullFieldProblems);
- }
-
- @Test
- public void testCompletenessOfMissingFields() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
- assertFalse(nullFieldProblems.isEmpty());
-
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("profiles")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("workflows")) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("mainProfile")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("mainWorkflow")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedProfiles() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
- dwb.setProfiles(new NamedSet<Profile>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
-
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("profiles")) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testCompletenessOfSpecifiedWorkflows() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
- dwb.setWorkflows(new NamedSet<Workflow>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, true, rcvl);
-
- Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
-
- boolean problem = false;
- for (NullFieldProblem nlp : nullFieldProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("workflows")) {
- problem = true;
- }
- }
- assertFalse(problem);
- }
-
- @Test
- public void testOutOfScopeMainProfile() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
- Profile orphanProfile = new Profile();
- dwb.setMainProfile(orphanProfile);
- dwb.setProfiles(new NamedSet<Profile>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("mainProfile") && nlp.getValue().equals(orphanProfile)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testInScopeMainProfile() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
- Profile profile = new Profile();
- dwb.setMainProfile(profile);
- NamedSet<Profile> profiles = new NamedSet<Profile>();
- dwb.setProfiles(profiles);
- profiles.add(profile);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("mainProfile") && nlp.getValue().equals(profile)) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
- @Test
- public void testOutOfScopeMainWorkflow() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
- Workflow orphanWorkflow = new Workflow();
- dwb.setMainWorkflow(orphanWorkflow);
- dwb.setWorkflows(new NamedSet<Workflow>());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
- assertFalse(outOfScopeValueProblems.isEmpty());
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("mainWorkflow") && nlp.getValue().equals(orphanWorkflow)) {
- problem = true;
- }
- }
- assertTrue(problem);
-
- }
-
- @Test
- public void testInScopeMainWorkflow() {
- DummyWorkflowBundle dwb = new DummyWorkflowBundle();
- Workflow workflow = new Workflow();
- dwb.setMainWorkflow(workflow);
- NamedSet<Workflow> workflows = new NamedSet<Workflow>();
- dwb.setWorkflows(workflows);
- workflows.add(workflow);
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(dwb, false, rcvl);
-
- Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems();
-
- boolean problem = false;
- for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) {
- if (nlp.getBean().equals(dwb) && nlp.getFieldName().equals("mainWorkflow") && nlp.getValue().equals(workflow)) {
- problem = true;
- }
- }
- assertFalse(problem);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-integration/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-integration/pom.xml b/taverna-scufl2-validation-integration/pom.xml
deleted file mode 100644
index 388d53a..0000000
--- a/taverna-scufl2-validation-integration/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.language</groupId>
- <artifactId>taverna-language</artifactId>
- <version>0.15.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-scufl2-validation-integration</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Scufl 2 validation integration</name>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-t2flow</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-validation-correctness</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-validation-structural</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-scufl</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/scufl/Test172StarterPack.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/scufl/Test172StarterPack.java b/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/scufl/Test172StarterPack.java
deleted file mode 100644
index 4cf2a86..0000000
--- a/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/scufl/Test172StarterPack.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.apache.taverna.scufl2.validation.integration.scufl;
-/*
- *
- * 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.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.bind.JAXBException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.translator.scufl.ScuflParser;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.structural.ReportStructuralValidationListener;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
-
-/**
- * @author alanrw
- *
- */
-@RunWith(value = Parameterized.class)
-public class Test172StarterPack {
-
- private final static String WORKFLOW_LIST = "/t172starterpacklist";
-
- private ScuflParser parser;
-
- private final String url;
-
- public Test172StarterPack(String url) {
- this.url = url;
- }
-
- @Before
- public void makeParser() throws JAXBException {
- parser = new ScuflParser();
- parser.setValidating(false);
- parser.setStrict(false);
-
- }
-
- @Parameters
- public static List<Object[]> data() throws IOException {
- List<Object[]> result = new ArrayList<Object[]>();
- URL workflowListResource = Test172StarterPack.class
- .getResource(WORKFLOW_LIST);
- BufferedReader in = null;
- try {
- in = new BufferedReader(new InputStreamReader(
- workflowListResource.openStream()));
-
- String inputLine;
-
- while ((inputLine = in.readLine()) != null) {
- if (!inputLine.startsWith("#") && !inputLine.isEmpty()) {
- result.add(new Object[] { inputLine });
- }
- }
- } catch (IOException e) {
- // TODO
- } finally {
- if (in != null) {
- in.close();
- }
- }
- return result;
- }
-
- @Test
- public void testWorkflow() throws IOException, JAXBException,
- ReaderException {
- URL workflowURL = new URL(url);
- WorkflowBundle bundle = null;
- bundle = parser.parseScufl(workflowURL.openStream());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bundle, true, rcvl);
- assertEquals(Collections.EMPTY_SET,
- rcvl.getEmptyIterationStrategyTopNodeProblems());
- assertEquals(Collections.EMPTY_SET,
- rcvl.getIncompatibleGranularDepthProblems());
- assertEquals(Collections.EMPTY_SET,
- rcvl.getMismatchConfigurableTypeProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getNegativeValueProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getNonAbsoluteURIProblems());
-// FIXME assertEquals(Collections.EMPTY_SET, rcvl.getNullFieldProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getOutOfScopeValueProblems());
- assertEquals(Collections.EMPTY_SET,
- rcvl.getPortMentionedTwiceProblems());
- assertEquals(Collections.EMPTY_SET,
- rcvl.getPortMissingFromIterationStrategyStackProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getWrongParentProblems());
-
- StructuralValidator sv = new StructuralValidator();
- ReportStructuralValidationListener rsvl = new ReportStructuralValidationListener();
- sv.checkStructure(bundle, rsvl);
- assertEquals(Collections.EMPTY_SET,
- rsvl.getDotProductIterationMismatches());
- assertEquals(Collections.EMPTY_SET, rsvl.getEmptyCrossProducts());
- assertEquals(Collections.EMPTY_SET, rsvl.getEmptyDotProducts());
- assertEquals(Collections.EMPTY_SET, rsvl.getFailedProcessors());
- assertEquals(Collections.EMPTY_SET, rsvl.getIncompleteWorkflows());
- assertEquals(Collections.EMPTY_SET,
- rsvl.getMissingIterationStrategyStacks());
-// FIXME assertEquals(Collections.EMPTY_SET, rsvl.getMissingMainIncomingDataLinks());
- assertEquals(Collections.EMPTY_SET,
- rsvl.getUnrecognizedIterationStrategyNodes());
-// FIXME assertEquals(Collections.EMPTY_SET, rsvl.getUnresolvedOutputs());
- assertEquals(Collections.EMPTY_SET, rsvl.getUnresolvedProcessors());
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/t2flow/Test230StarterPack.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/t2flow/Test230StarterPack.java b/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/t2flow/Test230StarterPack.java
deleted file mode 100644
index 50aeb9b..0000000
--- a/taverna-scufl2-validation-integration/src/test/java/org/apache/taverna/scufl2/validation/integration/t2flow/Test230StarterPack.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.apache.taverna.scufl2.validation.integration.t2flow;
-/*
- *
- * 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.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.bind.JAXBException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.translator.t2flow.T2FlowParser;
-import org.apache.taverna.scufl2.validation.correctness.CorrectnessValidator;
-import org.apache.taverna.scufl2.validation.correctness.ReportCorrectnessValidationListener;
-import org.apache.taverna.scufl2.validation.structural.ReportStructuralValidationListener;
-import org.apache.taverna.scufl2.validation.structural.StructuralValidator;
-
-/**
- * @author alanrw
- *
- */
-@RunWith(value = Parameterized.class)
-public class Test230StarterPack {
-
- private final static String WORKFLOW_LIST = "/t230starterpacklist";
-
- private T2FlowParser parser;
-
- private final String url;
-
- public Test230StarterPack(String url) {
- this.url = url;
- }
-
- @Before
- public void makeParser() throws JAXBException {
- parser = new T2FlowParser();
- parser.setValidating(true);
- parser.setStrict(true);
-
- }
-
- @Parameters
- public static List<Object[]> data() throws IOException {
- List<Object[]> result = new ArrayList<Object[]>();
- URL workflowListResource = Test230StarterPack.class.getResource(WORKFLOW_LIST);
- BufferedReader in = null;
- try {
- in = new BufferedReader(new InputStreamReader(
- workflowListResource.openStream()));
-
- String inputLine;
-
- while ((inputLine = in.readLine()) != null) {
- if (!inputLine.startsWith("#") && !inputLine.isEmpty()) {
- result.add(new Object[] {inputLine});
- }
- }
- }
- catch (IOException e) {
- // TODO
- }
- finally {
- if (in != null) {
- in.close();
- }
- }
- return result;
- }
-
- @Test
- public void testWorkflow() throws IOException, JAXBException,
- ReaderException {
- URL workflowURL = new URL(url);
- WorkflowBundle bundle = null;
- bundle = parser.parseT2Flow(workflowURL.openStream());
-
- CorrectnessValidator cv = new CorrectnessValidator();
- ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
-
- cv.checkCorrectness(bundle, true, rcvl);
- assertEquals(Collections.EMPTY_SET, rcvl.getEmptyIterationStrategyTopNodeProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getIncompatibleGranularDepthProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getMismatchConfigurableTypeProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getNegativeValueProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getNonAbsoluteURIProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getNullFieldProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getOutOfScopeValueProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getPortMentionedTwiceProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getPortMissingFromIterationStrategyStackProblems());
- assertEquals(Collections.EMPTY_SET, rcvl.getWrongParentProblems());
-
- StructuralValidator sv = new StructuralValidator();
- ReportStructuralValidationListener rsvl = new ReportStructuralValidationListener();
- sv.checkStructure(bundle, rsvl);
- assertEquals(Collections.EMPTY_SET, rsvl.getDotProductIterationMismatches());
- assertEquals(Collections.EMPTY_SET, rsvl.getEmptyCrossProducts());
- assertEquals(Collections.EMPTY_SET, rsvl.getEmptyDotProducts());
- assertEquals(Collections.EMPTY_SET, rsvl.getFailedProcessors());
- assertEquals(Collections.EMPTY_SET, rsvl.getIncompleteWorkflows());
- assertEquals(Collections.EMPTY_SET, rsvl.getMissingIterationStrategyStacks());
- assertEquals(Collections.EMPTY_SET, rsvl.getMissingMainIncomingDataLinks());
- assertEquals(Collections.EMPTY_SET, rsvl.getUnrecognizedIterationStrategyNodes());
- assertEquals(Collections.EMPTY_SET, rsvl.getUnresolvedOutputs());
- assertEquals(Collections.EMPTY_SET, rsvl.getUnresolvedProcessors());
-
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-integration/src/test/resources/t172starterpacklist
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-integration/src/test/resources/t172starterpacklist b/taverna-scufl2-validation-integration/src/test/resources/t172starterpacklist
deleted file mode 100644
index 35358b0..0000000
--- a/taverna-scufl2-validation-integration/src/test/resources/t172starterpacklist
+++ /dev/null
@@ -1 +0,0 @@
-http://www.myexperiment.org/workflows/157/download/example_of_a_conditional_execution_workflow_7882.xml?version=1
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-integration/src/test/resources/t230starterpacklist
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-integration/src/test/resources/t230starterpacklist b/taverna-scufl2-validation-integration/src/test/resources/t230starterpacklist
deleted file mode 100644
index b03b4c6..0000000
--- a/taverna-scufl2-validation-integration/src/test/resources/t230starterpacklist
+++ /dev/null
@@ -1,30 +0,0 @@
-#Here is the starter pack
-http://www.myexperiment.org/workflows/2254/download/secure_web_service_call_example_565494.t2flow?version=1
-http://www.myexperiment.org/workflows/2253/download/secure_rest_service_call_example_19600.t2flow?version=1
-http://www.myexperiment.org/workflows/2231/download/numerically_adding_two_values._763485.t2flow?version=1
-http://www.myexperiment.org/workflows/2230/download/example_for_external_tools_with_zip_and_unzip_57117.t2flow?version=1
-http://www.myexperiment.org/workflows/2229/download/unix_tool_service_using_string_replacement_219870.t2flow?version=1
-http://www.myexperiment.org/workflows/2226/download/a_workflow_version_of_the_emboss_tutorial_602335.t2flow?version=1
-#http://www.myexperiment.org/workflows/2225/download/biomoby_tutorial_workflow_822226.t2flow?version=1
-http://www.myexperiment.org/workflows/2224/download/demonstration_of_configurable_iteration_687594.t2flow?version=1
-http://www.myexperiment.org/workflows/2223/download/fetch_pdb_flatfile_from_rcsb_server_969158.t2flow?version=1
-http://www.myexperiment.org/workflows/2222/download/fetch_today_s_xkcd_comic_451319.t2flow?version=1
-http://www.myexperiment.org/workflows/2221/download/gbseq_test_330068.t2flow?version=1
-http://www.myexperiment.org/workflows/2220/download/pipelined_list_iteration_106641.t2flow?version=1
-http://www.myexperiment.org/workflows/2219/download/retrieve_sequence_in_embl_format_491484.t2flow?version=1
-http://www.myexperiment.org/workflows/2218/download/spreadsheet_import_example_392470.t2flow?version=1
-#http://www.myexperiment.org/workflows/2217/download/fetch_dragon_images_from_biomoby_210389.t2flow?version=1
-http://www.myexperiment.org/workflows/2216/download/multiple_choice_quiz_541689.t2flow?version=1
-http://www.myexperiment.org/workflows/2215/download/example_workflow_for_rest_and_xpath_activities_912889.t2flow?version=1
-http://www.myexperiment.org/workflows/2214/download/ebi_interproscan_newservices_702837.t2flow?version=1
-http://www.myexperiment.org/workflows/2213/download/biomartandembossdisease_841605.t2flow?version=1
-
-#Here are the secured workflows
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-basic-authentication.t2flow?version=2&modificationDate=1308826501000
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-basic-authentication-https.t2flow?version=2&modificationDate=1308826501000
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-digest-authentication.t2flow?version=2&modificationDate=1308826485000
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-digest-authentication-https.t2flow?version=2&modificationDate=1308826485000
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-ws.t2flow?version=2&modificationDate=1308826485000
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-ws-https.t2flow?version=2&modificationDate=1308826485000
-http://www.mygrid.org.uk/dev/wiki/download/attachments/6652086/secure-client-cert-authentication-https.t2flow?version=1&modificationDate=1308826485000
-
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/pom.xml b/taverna-scufl2-validation-structural/pom.xml
deleted file mode 100644
index ee34ebc..0000000
--- a/taverna-scufl2-validation-structural/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.taverna.language</groupId>
- <artifactId>taverna-language</artifactId>
- <version>0.15.0-incubating-SNAPSHOT</version>
- </parent>
- <artifactId>taverna-scufl2-validation-structural</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Taverna Scufl 2 validation structural</name>
- <description>Code to check that the SCUFL 2 could run as a valid workflow.
- This is separate from checking the activities within the SCUFL 2 are
- "live"
- </description>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-validation</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>taverna-scufl2-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/DefaultStructuralValidationListener.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/DefaultStructuralValidationListener.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/DefaultStructuralValidationListener.java
deleted file mode 100644
index 1f1f9c9..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/DefaultStructuralValidationListener.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.structural;
-/*
- *
- * 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.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.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.validation.ValidationException;
-
-
-/**
- * @author alanrw
- */
-public class DefaultStructuralValidationListener implements
- StructuralValidationListener {
- @Override
- public void dataLinkReceiver(DataLink dl) {
- }
-
- @Override
- public void dataLinkSender(DataLink dl) {
- }
-
- @Override
- public void depthResolution(WorkflowBean owp, Integer portResolvedDepth) {
- }
-
- @Override
- public void dotProductIterationMismatch(DotProduct dotProduct) {
- }
-
- @Override
- public void emptyCrossProduct(CrossProduct crossProduct) {
- }
-
- @Override
- public void emptyDotProduct(DotProduct dotProduct) {
- }
-
- @Override
- public void failedProcessorAdded(Processor p) {
- }
-
- @Override
- public void incompleteWorkflow(Workflow w) {
- }
-
- @Override
- public void missingIterationStrategyStack(Processor p) {
- }
-
- @Override
- public void missingMainIncomingLink(ReceiverPort owp) {
- }
-
- @Override
- public void passedProcessor(Processor p) {
- }
-
- @Override
- public void unrecognizedIterationStrategyNode(
- IterationStrategyNode iterationStrategyNode) {
- }
-
- @Override
- public void unresolvedOutput(OutputWorkflowPort owp) {
- }
-
- @Override
- public void unresolvedProcessorAdded(Processor p) {
- }
-
- @Override
- public boolean detectedProblems() {
- return false;
- }
-
- @Override
- public ValidationException getException() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ReportStructuralValidationListener.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ReportStructuralValidationListener.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ReportStructuralValidationListener.java
deleted file mode 100644
index 60ead09..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ReportStructuralValidationListener.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.structural;
-/*
- *
- * 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.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-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.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.validation.ValidationException;
-
-
-/**
- * @author alanrw
- */
-public class ReportStructuralValidationListener extends
- DefaultStructuralValidationListener {
- private Map<SenderPort, List<DataLink>> senderDataLinkMap = new HashMap<>();
- private Map<ReceiverPort, List<DataLink>> receiverDataLinkMap = new HashMap<>();
- private Map<WorkflowBean, Integer> resolvedDepthMap = new HashMap<>();
- private Set<DotProduct> dotProductIterationMismatches = new HashSet<>();
- private Set<CrossProduct> emptyCrossProducts = new HashSet<>();
- private Set<DotProduct> emptyDotProducts = new HashSet<>();
- private Set<Processor> failedProcessors = new HashSet<>();
- private Set<Workflow> incompleteWorkflows = new HashSet<>();
- private Set<Processor> missingIterationStrategyStacks = new HashSet<>();
- private Set<ReceiverPort> missingMainIncomingDataLinks = new HashSet<>();
- private Set<Processor> passedProcessors = new HashSet<>();
- private Set<IterationStrategyNode> unrecognizedIterationStrategyNodes = new HashSet<>();
- private Set<OutputWorkflowPort> unresolvedOutputs = new HashSet<>();
- private Set<Processor> unresolvedProcessors = new HashSet<>();
-
- @Override
- public void dataLinkReceiver(DataLink dl) {
- ReceiverPort receiver = dl.getSendsTo();
- if (receiver != null) {
- if (!receiverDataLinkMap.containsKey(receiver))
- receiverDataLinkMap.put(receiver, new ArrayList<DataLink>());
- receiverDataLinkMap.get(receiver).add(dl);
- }
- }
-
- @Override
- public void dataLinkSender(DataLink dl) {
- SenderPort sender = dl.getReceivesFrom();
- if (sender != null) {
- if (!senderDataLinkMap.containsKey(sender))
- senderDataLinkMap.put(sender, new ArrayList<DataLink>());
- senderDataLinkMap.get(sender).add(dl);
- }
- }
-
- @Override
- public void depthResolution(WorkflowBean owp, Integer portResolvedDepth) {
- resolvedDepthMap.put(owp, portResolvedDepth);
- }
-
- @Override
- public void dotProductIterationMismatch(DotProduct dotProduct) {
- dotProductIterationMismatches.add(dotProduct);
- }
-
- @Override
- public void emptyCrossProduct(CrossProduct crossProduct) {
- emptyCrossProducts.add(crossProduct);
- }
-
- @Override
- public void emptyDotProduct(DotProduct dotProduct) {
- emptyDotProducts.add(dotProduct);
- }
-
- @Override
- public void failedProcessorAdded(Processor p) {
- failedProcessors.add(p);
- }
-
- @Override
- public void incompleteWorkflow(Workflow w) {
- incompleteWorkflows.add(w);
- }
-
- /**
- * @return
- */
- public Set<Workflow> getIncompleteWorkflows() {
- return incompleteWorkflows;
- }
-
- @Override
- public void missingIterationStrategyStack(Processor p) {
- missingIterationStrategyStacks.add(p);
- }
-
- @Override
- public void missingMainIncomingLink(ReceiverPort owp) {
- missingMainIncomingDataLinks.add(owp);
- }
-
- @Override
- public void passedProcessor(Processor p) {
- passedProcessors.add(p);
- }
-
- @Override
- public void unrecognizedIterationStrategyNode(
- IterationStrategyNode iterationStrategyNode) {
- unrecognizedIterationStrategyNodes.add(iterationStrategyNode);
- }
-
- @Override
- public void unresolvedOutput(OutputWorkflowPort owp) {
- unresolvedOutputs.add(owp);
- }
-
- @Override
- public void unresolvedProcessorAdded(Processor p) {
- unresolvedProcessors.add(p);
- }
-
- /**
- * @return the dotProductIterationMismatches
- */
- public Set<DotProduct> getDotProductIterationMismatches() {
- return dotProductIterationMismatches;
- }
-
- /**
- * @return the emptyCrossProducts
- */
- public Set<CrossProduct> getEmptyCrossProducts() {
- return emptyCrossProducts;
- }
-
- /**
- * @return the emptyDotProducts
- */
- public Set<DotProduct> getEmptyDotProducts() {
- return emptyDotProducts;
- }
-
- /**
- * @return the failedProcessors
- */
- public Set<Processor> getFailedProcessors() {
- return failedProcessors;
- }
-
- /**
- * @return the missingIterationStrategyStacks
- */
- public Set<Processor> getMissingIterationStrategyStacks() {
- return missingIterationStrategyStacks;
- }
-
- /**
- * @return the missingMainIncomingDataLinks
- */
- public Set<ReceiverPort> getMissingMainIncomingDataLinks() {
- return missingMainIncomingDataLinks;
- }
-
- /**
- * @return the unrecognizedIterationStrategyNodes
- */
- public Set<IterationStrategyNode> getUnrecognizedIterationStrategyNodes() {
- return unrecognizedIterationStrategyNodes;
- }
-
- /**
- * @return the unresolvedOutputs
- */
- public Set<OutputWorkflowPort> getUnresolvedOutputs() {
- return unresolvedOutputs;
- }
-
- /**
- * @return the unresolvedProcessors
- */
- public Set<Processor> getUnresolvedProcessors() {
- return unresolvedProcessors;
- }
-
- @Override
- public boolean detectedProblems() {
- return !(dotProductIterationMismatches.isEmpty()
- && emptyCrossProducts.isEmpty() && emptyDotProducts.isEmpty()
- && failedProcessors.isEmpty() && incompleteWorkflows.isEmpty()
- && missingIterationStrategyStacks.isEmpty()
- && missingMainIncomingDataLinks.isEmpty()
- && unrecognizedIterationStrategyNodes.isEmpty()
- && unresolvedOutputs.isEmpty() && unresolvedProcessors
- .isEmpty());
- }
-
- @Override
- public ValidationException getException() {
- if (!detectedProblems())
- return null;
- return new ValidationException(this.toString());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidationListener.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidationListener.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidationListener.java
deleted file mode 100644
index a6dd898..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidationListener.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.taverna.scufl2.validation.structural;
-/*
- *
- * 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.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.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.validation.ValidationReport;
-
-
-public interface StructuralValidationListener extends ValidationReport {
- void passedProcessor(Processor p);
-
- void failedProcessorAdded(Processor p);
-
- void unresolvedProcessorAdded(Processor p);
-
- void missingMainIncomingLink(ReceiverPort owp);
-
- void unresolvedOutput(OutputWorkflowPort owp);
-
- void depthResolution(WorkflowBean owp, Integer portResolvedDepth);
-
- void missingIterationStrategyStack(Processor p);
-
- void emptyDotProduct(DotProduct dotProduct);
-
- void dotProductIterationMismatch(DotProduct dotProduct);
-
- void emptyCrossProduct(CrossProduct crossProduct);
-
- void dataLinkSender(DataLink dl);
-
- void dataLinkReceiver(DataLink dl);
-
- void unrecognizedIterationStrategyNode(
- IterationStrategyNode iterationStrategyNode);
-
- void incompleteWorkflow(Workflow w);
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidator.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidator.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidator.java
deleted file mode 100644
index 7ed5978..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/StructuralValidator.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.structural;
-/*
- *
- * 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.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-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.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-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.Validator;
-
-
-/**
- * @author alanrw
- */
-public final class StructuralValidator implements
- Validator<StructuralValidationListener> {
- private static enum ProcessorCheckStatus {
- COULD_NOT_CHECK, PASSED, FAILED
- };
-
- protected ThreadLocal<ValidatorState> validatorState = new ThreadLocal<ValidatorState>() {
- @Override
- protected ValidatorState initialValue() {
- return new ValidatorState();
- };
- };
-
- public void checkStructure(WorkflowBundle bundle,
- StructuralValidationListener eventListener) {
- validatorState.get().setEventListener(eventListener);
- validatorState.get().setWorkflowBundle(bundle);
- for (Workflow w : bundle.getWorkflows())
- checkStructure(w);
- }
-
- public ValidatorState getValidatorState() {
- return validatorState.get();
- }
-
- public void checkStructure(Workflow workflow,
- StructuralValidationListener eventListener) {
- validatorState.get().setEventListener(eventListener);
- checkStructure(workflow);
- }
-
- private void checkStructure(Workflow workflow) {
- validatorState.get().setWorkflow(workflow);
- validateWorkflow();
- }
-
- private void validateWorkflow() {
- clearWorkflowData();
- rememberDataLinkConnections();
- inheritDataLinkDepthsFromWorkflowInputPorts();
- checkProcessors();
- checkWorkflowOutputPorts();
- checkCompleteness();
- }
-
- private void clearWorkflowData() {
- validatorState.get().clearWorkflowData();
- }
-
- private void checkCompleteness() {
- Workflow w = validatorState.get().getWorkflow();
- if (w.getProcessors().isEmpty() && w.getOutputPorts().isEmpty()) {
- validatorState.get().getEventListener().incompleteWorkflow(w);
- // validatorState.get().addIncompleteWorkflow(w);
- }
- }
-
- private void checkProcessors() {
- Workflow workflow = validatorState.get().getWorkflow();
- List<Processor> failedProcessors = new ArrayList<>();
- List<Processor> unresolvedProcessors = new ArrayList<>();
- unresolvedProcessors.addAll(workflow.getProcessors());
-
- boolean finished = false;
- while (!finished) {
- // We're finished unless something happens later
- finished = true;
- /*
- * Keep a list of processors to remove from the unresolved list
- * because they've been resolved properly
- */
- List<Processor> removeValidated = new ArrayList<>();
- // Keep another list of those that have failed
- List<Processor> removeFailed = new ArrayList<>();
-
- for (Processor p : unresolvedProcessors) {
- validatorState.get().setProcessor(p);
- ProcessorCheckStatus entityValid = checkProcessor();
- switch (entityValid) {
- case PASSED:
- validatorState.get().getEventListener().passedProcessor(p);
- // validatorState.get().addPassedProcessor(p);
- removeValidated.add(p);
- break;
- case FAILED:
- validatorState.get().getEventListener()
- .failedProcessorAdded(p);
- // validatorState.get().failCurrentProcessor();
- removeFailed.add(p);
- break;
- case COULD_NOT_CHECK:
- break;
- }
- }
-
- /*
- * Remove validated and failed items from the pending lists. If
- * anything was removed because it validated okay then we're not
- * finished yet and should reset the boolean finished flag
- */
- if (!removeValidated.isEmpty()) {
- unresolvedProcessors.removeAll(removeValidated);
- finished = false;
- }
- unresolvedProcessors.removeAll(failedProcessors);
- }
- for (Processor p : unresolvedProcessors)
- validatorState.get().getEventListener().unresolvedProcessorAdded(p);
- // validatorState.get().addUnresolvedProcessors(unresolvedProcessors);
- }
-
- private void checkWorkflowOutputPorts() {
- for (OutputWorkflowPort owp : validatorState.get().getWorkflow()
- .getOutputPorts()) {
- DataLink mainIncomingLink = validatorState.get()
- .getMainIncomingDataLink(owp);
- if (mainIncomingLink == null) {
- validatorState.get().getEventListener()
- .missingMainIncomingLink(owp);
- // validatorState.get().addMissingMainIncomingDataLink(owp);
- }
- Integer dataLinkResolvedDepth = validatorState.get()
- .getDataLinkResolvedDepth(mainIncomingLink);
- if (dataLinkResolvedDepth == null) {
- validatorState.get().getEventListener().unresolvedOutput(owp);
- // validatorState.get().addUnresolvedOutput(owp);
- return;
- }
-
- // int granularDepth =
- // mainIncomingLink.getSource().getGranularDepth();
- Integer portResolvedDepth = dataLinkResolvedDepth
- + (validatorState.get().isMergedPort(owp) ? 1 : 0);
- validatorState.get().getEventListener()
- .depthResolution(owp, portResolvedDepth);
- validatorState.get().setPortResolvedDepth(owp, portResolvedDepth);
- // dopi.setDepths(resolvedDepth, granularDepth);
- }
- }
-
- private ProcessorCheckStatus checkProcessor() {
- Processor p = validatorState.get().getProcessor();
- Map<InputProcessorPort, Integer> inputDepths = new HashMap<>();
- // Check whether all our input ports have inbound links
- for (InputProcessorPort input : p.getInputPorts()) {
- DataLink mainIncomingLink = validatorState.get()
- .getMainIncomingDataLink(input);
- if (mainIncomingLink == null) {
- validatorState.get().getEventListener()
- .missingMainIncomingLink(input);
- // validatorState.get().addMissingMainIncomingDataLink(input);
- return ProcessorCheckStatus.FAILED;
- }
- Integer dataLinkResolvedDepth = validatorState.get()
- .getDataLinkResolvedDepth(mainIncomingLink);
- if (dataLinkResolvedDepth == null)
- return ProcessorCheckStatus.COULD_NOT_CHECK;
-
- Integer resolvedDepth = dataLinkResolvedDepth
- + (validatorState.get().isMergedPort(input) ? 1 : 0);
- validatorState.get().getEventListener()
- .depthResolution(input, resolvedDepth);
- validatorState.get().setPortResolvedDepth(input, resolvedDepth);
- inputDepths.put(input, resolvedDepth);
- }
-
- Integer resultWrappingDepth = calculateResultWrappingDepth(inputDepths);
- if (resultWrappingDepth == null)
- return ProcessorCheckStatus.FAILED;
-
- for (OutputProcessorPort output : p.getOutputPorts()) {
- Integer portDepth = output.getDepth();
- Integer resolvedDepth = portDepth + resultWrappingDepth;
- validatorState.get().getEventListener()
- .depthResolution(output, resolvedDepth);
- validatorState.get().setPortResolvedDepth(output, resolvedDepth);
- for (DataLink dl : validatorState.get()
- .getOutgoingDataLinks(output)) {
- validatorState.get().getEventListener()
- .depthResolution(dl, resolvedDepth);
- validatorState.get()
- .setDataLinkResolvedDepth(dl, resolvedDepth);
- }
- }
-
- return ProcessorCheckStatus.PASSED;
- }
-
- Integer calculateResultWrappingDepth(
- Map<InputProcessorPort, Integer> inputDepths) {
- Processor p = validatorState.get().getProcessor();
- IterationStrategyStack iss = p.getIterationStrategyStack();
- if (iss == null) {
- validatorState.get().getEventListener()
- .missingIterationStrategyStack(p);
- // validatorState.get().addMissingIterationStrategyStack(p);
- validatorState.get().getEventListener().failedProcessorAdded(p);
- // validatorState.get().failCurrentProcessor();
- return null;
- }
-
- if (iss.isEmpty())
- return 0;
- IterationStrategyTopNode iterationStrategyTopNode = iss.get(0);
- Integer depth = getIterationDepth(iterationStrategyTopNode, inputDepths);
- if (depth == null)
- return null;
- IterationStrategyTopNode previousNode = iterationStrategyTopNode;
- for (int index = 1; index < iss.size(); index++) {
- /*
- * Construct the input depths for the staged iteration strategies
- * after the first one by looking at the previous iteration
- * strategy's desired cardinalities on its input ports.
- */
- Map<InputProcessorPort, Integer> stagedInputDepths = getDesiredCardinalities(previousNode);
- iterationStrategyTopNode = iss.get(index);
- Integer nodeDepth = getIterationDepth(iterationStrategyTopNode,
- stagedInputDepths);
- if (nodeDepth == null)
- return null;
- depth += nodeDepth;
- previousNode = iterationStrategyTopNode;
- }
- return depth;
- }
-
- private Map<InputProcessorPort, Integer> getDesiredCardinalities(
- IterationStrategyTopNode iterationStrategyTopNode) {
- Map<InputProcessorPort, Integer> desiredCardinalities = new HashMap<>();
- fillInDesiredCardinalities(iterationStrategyTopNode,
- desiredCardinalities);
- return desiredCardinalities;
- }
-
- private void fillInDesiredCardinalities(
- IterationStrategyNode iterationStrategyNode,
- Map<InputProcessorPort, Integer> desiredCardinalities) {
- if (iterationStrategyNode instanceof IterationStrategyTopNode)
- for (IterationStrategyNode subNode : (IterationStrategyTopNode) iterationStrategyNode)
- fillInDesiredCardinalities(subNode, desiredCardinalities);
- else if (iterationStrategyNode instanceof PortNode) {
- PortNode portNode = (PortNode) iterationStrategyNode;
- desiredCardinalities.put(portNode.getInputProcessorPort(),
- portNode.getDesiredDepth());
- }
- }
-
- public Integer getIterationDepth(
- IterationStrategyNode iterationStrategyNode,
- Map<InputProcessorPort, Integer> inputDepths) {
- if (iterationStrategyNode instanceof CrossProduct)
- return getCrossProductIterationDepth(
- (CrossProduct) iterationStrategyNode, inputDepths);
- if (iterationStrategyNode instanceof DotProduct)
- return getDotProductIterationDepth(
- (DotProduct) iterationStrategyNode, inputDepths);
- if (iterationStrategyNode instanceof PortNode)
- return getPortNodeIterationDepth((PortNode) iterationStrategyNode,
- inputDepths);
- validatorState.get().getEventListener()
- .unrecognizedIterationStrategyNode(iterationStrategyNode);
- // validatorState.get().addUnrecognizedIterationStrategyNode(iterationStrategyNode);
- validatorState.get().getEventListener()
- .failedProcessorAdded(validatorState.get().getProcessor());
- // validatorState.get().failCurrentProcessor();
- return null;
- }
-
- private Integer getPortNodeIterationDepth(PortNode portNode,
- Map<InputProcessorPort, Integer> inputDepths) {
- int myInputDepth = inputDepths.get(portNode.getInputProcessorPort());
- int depthMismatch = myInputDepth - portNode.getDesiredDepth();
- return (depthMismatch > 0 ? depthMismatch : 0);
- }
-
- public Integer getDotProductIterationDepth(DotProduct dotProduct,
- Map<InputProcessorPort, Integer> inputDepths) {
- if (dotProduct.isEmpty()) {
- validatorState.get().getEventListener().emptyDotProduct(dotProduct);
- // validatorState.get().addEmptyDotProduct(dotProduct);
- validatorState.get().getEventListener()
- .failedProcessorAdded(validatorState.get().getProcessor());
- // validatorState.get().failCurrentProcessor();
- return null;
- }
- Integer depth = getIterationDepth(dotProduct.get(0), inputDepths);
- if (depth == null)
- return null;
- for (IterationStrategyNode childNode : dotProduct) {
- Integer childNodeDepth = getIterationDepth(childNode, inputDepths);
- if (childNodeDepth == null)
- return null;
- if (!childNodeDepth.equals(depth)) {
- validatorState.get().getEventListener()
- .dotProductIterationMismatch(dotProduct);
- // validatorState.get().addDotProductIterationMismatch(dotProduct);
- validatorState
- .get()
- .getEventListener()
- .failedProcessorAdded(
- validatorState.get().getProcessor());
- // validatorState.get().failCurrentProcessor();
- return null;
- }
- }
- return depth;
- }
-
- private Integer getCrossProductIterationDepth(CrossProduct crossProduct,
- Map<InputProcessorPort, Integer> inputDepths) {
- if (crossProduct.isEmpty()) {
- validatorState.get().getEventListener()
- .emptyCrossProduct(crossProduct);
- // validatorState.get().addEmptyCrossProduct(crossProduct);
- validatorState.get().getEventListener()
- .failedProcessorAdded(validatorState.get().getProcessor());
- // validatorState.get().failCurrentProcessor();
- return null;
- }
- int temp = 0;
- for (IterationStrategyNode child : crossProduct) {
- Integer childNodeDepth = getIterationDepth(child, inputDepths);
- if (childNodeDepth == null)
- return null;
- temp += childNodeDepth;
- }
- return temp;
- }
-
- private void rememberDataLinkConnections() {
- Workflow workflow = validatorState.get().getWorkflow();
- for (DataLink dl : workflow.getDataLinks()) {
- validatorState.get().getEventListener().dataLinkSender(dl);
- validatorState.get().rememberDataLinkSender(dl);
- validatorState.get().getEventListener().dataLinkReceiver(dl);
- validatorState.get().rememberDataLinkReceiver(dl);
- }
- }
-
- private void inheritDataLinkDepthsFromWorkflowInputPorts() {
- Workflow workflow = validatorState.get().getWorkflow();
- for (InputWorkflowPort iwp : workflow.getInputPorts()) {
- Integer iwpDepth = iwp.getDepth();
- validatorState.get().getEventListener()
- .depthResolution(iwp, iwpDepth);
- validatorState.get().setPortResolvedDepth(iwp, iwpDepth);
- for (DataLink dl : validatorState.get().getOutgoingDataLinks(iwp)) {
- validatorState.get().getEventListener()
- .depthResolution(dl, iwpDepth);
- validatorState.get().setDataLinkResolvedDepth(dl, iwpDepth);
- }
- }
- }
-
- @Override
- public StructuralValidationListener validate(WorkflowBundle workflowBundle) {
- StructuralValidationListener l = new ReportStructuralValidationListener();
- this.checkStructure(workflowBundle, l);
- return l;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ValidatorState.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ValidatorState.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ValidatorState.java
deleted file mode 100644
index 66bec9a..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/ValidatorState.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.structural;
-/*
- *
- * 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 java.util.Collections.emptyList;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-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.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-
-/**
- * @author alanrw
- */
-public class ValidatorState {
- private WorkflowBundle workflowBundle;
- private Workflow workflow;
- private Profile profile;
- private Processor processor;
- private Map<DataLink, Integer> dataLinkResolvedDepthMap = new HashMap<>();
- private Map<SenderPort, List<DataLink>> senderDataLinkMap = new HashMap<>();
- private Map<ReceiverPort, List<DataLink>> receiverDataLinkMap = new HashMap<>();
- private Map<Port, Integer> portResolvedDepthMap = new HashMap<>();
- private StructuralValidationListener eventListener = new DefaultStructuralValidationListener();
-
- public void setWorkflowBundle(WorkflowBundle workflowBundle) {
- this.workflowBundle = workflowBundle;
- }
-
- public void setWorkflow(Workflow workflow) {
- this.workflow = workflow;
- }
-
- public WorkflowBundle getWorkflowBundle() {
- return workflowBundle;
- }
-
- public Workflow getWorkflow() {
- return workflow;
- }
-
- public Profile getProfile() {
- return profile;
- }
-
- public void setDataLinkResolvedDepth(DataLink dl, Integer i) {
- dataLinkResolvedDepthMap.put(dl, i);
- }
-
- public Integer getDataLinkResolvedDepth(DataLink dl) {
- return dataLinkResolvedDepthMap.get(dl);
- }
-
- public void rememberDataLinkSender(DataLink dl) {
- SenderPort sender = dl.getReceivesFrom();
- if (sender != null) {
- if (!senderDataLinkMap.containsKey(sender))
- senderDataLinkMap.put(sender, new ArrayList<DataLink>());
- senderDataLinkMap.get(sender).add(dl);
- }
- }
-
- public void rememberDataLinkReceiver(DataLink dl) {
- ReceiverPort receiver = dl.getSendsTo();
- if (receiver != null) {
- if (!receiverDataLinkMap.containsKey(receiver))
- receiverDataLinkMap.put(receiver, new ArrayList<DataLink>());
- receiverDataLinkMap.get(receiver).add(dl);
- }
- }
-
- public List<DataLink> getOutgoingDataLinks(SenderPort iwp) {
- List<DataLink> result = senderDataLinkMap.get(iwp);
- if (result == null)
- result = emptyList();
- return result;
- }
-
- public List<DataLink> getIncomingDataLinks(ReceiverPort rp) {
- List<DataLink> result = receiverDataLinkMap.get(rp);
- if (result == null)
- result = emptyList();
- return result;
- }
-
- public DataLink getMainIncomingDataLink(ReceiverPort rp) {
- List<DataLink> incomingLinks = getIncomingDataLinks(rp);
- if (incomingLinks.isEmpty())
- return null;
- if (incomingLinks.size() == 1)
- return incomingLinks.get(0);
- for (DataLink dl : incomingLinks)
- if (dl.getMergePosition() == 0)
- return dl;
- return null;
- }
-
- public boolean isMergedPort(ReceiverPort rp) {
- return getIncomingDataLinks(rp).size() > 1;
- }
-
- public void setPortResolvedDepth(Port owp, Integer i) {
- portResolvedDepthMap.put(owp, i);
- }
-
- public Integer getPortResolvedDepth(Port p) {
- return portResolvedDepthMap.get(p);
- }
-
- public void setProcessor(Processor p) {
- this.processor = p;
- }
-
- public Processor getProcessor() {
- return this.processor;
- }
-
- public void setEventListener(StructuralValidationListener eventListener) {
- this.eventListener = eventListener;
- }
-
- public StructuralValidationListener getEventListener() {
- return eventListener;
- }
-
- public void clearWorkflowData() {
- for (DataLink dl : workflow.getDataLinks())
- dataLinkResolvedDepthMap.remove(dl);
- for (InputWorkflowPort iwp : workflow.getInputPorts()) {
- senderDataLinkMap.remove(iwp);
- portResolvedDepthMap.remove(iwp);
- }
- for (Processor p : workflow.getProcessors()) {
- for (InputProcessorPort ipp : p.getInputPorts()) {
- portResolvedDepthMap.remove(ipp);
- receiverDataLinkMap.remove(ipp);
- }
- for (OutputProcessorPort opp : p.getOutputPorts()) {
- portResolvedDepthMap.remove(opp);
- senderDataLinkMap.remove(opp);
- }
- }
- for (OutputWorkflowPort owp : workflow.getOutputPorts()) {
- portResolvedDepthMap.remove(owp);
- receiverDataLinkMap.remove(owp);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/DotProductIterationMismatchProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/DotProductIterationMismatchProblem.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/DotProductIterationMismatchProblem.java
deleted file mode 100644
index 0edcec4..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/DotProductIterationMismatchProblem.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.structural.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 DotProductIterationMismatchProblem extends ValidationProblem {
- public DotProductIterationMismatchProblem(WorkflowBean bean) {
- super(bean);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyCrossProductProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyCrossProductProblem.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyCrossProductProblem.java
deleted file mode 100644
index f22520a..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyCrossProductProblem.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.apache.taverna.scufl2.validation.structural.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 EmptyCrossProductProblem extends ValidationProblem {
- public EmptyCrossProductProblem(WorkflowBean bean) {
- super(bean);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyDotProductProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyDotProductProblem.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyDotProductProblem.java
deleted file mode 100644
index 31d5554..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/EmptyDotProductProblem.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.apache.taverna.scufl2.validation.structural.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 EmptyDotProductProblem extends ValidationProblem {
- public EmptyDotProductProblem(WorkflowBean bean) {
- super(bean);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/f8af1400/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/FailedProcessorProblem.java
----------------------------------------------------------------------
diff --git a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/FailedProcessorProblem.java b/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/FailedProcessorProblem.java
deleted file mode 100644
index ad6a240..0000000
--- a/taverna-scufl2-validation-structural/src/main/java/org/apache/taverna/scufl2/validation/structural/report/FailedProcessorProblem.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- */
-package org.apache.taverna.scufl2.validation.structural.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 FailedProcessorProblem extends ValidationProblem {
- public FailedProcessorProblem(WorkflowBean bean) {
- super(bean);
- }
-}