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);
}
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);
}
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"));
}
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());
}
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);
}
Aggregations