use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class SecretPropertiesStepDefinitions method theTopologyShouldHaveThePropertyOfRelationshipFromTheNodeDefinedAsASecretWithASecretPath.
@And("^The topology should have the property \"([^\"]*)\" of relationship \"([^\"]*)\" from the node \"([^\"]*)\" defined as a secret with a secret path \"([^\"]*)\"$")
public void theTopologyShouldHaveThePropertyOfRelationshipFromTheNodeDefinedAsASecretWithASecretPath(String propertyName, String relationshipName, String nodeName, String secretPath) throws Throwable {
String response = Context.getRestClientInstance().get("/rest/v1/topologies/" + Context.getInstance().getTopologyId());
JavaType restResponseType = Context.getJsonMapper().getTypeFactory().constructParametricType(RestResponse.class, TopologyDTO.class);
TopologyDTO topologyDTO = ((RestResponse<TopologyDTO>) Context.getJsonMapper().readValue(response, restResponseType)).getData();
FunctionPropertyValue functionPropertyValue = (FunctionPropertyValue) topologyDTO.getTopology().getNodeTemplates().get(nodeName).getRelationships().get(relationshipName).getProperties().get(propertyName);
Assert.assertEquals(secretPath, functionPropertyValue.getParameters().get(0));
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class TopologyRecoveryStepDefinitions method I_node_in_the_topology_dto_should_not_have_the_capability.
@Then("^the node \"([^\"]*)\" in the topology dto should not have the capability \"([^\"]*)\"$")
public void I_node_in_the_topology_dto_should_not_have_the_capability(String nodeName, String capabilityName) throws IOException {
TopologyDTO dto = JsonUtil.read(Context.getInstance().getRestResponse(), TopologyDTO.class, Context.getJsonMapper()).getData();
NodeTemplate template = dto.getTopology().getNodeTemplates().get(nodeName);
Assert.assertNotNull(template);
assertFalse(template.getCapabilities().containsKey(capabilityName));
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class TopologyRecoveryStepDefinitions method the_topology_dto_should_contain_an_emty_topology.
@Then("^the topology dto should contain an emty topology$")
public void the_topology_dto_should_contain_an_emty_topology() throws Throwable {
TopologyDTO dto = JsonUtil.read(Context.getInstance().getRestResponse(), TopologyDTO.class, Context.getJsonMapper()).getData();
Assert.assertTrue(dto.getTopology().isEmpty());
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class TopologyRecoveryStepDefinitions method the_topology_dto_should_contain_nodetemplates.
@Then("^the topology dto should contain (\\d+) nodetemplates$")
public void the_topology_dto_should_contain_nodetemplates(int count) throws Throwable {
TopologyDTO dto = JsonUtil.read(Context.getInstance().getRestResponse(), TopologyDTO.class, Context.getJsonMapper()).getData();
Assert.assertEquals(count, dto.getTopology().getNodeTemplates().size());
}
use of alien4cloud.topology.TopologyDTO 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));
}
}
Aggregations