DASpecification { public static List<TArtifactType> getArtifactTypeHierarchy(TArtifactType artifactType) { List<TArtifactType> artifactTypeHierarchy = new ArrayList<>(); TArtifactType basisArtifactType = artifactType; artifactTypeHierarchy.add(basisArtifactType); while (basisArtifactType != null) { if (basisArtifactType.getDerivedFrom() != null) { QName parentArtifactTypeQName = basisArtifactType.getDerivedFrom().getTypeRef(); ArtifactTypeId parentArtifactTypeId = new ArtifactTypeId(parentArtifactTypeQName); basisArtifactType = RepositoryFactory.getRepository().getElement(parentArtifactTypeId); artifactTypeHierarchy.add(basisArtifactType); } else { basisArtifactType = null; } } return artifactTypeHierarchy; }  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 getArtifactTypeHierarchy() throws Exception { setRevisionTo("af529e513388dc9358a8f700757d8dc59aba3a55"); ServiceTemplateId id = new ServiceTemplateId("http: TTopologyTemplate topologyTemplate = this.repository.getElement(id).getTopologyTemplate(); TNodeTemplate nodeTemplate = topologyTemplate.getNodeTemplate("westernequipment"); List<TArtifactType> artifactTypes = DASpecification.getArtifactTypeHierarchy(DASpecification.getArtifactTypeOfDA(nodeTemplate.getDeploymentArtifacts().getDeploymentArtifact().get(0))); List<String> artifactTypeNames = new ArrayList<>(); artifactTypes.stream().forEach(at -> artifactTypeNames.add(at.getName())); assertEquals(2, artifactTypes.size()); assertTrue(artifactTypeNames.contains("WesternEquipment_Pony")); assertTrue(artifactTypeNames.contains("PonyEquipment")); }