本文整理了Java中uk.org.taverna.scufl2.api.core.Workflow.<init>()
方法的一些代码示例,展示了Workflow.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Workflow.<init>()
方法的具体详情如下:
包路径:uk.org.taverna.scufl2.api.core.Workflow
类名称:Workflow
方法名:<init>
[英]Constructs a Workflow
with a name based on a random UUID.
[中]构造一个Workflow
,其名称基于随机UUID。
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Test
public void workflow() throws Exception {
Workflow wf = new Workflow();
UUID uuid = UUID.fromString(wf.getName());
assertEquals(4, uuid.version());
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Test
public void setName() throws Exception {
Workflow wf = new Workflow();
Processor p = new Processor();
p.setName("fish");
p.setName("soup");
p.setParent(wf);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
/**
* Test method for {@link uk.org.taverna.scufl2.validation.correctness.CorrectnessVisitor#visitChild(uk.org.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
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-structural
@Test
public void testIncompleteWorkflow() throws ReaderException, IOException {
ReportStructuralValidationListener l = new ReportStructuralValidationListener();
WorkflowBundle wb = new WorkflowBundle();
Workflow w = new Workflow();
wb.setMainWorkflow(w);
StructuralValidator sv = new StructuralValidator();
sv.checkStructure(wb, l);
ValidatorState vs = sv.getValidatorState();
assertEquals(1, l.getIncompleteWorkflows().size());
assert(l.getIncompleteWorkflows().contains(w));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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());
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@SuppressWarnings("unchecked")
@Test
public void expectedOrder() throws Exception {
Workflow wf = new Workflow();
wf.setName("wf");
Processor a = new Processor(wf, "a");
Processor b = new Processor(wf, "b");
Processor c = new Processor(wf, "c");
Processor d = new Processor(wf, "d");
BlockingControlLink b_blocks_c = new BlockingControlLink(c, b);
BlockingControlLink a_blocks_c = new BlockingControlLink(c, a);
BlockingControlLink a_blocks_b = new BlockingControlLink(b, a);
BlockingControlLink b_blocks_d = new BlockingControlLink(d, b);
BlockingControlLink a_blocks_d = new BlockingControlLink(d, a);
ArrayList<ControlLink> links = new ArrayList<ControlLink>(wf.getControlLinks());
assertEquals(Arrays.asList(a_blocks_b, a_blocks_c, a_blocks_d, b_blocks_c, b_blocks_d), links);
Collections.shuffle(links);
Collections.sort(links);
assertEquals(Arrays.asList(a_blocks_b, a_blocks_c, a_blocks_d, b_blocks_c, b_blocks_d), links);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@SuppressWarnings("unchecked")
@Test
public void expectedOrder() throws Exception {
Workflow wf = new Workflow();
wf.setName("wf");
InputWorkflowPort a = new InputWorkflowPort(wf, "a");
InputWorkflowPort b = new InputWorkflowPort(wf, "b");
InputWorkflowPort c = new InputWorkflowPort(wf, "c");
OutputWorkflowPort x = new OutputWorkflowPort(wf, "x");
OutputWorkflowPort y = new OutputWorkflowPort(wf, "y");
OutputWorkflowPort z = new OutputWorkflowPort(wf, "z");
DataLink c_x = new DataLink(wf, c, x);
DataLink b_x = new DataLink(wf, b, x);
DataLink b_z = new DataLink(wf, b, z);
DataLink a_z = new DataLink(wf, a, z);
DataLink a_x = new DataLink(wf, a, x);
ArrayList<DataLink> links = new ArrayList<DataLink>(wf.getDataLinks());
assertEquals(Arrays.asList(a_x, a_z, b_x, b_z, c_x), links);
Collections.shuffle(links);
Collections.sort(links);
assertEquals(Arrays.asList(a_x, a_z, b_x, b_z, c_x), links);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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());
}
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Test
public void replaceOnRename() throws Exception {
Workflow wf = new Workflow();
Processor fish = new Processor(wf, "fish");
Processor soup = new Processor(wf, "soup");
assertEquals(2, wf.getProcessors().size());
assertEquals(new HashSet(Arrays.asList("fish", "soup")), wf
.getProcessors().getNames());
fish.setName("soup");
assertEquals(new HashSet(Arrays.asList("soup")), wf
.getProcessors().getNames());
assertEquals(1, wf.getProcessors().size());
assertEquals(fish, wf.getProcessors().iterator().next());
assertEquals(fish, wf.getProcessors().getByName("soup"));
assertNull(wf.getProcessors().getByName("fish"));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-structural
@Test
public void testDataLinkInheritanceFromInputWorkflowPorts() {
WorkflowBundle wb = new WorkflowBundle();
Workflow w = new Workflow();
wb.setMainWorkflow(w);
InputWorkflowPort a = new InputWorkflowPort(w, "a");
a.setDepth(0);
InputWorkflowPort b = new InputWorkflowPort(w, "b");
b.setDepth(7);
OutputWorkflowPort outA = new OutputWorkflowPort(w, "outA");
OutputWorkflowPort outB = new OutputWorkflowPort(w, "outB");
DataLink aLink = new DataLink(w, a, outA);
DataLink bLink = new DataLink(w, b, outB);
StructuralValidator sv = new StructuralValidator();
ReportStructuralValidationListener l = new ReportStructuralValidationListener();
sv.checkStructure(wb, l);
ValidatorState vs = sv.getValidatorState();
assertEquals(0, l.getIncompleteWorkflows().size());
assertEquals(Integer.valueOf(0), vs.getDataLinkResolvedDepth(aLink));
assertEquals(Integer.valueOf(7), vs.getDataLinkResolvedDepth(bLink));
assertEquals(Integer.valueOf(0), vs.getPortResolvedDepth(outA));
assertEquals(Integer.valueOf(7), vs.getPortResolvedDepth(outB));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Test
public void nullParentNotCopied() throws Exception {
Workflow wf = new Workflow();
Processor orphan = new Processor();
orphan.setName("orphan");
// NOTE: NOT calling
// orphan.setParent(wf)
wf.getProcessors().add(orphan);
assertNull(orphan.getParent());
Workflow clone = (Workflow) wf.clone();
assertTrue(clone.getProcessors().isEmpty());
orphan.setParent(wf);
Workflow clone2 = (Workflow) wf.clone();
assertEquals(Collections.singleton("orphan"), clone2.getProcessors()
.getNames());
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Test
public void setNameWithParent() throws Exception {
Workflow wf = new Workflow();
Processor p = new Processor();
p.setName("fish");
p.setParent(wf);
assertTrue(wf.getProcessors().contains(p));
assertTrue(wf.getProcessors().containsName("fish"));
assertFalse(wf.getProcessors().containsName("soup"));
p.setName("soup");
assertFalse(wf.getProcessors().containsName("fish"));
assertTrue(wf.getProcessors().containsName("soup"));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@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);
}
内容来源于网络,如有侵权,请联系作者删除!