org.apache.taverna.scufl2.api.core.Workflow.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.taverna.scufl2.api.core.Workflow.<init>()方法的一些代码示例,展示了Workflow.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Workflow.<init>()方法的具体详情如下:
包路径:org.apache.taverna.scufl2.api.core.Workflow
类名称:Workflow
方法名:<init>

Workflow.<init>介绍

[英]Constructs a Workflow with a name based on a random UUID.
[中]构造一个Workflow,其名称基于随机UUID。

代码示例

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-t2flow

protected Workflow skeletonDataflow(Dataflow df) {
  Workflow wf = new Workflow();
  parserState.get().setCurrentWorkflow(wf);
  wf.setName(df.getName());
  wf.setIdentifier(WORKFLOW_ROOT.resolve(df.getId() + "/"));
  return wf;
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

private void parseWorkflow(Scanner scanner) {
  level = Level.Workflow;
  workflow = new Workflow();
  String workflowName = parseName(scanner);
  workflow.setName(workflowName);
  wb.getWorkflows().add(workflow);
  if (workflowName.equals(mainWorkflow))
    wb.setMainWorkflow(workflow);
}

代码示例来源:origin: org.apache.taverna.engine/taverna-report-api

/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
  subject = new Workflow();
  statusReport = new StatusReport<Workflow,StatusReport<?,?>>(subject);
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@Test
public void workflow() throws Exception {
  Workflow wf = new Workflow();
  UUID uuid = UUID.fromString(wf.getName());
  assertEquals(4, uuid.version());
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-scufl

private Workflow parseWorkflow(ScuflType wf) {
  Workflow oldCurrentWorkflow = parserState.get().getCurrentWorkflow();
  Workflow workflow = new Workflow();
  workflow.setParent(parserState.get().getCurrentWorkflowBundle());
  parserState.get().addMapping(wf, workflow);
  parserState.get().setCurrentWorkflow(workflow);
  WorkflowDescriptionType description = wf.getWorkflowdescription();
  workflow.setName(sanitiseName(description.getTitle()));
  parseWorkflowInputs(wf);
  parseWorkflowOutputs(wf);
  parseProcessors(wf);
  parseLinks(wf);
  parseCoordinations(wf);
  parseAnnotations(wf);
  replaceDefaultsWithStringConstants(wf); // To be done
  parserState.get().setCurrentWorkflow(oldCurrentWorkflow);
  return workflow;
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

/**
 * Test method for {@link org.apache.taverna.scufl2.validation.correctness.CorrectnessVisitor#visitChild(org.apache.taverna.scufl2.api.common.Child)}.
 */
@Test
public void testCorrectnessOfMissingParent() {
  Workflow w = new Workflow();
  w.setName("fred");
  
  CorrectnessValidator cv = new CorrectnessValidator();
  ReportCorrectnessValidationListener rcvl = new ReportCorrectnessValidationListener();
  
  cv.checkCorrectness(w, false, rcvl);
  
  Set<NullFieldProblem> nullFieldProblems = rcvl.getNullFieldProblems();
  assertEquals(0, nullFieldProblems.size()); // only done when completeness check
}

代码示例来源:origin: org.apache.taverna.language/taverna-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: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-scufl2-api

@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);
    @SuppressWarnings("unused")
    ValidatorState vs = sv.getValidatorState();
    assertEquals(1, l.getIncompleteWorkflows().size());
    assert(l.getIncompleteWorkflows().contains(w));	    
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.engine/taverna-run-api

/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
  workflow = new Workflow();
  mainWorkflow = new Workflow();
  profile = new Profile();
  mainProfile = new Profile();
  workflowBundle = new WorkflowBundle();
  workflowBundle.setMainProfile(mainProfile);
  workflowBundle.setMainWorkflow(mainWorkflow);
  executionService = new LocalExecutionService();
  executionEnvironment = new LocalExecutionEnvironment(executionService, null, null);
  dataBundle = DataBundles.createBundle();
  runProfile = new RunProfile(executionEnvironment, workflowBundle, workflow.getName(), profile.getName(), dataBundle);
}

代码示例来源:origin: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-scufl2-api

@Test
public void replaceOnRename() throws Exception {
  Workflow wf = new Workflow();
  Processor fish = new Processor(wf, "fish");
  @SuppressWarnings("unused")
  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: org.apache.taverna.language/taverna-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: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-scufl2-api

@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: org.apache.taverna.language/taverna-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"));
}

相关文章