本文整理了Java中uk.org.taverna.scufl2.api.core.Workflow
类的一些代码示例,展示了Workflow
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Workflow
类的具体详情如下:
包路径:uk.org.taverna.scufl2.api.core.Workflow
类名称:Workflow
[英]A Workflow
is a set of Processors and DataLinks between the Processor
s. Workflow
s may also have input and output ports.
[中]Workflow
是Processor
之间的一组处理器和数据链路。Workflow
也可能有输入和输出端口。
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@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));
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Test
public void cloneWorkflow() throws Exception {
Workflow original = originalWfBundle.getMainWorkflow();
assertEquals(originalWfBundle, original.getParent());
Workflow clone = (Workflow) original.clone();
assertNull(clone.getParent());
assertEquals(original.getName(), clone.getName());
assertNotSame(original.getProcessors().getByName("Hello"), clone
.getProcessors().getByName("Hello"));
assertNotSame(original.getCurrentRevision(), clone.getCurrentRevision());
assertEquals(original.getCurrentRevision(), clone.getCurrentRevision());
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-structural
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);
}
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
@Override
public boolean accept(Visitor visitor) {
if (visitor.visitEnter(this)) {
List<WorkflowBean> children = new ArrayList<WorkflowBean>();
children.addAll(getInputPorts());
children.addAll(getOutputPorts());
children.addAll(getProcessors());
children.addAll(getDataLinks());
children.addAll(getControlLinks());
children.addAll(Collections.singleton(getCurrentRevision()));
for (WorkflowBean bean : children) {
if (!bean.accept(visitor)) {
break;
}
}
}
return visitor.visitLeave(this);
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-structural
private void checkCompleteness() {
Workflow w = validatorState.get().getWorkflow();
if (w.getProcessors().isEmpty() && w.getOutputPorts().isEmpty()) {
validatorState.get().getEventListener().incompleteWorkflow(w);
// validatorState.get().addIncompleteWorkflow(w);
}
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
workflow = new Workflow();
String workflowName = parseName(scanner);
workflow.setName(workflowName);
wb.getWorkflows().add(workflow);
if (workflowName.equals(mainWorkflow)) {
processor.setName(processorName);
processor.setParent(workflow);
workflow.getProcessors().add(processor);
return;
Processor blockProc = workflow.getProcessors().getByName(block);
Processor untilFinishedProc = workflow.getProcessors().getByName(
untilFinish);
new BlockingControlLink(blockProc, untilFinishedProc);
if (firstLink.contains(":")) {
String[] procPort = firstLink.split(":");
Processor proc = workflow.getProcessors()
.getByName(procPort[0]);
senderPort = proc.getOutputPorts().getByName(procPort[1]);
} else {
senderPort = workflow.getInputPorts().getByName(firstLink);
if (secondLink.contains(":")) {
String[] procPort = secondLink.split(":");
Processor proc = workflow.getProcessors()
.getByName(procPort[0]);
receiverPort = proc.getInputPorts().getByName(procPort[1]);
代码示例来源: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-api
@Override
public void setParent(Workflow parent) {
if (this.parent != null && this.parent != parent) {
this.parent.getProcessors().remove(this);
}
this.parent = parent;
if (parent != null) {
parent.getProcessors().add(this);
}
}
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-validation-correctness
@Override
public void visitWorkflow(Workflow bean) {
Set<DataLink> dataLinks = bean.getDataLinks();
Set<ControlLink> controlLinks = bean.getControlLinks();
NamedSet<Processor> processors = bean.getProcessors();
URI workflowIdentifier = bean.getIdentifier();
代码示例来源: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-api
public Workflow makeMainWorkflow() {
workflow = new Workflow();
workflow.setName("HelloWorld");
// NOTE: setWorkflowIdentifier should only be called when loading a
// workflow
// which already has an ID
workflow.setIdentifier(URI
.create("http://ns.taverna.org.uk/2010/workflow/00626652-55ae-4a9e-80d4-c8e9ac84e2ca/"));
InputWorkflowPort yourName = new InputWorkflowPort(workflow, "yourName");
yourName.setDepth(0);
OutputWorkflowPort results = new OutputWorkflowPort(workflow, "results");
// Not needed:
// workflow.getInputPorts().add(yourName);
// workflow.getOutputPorts().add(results);
workflow.getProcessors().add(makeProcessor());
workflow.getProcessors().add(makeProcessor2());
// Make links
DataLink directLink = new DataLink(workflow, yourName, results);
directLink.setMergePosition(1);
DataLink greetingLink = new DataLink(workflow, processorGreeting,
results);
greetingLink.setMergePosition(0);
nameLink = new DataLink(workflow, yourName, processorName);
condition = new BlockingControlLink(processor, wait4me);
return workflow;
}
代码示例来源: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-api
wb.setName("bundle1");
Workflow workflow = new Workflow();
workflow.setName("workflow1");
workflow.setParent(wb);
workflow.newRevision();
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-api
append(wf);
appendPorts(2, wf);
for (Processor p : sorted(wf.getProcessors())) {
newLine(2);
append("Processor");
for (DataLink dl : wf.getDataLinks()) {
links.add(datalink(dl.getReceivesFrom()) + " -> " + datalink(dl.getSendsTo()));
List<ControlLink> controlLinks = new ArrayList<ControlLink>(wf.getControlLinks());
if (!controlLinks.isEmpty()) {
newLine(2);
newLine(3);
append("Processor");
String name = " '" + escapeName(pb.getBoundProcessor().getParent().getName());
name = name + ":" + escapeName(pb.getBoundProcessor().getName()) + "'";
append(name);
代码示例来源:origin: uk.org.taverna.scufl2/scufl2-rdfxml
protected void parseWorkflow(
uk.org.taverna.scufl2.rdfxml.jaxb.Workflow workflow, URI wfUri)
throws ReaderException {
Workflow wf = new Workflow();
wf.setParent(getParserState().getCurrent(WorkflowBundle.class));
wf.setName(workflow.getName());
wf.setIdentifier(getParserState()
.getCurrentBase()
.resolve(workflow.getWorkflowIdentifier().getResource()));
代码示例来源: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
@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-api
@Test
public void readBundleStream() throws Exception {
InputStream inputStream = new ByteArrayInputStream(
getStructureFormatWorkflowBundle().getBytes("utf-8"));
WorkflowBundle wfBundle = bundleIO.readBundle(inputStream,
TEXT_VND_TAVERNA_SCUFL2_STRUCTURE);
assertEquals("HelloWorld", wfBundle.getName());
assertEquals("HelloWorld", wfBundle.getMainWorkflow().getName());
assertTrue(wfBundle.getMainWorkflow().getProcessors()
.containsName("Hello"));
}
代码示例来源: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 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
}
内容来源于网络,如有侵权,请联系作者删除!