use of alien4cloud.paas.wf.model.Path in project alien4cloud by alien4cloud.
the class GraphPathsTest method testCycles.
@Test
public void testCycles() {
Workflow wf = new Workflow();
wf.setName(INSTALL);
WorkflowStep a = wf.addStep(new SimpleStep("a"));
WorkflowStep b = wf.addStep(new SimpleStep("b"));
WorkflowStep c = wf.addStep(new SimpleStep("c"));
WorkflowUtils.linkSteps(a, b);
WorkflowUtils.linkSteps(b, c);
WorkflowUtils.linkSteps(c, a);
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(wf);
System.out.println(paths);
Assert.assertEquals(1, paths.size());
log.info(paths.toString());
}
use of alien4cloud.paas.wf.model.Path in project alien4cloud by alien4cloud.
the class GraphPathsTest method test23.
/**
* <pre>
* c
* /
* -- a
* \
* b
* </pre>
*/
@Test
public void test23() {
Workflow wf = new Workflow();
wf.setName(INSTALL);
WorkflowStep a = wf.addStep(new SimpleStep("a"));
WorkflowStep b = wf.addStep(new SimpleStep("b"));
WorkflowStep c = wf.addStep(new SimpleStep("c"));
WorkflowUtils.linkSteps(a, b);
WorkflowUtils.linkSteps(a, c);
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(wf);
log.info(paths.toString());
}
use of alien4cloud.paas.wf.model.Path in project alien4cloud by alien4cloud.
the class GraphPathsTest method testOrphan.
/**
* <pre>
* -- a --
* / \
* \ /
* -- b --
* </pre>
*/
@Test
public void testOrphan() {
Workflow wf = new Workflow();
wf.setName(INSTALL);
WorkflowStep a = wf.addStep(new SimpleStep("a"));
WorkflowStep b = wf.addStep(new SimpleStep("b"));
WorkflowUtils.linkSteps(a, b);
WorkflowUtils.linkSteps(b, a);
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(wf);
System.out.println(paths);
Assert.assertEquals(1, paths.size());
log.info(paths.toString());
}
use of alien4cloud.paas.wf.model.Path in project alien4cloud by alien4cloud.
the class CycleDetection method validate.
@Override
public List<AbstractWorkflowError> validate(TopologyContext topologyContext, Workflow workflow) {
if (workflow.getSteps() == null || workflow.getSteps().isEmpty()) {
return null;
}
List<AbstractWorkflowError> result = Lists.newArrayList();
// get all the paths
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(workflow);
for (Path path : paths) {
// isolate cycles
result.add(new WorkflowHasCycleError(extractCycle(path.getStepNames())));
}
return result;
}
use of alien4cloud.paas.wf.model.Path in project alien4cloud by alien4cloud.
the class GraphPathsTest method test1.
/**
* a -- b
*/
@Test
public void test1() {
Workflow wf = new Workflow();
wf.setName(INSTALL);
WorkflowStep a = wf.addStep(new SimpleStep("a"));
WorkflowStep b = wf.addStep(new SimpleStep("b"));
WorkflowUtils.linkSteps(a, b);
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(wf);
log.info(paths.toString());
}
Aggregations