Search in sources :

Example 16 with ArtifactTypeId

use of org.eclipse.winery.model.ids.definitions.ArtifactTypeId in project winery by eclipse.

the class DASpecificationTest method getArtifactTypeOfDA.

@Test
public void getArtifactTypeOfDA() throws Exception {
    setRevisionTo("af529e513388dc9358a8f700757d8dc59aba3a55");
    ServiceTemplateId id = new ServiceTemplateId("http://winery.opentosca.org/test/servicetemplates/ponyuniverse/daspecifier", "DASpecificationTest", false);
    TTopologyTemplate topologyTemplate = this.repository.getElement(id).getTopologyTemplate();
    assertNotNull(topologyTemplate);
    TNodeTemplate nodeTemplateWithAbstractDA = topologyTemplate.getNodeTemplate("shetland_pony");
    assertNotNull(nodeTemplateWithAbstractDA);
    assertNotNull(nodeTemplateWithAbstractDA.getDeploymentArtifacts());
    TDeploymentArtifact deploymentArtifact = nodeTemplateWithAbstractDA.getDeploymentArtifacts().get(0);
    QName artifactTypeQName = deploymentArtifact.getArtifactType();
    ArtifactTypeId artifactTypeId = new ArtifactTypeId(artifactTypeQName);
    TArtifactType artifactType = this.repository.getElement(artifactTypeId);
    assertEquals(artifactType.getTargetNamespace(), DASpecification.getArtifactTypeOfDA(nodeTemplateWithAbstractDA.getDeploymentArtifacts().get(0)).getTargetNamespace());
    assertEquals(artifactType.getName(), DASpecification.getArtifactTypeOfDA(nodeTemplateWithAbstractDA.getDeploymentArtifacts().get(0)).getName());
}
Also used : ArtifactTypeId(org.eclipse.winery.model.ids.definitions.ArtifactTypeId) QName(javax.xml.namespace.QName) TTopologyTemplate(org.eclipse.winery.model.tosca.TTopologyTemplate) TArtifactType(org.eclipse.winery.model.tosca.TArtifactType) TDeploymentArtifact(org.eclipse.winery.model.tosca.TDeploymentArtifact) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) TNodeTemplate(org.eclipse.winery.model.tosca.TNodeTemplate) Test(org.junit.jupiter.api.Test)

Example 17 with ArtifactTypeId

use of org.eclipse.winery.model.ids.definitions.ArtifactTypeId in project winery by eclipse.

the class DASpecification method getArtifactTypeHierarchy.

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;
}
Also used : ArtifactTypeId(org.eclipse.winery.model.ids.definitions.ArtifactTypeId) QName(javax.xml.namespace.QName) TArtifactType(org.eclipse.winery.model.tosca.TArtifactType) ArrayList(java.util.ArrayList)

Aggregations

ArtifactTypeId (org.eclipse.winery.model.ids.definitions.ArtifactTypeId)17 QName (javax.xml.namespace.QName)11 ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)9 NodeTypeId (org.eclipse.winery.model.ids.definitions.NodeTypeId)6 RelationshipTypeId (org.eclipse.winery.model.ids.definitions.RelationshipTypeId)6 TDeploymentArtifact (org.eclipse.winery.model.tosca.TDeploymentArtifact)6 ArrayList (java.util.ArrayList)5 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)5 PolicyTypeId (org.eclipse.winery.model.ids.definitions.PolicyTypeId)5 HashSet (java.util.HashSet)4 CapabilityTypeId (org.eclipse.winery.model.ids.definitions.CapabilityTypeId)4 InterfaceTypeId (org.eclipse.winery.model.ids.definitions.InterfaceTypeId)4 NodeTypeImplementationId (org.eclipse.winery.model.ids.definitions.NodeTypeImplementationId)4 RequirementTypeId (org.eclipse.winery.model.ids.definitions.RequirementTypeId)4 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)4 TArtifactType (org.eclipse.winery.model.tosca.TArtifactType)4 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)4 PolicyTemplateId (org.eclipse.winery.model.ids.definitions.PolicyTemplateId)3 RelationshipTypeImplementationId (org.eclipse.winery.model.ids.definitions.RelationshipTypeImplementationId)3 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)3