Search in sources :

Example 21 with ServiceTemplateId

use of org.eclipse.winery.common.ids.definitions.ServiceTemplateId in project winery by eclipse.

the class ServiceTemplateResourceTest method createInstance.

@Test
public void createInstance() throws Exception {
    this.setRevisionTo("8cf0ce80c2c40c6ec178ef8e5bdc4e2fcdecc7f9");
    ServiceTemplateId id = new ServiceTemplateId("http://winery.opentosca.org/test/servicetemplates/fruits", "farm", false);
    ServiceTemplateResource serviceTemplateResource = new ServiceTemplateResource(id);
    Assert.assertNotNull(serviceTemplateResource);
}
Also used : ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) AbstractResourceTest(org.eclipse.winery.repository.rest.resources.AbstractResourceTest) Test(org.junit.Test)

Example 22 with ServiceTemplateId

use of org.eclipse.winery.common.ids.definitions.ServiceTemplateId in project winery by eclipse.

the class DASpecificationTest method getNodeTemplatesWithAbstractDAs.

@Test
public void getNodeTemplatesWithAbstractDAs() 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();
    List<TNodeTemplate> nodeTemplateWithAbstractDA = new ArrayList<>();
    nodeTemplateWithAbstractDA.add(topologyTemplate.getNodeTemplate("shetland_pony"));
    List<TNodeTemplate> nodesWithAbstractDA = DASpecification.getNodeTemplatesWithAbstractDAs(topologyTemplate);
    assertEquals(nodeTemplateWithAbstractDA, nodesWithAbstractDA);
}
Also used : ArrayList(java.util.ArrayList) ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) Test(org.junit.Test)

Example 23 with ServiceTemplateId

use of org.eclipse.winery.common.ids.definitions.ServiceTemplateId in project winery by eclipse.

the class DASpecificationTest method getArtifactTypeHierarchy.

@Test
public void getArtifactTypeHierarchy() 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();
    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"));
}
Also used : ArrayList(java.util.ArrayList) ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) Test(org.junit.Test)

Example 24 with ServiceTemplateId

use of org.eclipse.winery.common.ids.definitions.ServiceTemplateId 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();
    TNodeTemplate nodeTemplateWithAbstractDA = topologyTemplate.getNodeTemplate("shetland_pony");
    TDeploymentArtifact deploymentArtifact = nodeTemplateWithAbstractDA.getDeploymentArtifacts().getDeploymentArtifact().get(0);
    QName artifactTypeQName = deploymentArtifact.getArtifactType();
    ArtifactTypeId artifactTypeId = new ArtifactTypeId(artifactTypeQName);
    TArtifactType artifactType = this.repository.getElement(artifactTypeId);
    assertEquals(artifactType.getTargetNamespace(), DASpecification.getArtifactTypeOfDA(nodeTemplateWithAbstractDA.getDeploymentArtifacts().getDeploymentArtifact().get(0)).getTargetNamespace());
    assertEquals(artifactType.getName(), DASpecification.getArtifactTypeOfDA(nodeTemplateWithAbstractDA.getDeploymentArtifacts().getDeploymentArtifact().get(0)).getName());
}
Also used : ArtifactTypeId(org.eclipse.winery.common.ids.definitions.ArtifactTypeId) QName(javax.xml.namespace.QName) ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) Test(org.junit.Test)

Example 25 with ServiceTemplateId

use of org.eclipse.winery.common.ids.definitions.ServiceTemplateId in project winery by eclipse.

the class DASpecificationTest method getNodesWithSuitableConcreteDAs.

@Test
public void getNodesWithSuitableConcreteDAs() throws Exception {
    setRevisionTo("5f63267261584a513dd8a9b7960687cc3dda910a");
    ServiceTemplateId id = new ServiceTemplateId("http://winery.opentosca.org/test/servicetemplates/ponyuniverse/daspecifier", "DASpecificationTest", false);
    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);
}
Also used : ServiceTemplateId(org.eclipse.winery.common.ids.definitions.ServiceTemplateId) Test(org.junit.Test)

Aggregations

ServiceTemplateId (org.eclipse.winery.common.ids.definitions.ServiceTemplateId)34 QName (javax.xml.namespace.QName)12 Test (org.junit.Test)12 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)9 URI (java.net.URI)6 Path (javax.ws.rs.Path)6 Produces (javax.ws.rs.Produces)6 TNodeTemplate (org.eclipse.winery.model.tosca.TNodeTemplate)6 RelationshipTypeId (org.eclipse.winery.common.ids.definitions.RelationshipTypeId)5 TTopologyTemplate (org.eclipse.winery.model.tosca.TTopologyTemplate)5 POST (javax.ws.rs.POST)4 ArtifactTemplateId (org.eclipse.winery.common.ids.definitions.ArtifactTemplateId)4 NonNull (org.eclipse.jdt.annotation.NonNull)3 CapabilityTypeId (org.eclipse.winery.common.ids.definitions.CapabilityTypeId)3 DefinitionsChildId (org.eclipse.winery.common.ids.definitions.DefinitionsChildId)3 RequirementTypeId (org.eclipse.winery.common.ids.definitions.RequirementTypeId)3 TDeploymentArtifact (org.eclipse.winery.model.tosca.TDeploymentArtifact)3 TRelationshipTemplate (org.eclipse.winery.model.tosca.TRelationshipTemplate)3 TServiceTemplate (org.eclipse.winery.model.tosca.TServiceTemplate)3