Search in sources :

Example 51 with WorkflowStep

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

the class WorkflowStepDefinitions method the_workflow_step_is_followed_by.

@When("^The workflow step \"(.*?)\" is followed by: (.*)$")
public void the_workflow_step_is_followed_by(String stepId, List<String> followers) throws Throwable {
    String topologyResponseText = Context.getInstance().getRestResponse();
    RestResponse<TopologyDTO> topologyResponse = JsonUtil.read(topologyResponseText, TopologyDTO.class, Context.getJsonMapper());
    String workflowName = Context.getInstance().getCurrentWorkflowName();
    Workflow workflow = topologyResponse.getData().getTopology().getWorkflows().get(workflowName);
    WorkflowStep step = workflow.getSteps().get(stepId);
    Set<String> actualFollowers = step.getOnSuccess();
    assertNotNull(actualFollowers);
    assertEquals(followers.size(), actualFollowers.size());
    for (String expectedFollower : followers) {
        // we just remove the surrounding quotes
        String follower = expectedFollower.substring(1, expectedFollower.length() - 1);
        assertTrue(actualFollowers.contains(follower));
    }
}
Also used : TopologyDTO(alien4cloud.topology.TopologyDTO) WorkflowStep(org.alien4cloud.tosca.model.workflow.WorkflowStep) Workflow(org.alien4cloud.tosca.model.workflow.Workflow) When(cucumber.api.java.en.When)

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