use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class OutputPropertiesStepDefinitions method The_topology_should_have_the_attribute_of_the_node_defined_as_output_attribute.
@Then("^The topology should have the attribute \"([^\"]*)\" of the node \"([^\"]*)\" defined as output attribute$")
public void The_topology_should_have_the_attribute_of_the_node_defined_as_output_attribute(String attributeName, String nodeName) throws Throwable {
TopologyDTO topologyDTO = getTopologyDTO();
Map<String, Set<String>> outputAttributes = topologyDTO.getTopology().getOutputAttributes();
Assert.assertNotNull(outputAttributes);
Set<String> outputAttributesOfNode = outputAttributes.get(nodeName);
Assert.assertNotNull(outputAttributesOfNode);
Assert.assertTrue(outputAttributesOfNode.contains(attributeName));
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class OutputPropertiesStepDefinitions method The_topology_should_have_the_property_of_the_node_defined_as_output_property.
@Then("^The topology should have the property \"([^\"]*)\" of the node \"([^\"]*)\" defined as output property$")
public void The_topology_should_have_the_property_of_the_node_defined_as_output_property(String propertyName, String nodeName) throws Throwable {
TopologyDTO topologyDTO = getTopologyDTO();
Map<String, Set<String>> outputProperties = topologyDTO.getTopology().getOutputProperties();
Assert.assertNotNull(outputProperties);
Set<String> outputPropertiesOfNode = outputProperties.get(nodeName);
Assert.assertNotNull(outputPropertiesOfNode);
Assert.assertTrue(outputPropertiesOfNode.contains(propertyName));
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class TopologyStepDefinitions method The_RestResponse_should_contain_a_nodetemplate_named_and_type.
@Then("^The RestResponse should contain a nodetemplate named \"([^\"]*)\" and type \"([^\"]*)\"")
public void The_RestResponse_should_contain_a_nodetemplate_named_and_type(String key, String type) throws Throwable {
TopologyDTO topologyDTO = JsonUtil.read(Context.getInstance().getRestResponse(), TopologyDTO.class, Context.getJsonMapper()).getData();
assertNotNull(topologyDTO);
assertNotNull(topologyDTO.getTopology());
assertNotNull(topologyDTO.getTopology().getNodeTemplates());
assertEquals(type, topologyDTO.getTopology().getNodeTemplates().get(key).getType());
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class TopologyStepDefinitions method I_should_have_relationship_with_source_for_requirement_of_type.
@Then("^I should have (\\d+) relationship with source \"([^\"]*)\" and target \"([^\"]*)\" for type \"([^\"]*)\" with requirement \"([^\"]*)\" of type \"([^\"]*)\"$")
public void I_should_have_relationship_with_source_for_requirement_of_type(int relationshipCount, String source, String target, String relType, String requirementName, String requirementType) throws Throwable {
String topologyJson = Context.getRestClientInstance().get("/rest/v1/topologies/" + Context.getInstance().getTopologyId());
RestResponse<TopologyDTO> topologyResponse = JsonUtil.read(topologyJson, TopologyDTO.class, Context.getJsonMapper());
NodeTemplate sourceNode = topologyResponse.getData().getTopology().getNodeTemplates().get(source);
RelationshipTemplate rel = sourceNode.getRelationships().get(getRelationShipName(relType, target));
assertNotNull(rel);
// Only one relationship of this type for the moment : cardinality check soon
assertEquals(rel.getRequirementName(), requirementName);
assertEquals(rel.getRequirementType(), requirementType);
}
use of alien4cloud.topology.TopologyDTO in project alien4cloud by alien4cloud.
the class NodeTemplateStepDefinitions method I_should_not_have_a_relationship_in_node_template.
@Then("^I should not have the relationship \"([^\"]*)\" in \"([^\"]*)\" node template$")
public void I_should_not_have_a_relationship_in_node_template(String relName, String nodeTempName) throws Throwable {
String topologyJson = Context.getRestClientInstance().get("/rest/v1/topologies/" + Context.getInstance().getTopologyId());
RestResponse<TopologyDTO> topologyResponse = JsonUtil.read(topologyJson, TopologyDTO.class, Context.getJsonMapper());
NodeTemplate sourceNode = topologyResponse.getData().getTopology().getNodeTemplates().get(nodeTempName);
Map<String, RelationshipTemplate> rels = sourceNode.getRelationships();
if (rels != null) {
assertFalse(rels.containsKey(relName));
} else {
log.info("No relationship found in I_should_not_have_a_relationship_in_node_template(String relName, String nodeTempName)");
}
}
Aggregations