use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class RemoveWorkflowProcessor method processWorkflowOperation.
@Override
protected void processWorkflowOperation(Csar csar, Topology topology, RemoveWorkflowOperation operation, Workflow workflow) {
ensureNotStandard(workflow, "standard workflow <" + workflow.getName() + "> can not be removed");
log.debug("removing workflow [ {} ] from topology [ {} ]", operation.getWorkflowName(), topology.getId());
topology.getWorkflows().remove(operation.getWorkflowName());
topology.getWorkflows().values().forEach(wf -> wf.getSteps().values().forEach(step -> {
if (step.getActivity() instanceof InlineWorkflowActivity) {
InlineWorkflowActivity inlineWorkflowActivity = (InlineWorkflowActivity) step.getActivity();
if (inlineWorkflowActivity.getInline().equals(workflow.getName())) {
throw new BadWorkflowOperationException("Workflow " + inlineWorkflowActivity.getInline() + " is inlined in workflow " + wf.getName() + " in step " + step.getName());
}
}
}));
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class AbstractWorkflowProcessor method process.
@Override
public void process(Csar csar, Topology topology, T operation) {
Workflow workflow = workflowBuilderService.getWorkflow(operation.getWorkflowName(), topology);
processWorkflowOperation(csar, topology, operation, workflow);
if (!operation.getClass().getSimpleName().toString().equals(ReinitializeWorkflowOperation.class.getSimpleName().toString())) {
workflow.setHasCustomModifications(true);
}
}
use of org.alien4cloud.tosca.model.workflow.Workflow 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());
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class GraphPathsTest method test2.
/**
* -- a --
* -- b --
*/
@Test
public void test2() {
Workflow wf = new Workflow();
wf.setName(INSTALL);
WorkflowStep a = wf.addStep(new SimpleStep("a"));
WorkflowStep b = wf.addStep(new SimpleStep("b"));
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(wf);
log.info(paths.toString());
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class GraphPathsTest method testComplexe.
/**
* <pre>
* -- b -- -- e
* / \ /
* a d
* \ / \
* -- c -- -- f
* </pre>
*/
@Test
public void testComplexe() {
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"));
WorkflowStep d = wf.addStep(new SimpleStep("d"));
WorkflowStep e = wf.addStep(new SimpleStep("e"));
WorkflowStep f = wf.addStep(new SimpleStep("f"));
WorkflowUtils.linkSteps(a, b);
WorkflowUtils.linkSteps(a, c);
WorkflowUtils.linkSteps(b, d);
WorkflowUtils.linkSteps(c, d);
WorkflowUtils.linkSteps(d, e);
WorkflowUtils.linkSteps(d, f);
List<Path> paths = WorkflowGraphUtils.getWorkflowGraphCycles(wf);
log.info(paths.toString());
}
Aggregations