public DummyWorkflow(WorkflowBundle parent) { super.setParent(parent); }
@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 workflowsNotEqualsUnlessOrphans() { Workflow wf1 = new Workflow(); Workflow wf2 = new Workflow(); wf1.setName("fred"); wf2.setName("fred"); // No parents, so they are equal assertEquals(wf1, wf2); WorkflowBundle wb1 = new WorkflowBundle(); WorkflowBundle wb2 = new WorkflowBundle(); // Make them look "equal" wb2.setName(wb1.getName()); wb2.setGlobalBaseURI(wb1.getGlobalBaseURI()); assertFalse(wb1.equals(wb2)); wf1.setParent(wb1); wf2.setParent(wb2); assertFalse(wf1.equals(wf2)); wf1.setParent(null); assertFalse(wf1.equals(wf2)); assertFalse(wf2.equals(wf1)); wf2.setParent(null); assertTrue(wf1.equals(wf2)); }
@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); }
workflow.setParent(wb); workflow.newRevision();
@Test public void testCorrectnessOfInScopeBoundProcessor() { WorkflowBundle wb = new WorkflowBundle(); Profile profile = new Profile(); profile.setParent(wb); ProcessorBinding pb = new ProcessorBinding(); Workflow w = new Workflow(); Processor processor = new Processor(); processor.setParent(w); w.setParent(wb); pb.setBoundProcessor(processor); pb.setParent(profile); CorrectnessValidator cv = new CorrectnessValidator(); ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener(); cv.checkCorrectness(pb, false, rcvl); Set<OutOfScopeValueProblem> outOfScopeValueProblems = rcvl.getOutOfScopeValueProblems(); // assertFalse(outOfScopeValueProblems.isEmpty()); boolean problem = false; for (OutOfScopeValueProblem nlp : outOfScopeValueProblems) { if (nlp.getBean().equals(pb) && nlp.getFieldName().equals("boundProcessor") && nlp.getValue().equals(processor)) { problem = true; } } assertFalse(problem); }
public WorkflowBundle makeWorkflowBundle() { // Based on // uk.org.taverna.scufl2.scufl2-usecases/src/main/resources/workflows/example/workflowBundle.rdf workflowBundle = new WorkflowBundle(); workflowBundle.setName("HelloWorld"); // NOTE: setSameBaseAs should only be called when loading a workflow // bundle // which already has an ID workflowBundle .setGlobalBaseURI(URI .create("http://ns.taverna.org.uk/2010/workflowBundle/28f7c554-4f35-401f-b34b-516e9a0ef731/")); Workflow workflow = makeMainWorkflow(); workflow.setParent(workflowBundle); workflowBundle.setMainWorkflow(workflow); Profile profile = makeMainProfile(); profile.setParent(workflowBundle); workflowBundle.setMainProfile(profile); Profile secondaryProfile = makeSecondaryProfile(); secondaryProfile.setParent(workflowBundle); Scufl2Tools scufl2Tools = new Scufl2Tools(); scufl2Tools.setParents(workflowBundle); return workflowBundle; }
throws ReaderException { Workflow wf = new Workflow(); wf.setParent(getParserState().getCurrent(WorkflowBundle.class));