use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class WorkflowsBuilderService method removeStep.
public void removeStep(Topology topology, Csar csar, String workflowName, String stepId) {
TopologyContext topologyContext = buildTopologyContext(topology, csar);
Workflow wf = topology.getWorkflows().get(workflowName);
if (wf == null) {
throw new NotFoundException(String.format("The workflow '%s' can not be found", workflowName));
}
AbstractWorkflowBuilder builder = getWorkflowBuilder(topologyContext.getDSLVersion(), wf);
builder.removeStep(wf, stepId, false);
if (log.isDebugEnabled()) {
log.debug(WorkflowUtils.debugWorkflow(wf));
}
workflowValidator.validate(topologyContext, wf);
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class WorkflowsBuilderService method removeEdge.
public Workflow removeEdge(Topology topology, Csar csar, String workflowName, String from, String to) {
TopologyContext topologyContext = buildTopologyContext(topology, csar);
Workflow wf = topology.getWorkflows().get(workflowName);
if (wf == null) {
throw new NotFoundException(String.format("The workflow '%s' can not be found", workflowName));
}
AbstractWorkflowBuilder builder = getWorkflowBuilder(topologyContext.getDSLVersion(), wf);
builder.removeEdge(wf, from, to);
workflowValidator.validate(topologyContext, wf);
return wf;
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class WorkflowStepDefinitions method the_workflow_step_is_preceded_by.
@When("^The workflow step \"(.*?)\" is preceded by: (.*)$")
public void the_workflow_step_is_preceded_by(String stepId, List<String> predecesors) 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> actualPredecessors = step.getPrecedingSteps();
assertNotNull(actualPredecessors);
assertEquals(predecesors.size(), actualPredecessors.size());
for (String expectedPredecessor : predecesors) {
// we just remove the surrounding quotes
String predecessor = expectedPredecessor.substring(1, expectedPredecessor.length() - 1);
assertTrue(actualPredecessors.contains(predecessor));
}
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class WorkflowStepDefinitions method the_workflow_step_has_no_followers.
@Then("^The workflow step \"(.*?)\" has no followers$")
public void the_workflow_step_has_no_followers(String stepId) 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);
assertTrue(step.getOnSuccess() == null || step.getOnSuccess().isEmpty());
}
use of org.alien4cloud.tosca.model.workflow.Workflow in project alien4cloud by alien4cloud.
the class WorkflowStepDefinitions method the_workflow_step_has_no_predecessors.
@Then("^The workflow step \"(.*?)\" has no predecessors$")
public void the_workflow_step_has_no_predecessors(String stepId) 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);
assertTrue(step.getPrecedingSteps() == null || step.getPrecedingSteps().isEmpty());
}
Aggregations