DASpecification { public static TNodeTemplate getNodesWithSuitableConcreteDAs(TNodeTemplate nodeTemplate, TDeploymentArtifact deploymentArtifact, TTopologyTemplate topologyTemplate) { if (getSuitableConcreteDA(deploymentArtifact, nodeTemplate) == null) { List<TRelationshipTemplate> outgoingRelationshipTemplates = ModelUtilities.getOutgoingRelationshipTemplates(topologyTemplate, nodeTemplate) .stream().filter(outrel -> getBasisRelationshipType(outrel.getType()).getValidTarget().getTypeRef().getLocalPart().equalsIgnoreCase("Container")) .collect(Collectors.toList()); for (TRelationshipTemplate relationshipTemplate : outgoingRelationshipTemplates) { TNodeTemplate targetNodeTemplate = ModelUtilities.getTargetNodeTemplateOfRelationshipTemplate(topologyTemplate, relationshipTemplate); return getNodesWithSuitableConcreteDAs(targetNodeTemplate, deploymentArtifact, topologyTemplate); } } else { return nodeTemplate; } return null; }  static List<TNodeTemplate> getNodeTemplatesWithAbstractDAs(TTopologyTemplate topologyTemplate); static TArtifactType getArtifactTypeOfDA(TDeploymentArtifact deploymentArtifact); static List<TArtifactType> getArtifactTypeHierarchy(TArtifactType artifactType); static Map<TRelationshipTemplate, TNodeTemplate> getNodesWithSuitableConcreteDAAndTheDirectlyConnectedNode(TNodeTemplate nodeTemplate, TDeploymentArtifact deploymentArtifact, TTopologyTemplate topologyTemplate); static TNodeTemplate getNodesWithSuitableConcreteDAs(TNodeTemplate nodeTemplate, TDeploymentArtifact deploymentArtifact, TTopologyTemplate topologyTemplate); static TDeploymentArtifact getSuitableConcreteDA(TDeploymentArtifact abstractDeploymentArtifact, TNodeTemplate nodeTemplate);  }
@Test public void getNodesWithSuitableConcreteDAs() throws Exception { setRevisionTo("5f63267261584a513dd8a9b7960687cc3dda910a"); ServiceTemplateId id = new ServiceTemplateId("http: TTopologyTemplate topologyTemplate = this.repository.getElement(id).getTopologyTemplate(); TNodeTemplate nodeTemplate = topologyTemplate.getNodeTemplate("ponycompetition"); TNodeTemplate nodeTemplateWithAbstractDA = topologyTemplate.getNodeTemplate("shetland_pony"); TDeploymentArtifact deploymentArtifact = nodeTemplateWithAbstractDA.getDeploymentArtifacts().getDeploymentArtifact().get(0); TNodeTemplate expectedNodeTemplate = topologyTemplate.getNodeTemplate("dressageequipment"); TNodeTemplate actualNodeWithConcreteDA = DASpecification.getNodesWithSuitableConcreteDAs(nodeTemplate, deploymentArtifact, topologyTemplate); assertEquals(expectedNodeTemplate, actualNodeWithConcreteDA); }