Search in sources :

Example 36 with WorkflowStep

use of org.alien4cloud.tosca.model.workflow.WorkflowStep in project alien4cloud by alien4cloud.

the class CycleDetectionTest method testNoCycle.

/**
 * <pre>
 *
 *  a -- b
 *
 * </pre>
 */
@Test
public void testNoCycle() {
    WorkflowStep a = wf.addStep(new SimpleStep("a"));
    WorkflowStep b = wf.addStep(new SimpleStep("b"));
    WorkflowUtils.linkSteps(a, b);
    processValidation(false, 0);
}
Also used : WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep) Test(org.junit.Test)

Example 37 with WorkflowStep

use of org.alien4cloud.tosca.model.workflow.WorkflowStep 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());
}
Also used : Path(alien4cloud.paas.wf.model.Path) WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep) Workflow(org.alien4cloud.tosca.model.workflow.Workflow) Test(org.junit.Test)

Example 38 with WorkflowStep

use of org.alien4cloud.tosca.model.workflow.WorkflowStep 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());
}
Also used : Path(alien4cloud.paas.wf.model.Path) WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep) Workflow(org.alien4cloud.tosca.model.workflow.Workflow) Test(org.junit.Test)

Example 39 with WorkflowStep

use of org.alien4cloud.tosca.model.workflow.WorkflowStep 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());
}
Also used : Path(alien4cloud.paas.wf.model.Path) WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep) Workflow(org.alien4cloud.tosca.model.workflow.Workflow) Test(org.junit.Test)

Example 40 with WorkflowStep

use of org.alien4cloud.tosca.model.workflow.WorkflowStep in project alien4cloud by alien4cloud.

the class AbstractWorkflowBuilder method removeFollowers.

private List<WorkflowStep> removeFollowers(Workflow wf, WorkflowStep step) {
    List<WorkflowStep> result = Lists.newArrayList();
    if (step.getOnSuccess() == null || step.getOnSuccess().size() == 0) {
        return result;
    }
    Object[] followings = step.getOnSuccess().toArray();
    for (Object followingId : followings) {
        WorkflowStep followingStep = wf.getSteps().get(followingId);
        unlinkSteps(step, followingStep);
        result.add(followingStep);
    }
    return result;
}
Also used : NodeWorkflowStep(org.alien4cloud.tosca.model.workflow.NodeWorkflowStep) RelationshipWorkflowStep(org.alien4cloud.tosca.model.workflow.RelationshipWorkflowStep) WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep)

Aggregations

WorkflowStep (org.alien4cloud.tosca.model.workflow.WorkflowStep)51 RelationshipWorkflowStep (org.alien4cloud.tosca.model.workflow.RelationshipWorkflowStep)24 NodeWorkflowStep (org.alien4cloud.tosca.model.workflow.NodeWorkflowStep)23 Workflow (org.alien4cloud.tosca.model.workflow.Workflow)20 Test (org.junit.Test)17 Path (alien4cloud.paas.wf.model.Path)7 Map (java.util.Map)6 ArrayList (java.util.ArrayList)5 Set (java.util.Set)5 NodeTemplate (org.alien4cloud.tosca.model.templates.NodeTemplate)5 InconsistentWorkflowException (alien4cloud.paas.wf.exception.InconsistentWorkflowException)4 TopologyDTO (alien4cloud.topology.TopologyDTO)4 AlienUtils.safe (alien4cloud.utils.AlienUtils.safe)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 HashMap (java.util.HashMap)3 LinkedList (java.util.LinkedList)3 RelationshipTemplate (org.alien4cloud.tosca.model.templates.RelationshipTemplate)3 RelationshipType (org.alien4cloud.tosca.model.types.RelationshipType)3 StringUtils (org.apache.commons.lang3.StringUtils)3