use of org.alien4cloud.tosca.model.templates.RelationshipTemplate 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 org.alien4cloud.tosca.model.templates.RelationshipTemplate 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