use of alien4cloud.topology.TopologyDTO 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 alien4cloud.topology.TopologyDTO 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());
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class TopologyDTOBuilder method buildTopologyDTO.
/**
* Build a topology dto (topology and all used types) out of a topology.
*
* @param context The edition context from which to build the dto.
*/
@ToscaContextual
public TopologyDTO buildTopologyDTO(EditionContext context) {
TopologyDTO topologyDTO = new TopologyDTO();
initTopologyDTO(context.getTopology(), topologyDTO);
topologyDTO.setArchiveContentTree(context.getArchiveContentTree());
topologyDTO.setLastOperationIndex(context.getLastOperationIndex());
topologyDTO.setOperations(context.getOperations());
topologyDTO.setDelegateType(context.getCsar().getDelegateType());
topologyDTO.setDependencyConflicts(getDependencyConflictDTOs(context));
// FIXME add validation information
return topologyDTO;
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class EditorStepDefs method doExecuteOperation.
private void doExecuteOperation(AbstractEditorOperation operation, String topologyId) {
thrownException = null;
operation.setPreviousOperationId(topologyIdToLastOperationId.get(topologyId));
try {
TopologyDTO topologyDTO = editorService.execute(topologyId, operation);
String lastOperationId = topologyDTO.getOperations().get(topologyDTO.getLastOperationIndex()).getId();
topologyIdToLastOperationId.put(topologyId, lastOperationId);
topologyEvaluationContext = new StandardEvaluationContext(topologyDTO.getTopology());
dtoEvaluationContext = new StandardEvaluationContext(topologyDTO);
} catch (Exception e) {
log.error("Exception occurred while executing operation", e);
thrownException = e;
exceptionEvaluationContext = new StandardEvaluationContext(e);
}
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class EditorStepDefs method iResetTheTopology.
@When("^I reset the topology$")
public void iResetTheTopology() throws Throwable {
thrownException = null;
try {
TopologyDTO dto = editorService.reset(topologyIds.getLast(), topologyIdToLastOperationId.get(topologyIds.getLast()));
topologyIdToLastOperationId.put(topologyIds.getLast(), null);
dtoEvaluationContext = new StandardEvaluationContext(dto);
topologyEvaluationContext = new StandardEvaluationContext(dto.getTopology());
} catch (Exception e) {
log.error("Error occurred when resetting the topology", e);
thrownException = e;
exceptionEvaluationContext = new StandardEvaluationContext(e);
}
}
Aggregations