use of org.eclipse.winery.model.ids.definitions.ServiceTemplateId in project winery by eclipse.
the class DriverInjectionTest method setDriverProperty.
@Test
public void setDriverProperty() throws Exception {
setRevisionTo("d8ee55deecf37f5052d27807df691a7b70ec50f2");
ServiceTemplateId id = new ServiceTemplateId("http://winery.opentosca.org/test/servicetemplates/ponyuniverse/daspecifier", "DASpecificationTest", false);
TTopologyTemplate topologyTemplate = this.repository.getElement(id).getTopologyTemplate();
TRelationshipTemplate relationshipTemplate = topologyTemplate.getRelationshipTemplate("con_71");
TDeploymentArtifact deploymentArtifact = topologyTemplate.getNodeTemplate("dressageequipment").getDeploymentArtifacts().stream().filter(da -> da.getName().equalsIgnoreCase("DressageEquipment_Pony")).findFirst().get();
DriverInjection.setDriverProperty(relationshipTemplate, deploymentArtifact);
assertEquals("org.test.dressagedriver", ModelUtilities.getPropertiesKV(relationshipTemplate).get("Driver"));
}
use of org.eclipse.winery.model.ids.definitions.ServiceTemplateId in project winery by eclipse.
the class SplittingTest method initialize.
@BeforeEach
public void initialize() throws Exception {
ServiceTemplateId id = new ServiceTemplateId("http://www.example.org", "ST", false);
ServiceTemplateId id2 = new ServiceTemplateId("http://opentosca.org/servicetemplates", "FlinkApp_Demo_Small_On_OpenStack", false);
assertTrue(RepositoryFactory.getRepository().exists(id));
assertTrue(RepositoryFactory.getRepository().exists(id2));
final TServiceTemplate serviceTemplate = this.repository.getElement(id);
topologyTemplate = serviceTemplate.getTopologyTemplate();
topologyTemplate2 = serviceTemplate.getTopologyTemplate();
}
use of org.eclipse.winery.model.ids.definitions.ServiceTemplateId in project winery by eclipse.
the class SplittingTest method testmatchingofSplittingTopology.
@Test
public void testmatchingofSplittingTopology() throws Exception {
ServiceTemplateId serviceTemplateId = new ServiceTemplateId("http://opentosca.org/servicetemplates", "Abstract_PHPApp_MySQLDB_MotivatingScenario_Splitting-split", false);
Assertions.assertTrue(this.repository.exists(serviceTemplateId));
final TServiceTemplate serviceTemplate = repository.getElement(serviceTemplateId);
TTopologyTemplate topologyTemplateMatching = serviceTemplate.getTopologyTemplate();
List<String> expectedIds = Arrays.asList("PHP-5-WebApplication", "Java7", "MySQL-DB", "PHP-5-Module", "Apache-2.4", "Ubuntu-14.04-VM-OnPremiseIAAS", "OpenStack-Liberty-12-OnPremiseIAAS", "AmazonBeanstalk", "AmazonRDS");
List<TNodeTemplate> NodeTemplates = splitting.hostMatchingWithDefaultHostSelection(topologyTemplateMatching).getNodeTemplateOrRelationshipTemplate().stream().filter(t -> t instanceof TNodeTemplate).map(TNodeTemplate.class::cast).collect(Collectors.toList());
List<String> Ids = new ArrayList<>();
for (TNodeTemplate nodeTemplate : NodeTemplates) {
Ids.add(nodeTemplate.getId());
}
Assertions.assertEquals(expectedIds, Ids);
}
use of org.eclipse.winery.model.ids.definitions.ServiceTemplateId in project winery by eclipse.
the class MinExternalConnectionsTest method filter.
@Test
public void filter() throws Exception {
ServiceTemplateId id = new ServiceTemplateId("http://www.winery.opentosca.org/test/targetallocation/servicetemplates", "MinExternalConnectionsTest1", false);
TTopologyTemplate twoExternal = repository.getElement(id).getTopologyTemplate();
ModelUtilities.setTargetLabel(twoExternal.getNodeTemplate("shetland_pony_2"), "PastureProvider");
ModelUtilities.setTargetLabel(twoExternal.getNodeTemplate("shetland_pony_3"), "PastureProvider");
TTopologyTemplate oneExternal = AllocationUtils.deepCopy(twoExternal);
ModelUtilities.setTargetLabel(oneExternal.getNodeTemplate("shetland_pony_2"), "FieldProvider");
ModelUtilities.setTargetLabel(oneExternal.getNodeTemplate("shetland_pony_3"), "FieldProvider");
List<TopologyWrapper> topologies = new ArrayList<>();
topologies.add(new TopologyWrapper(twoExternal));
topologies.add(new TopologyWrapper(oneExternal));
Criteria minExternalConnections = new MinExternalConnections(null, Integer.MAX_VALUE);
List<TopologyWrapper> filtered = minExternalConnections.filter(topologies);
assertEquals(1, filtered.size());
TTopologyTemplate result = filtered.get(0).getTopology();
assertEquals("PastureProvider".toLowerCase(), ModelUtilities.getTargetLabel(result.getNodeTemplate("shetland_pony")).get());
assertEquals("FieldProvider".toLowerCase(), ModelUtilities.getTargetLabel(result.getNodeTemplate("shetland_pony_2")).get());
assertEquals("FieldProvider".toLowerCase(), ModelUtilities.getTargetLabel(result.getNodeTemplate("shetland_pony_3")).get());
assertEquals("FieldProvider".toLowerCase(), ModelUtilities.getTargetLabel(result.getNodeTemplate("shetland_pony_4")).get());
}
use of org.eclipse.winery.model.ids.definitions.ServiceTemplateId in project winery by eclipse.
the class AllocationUtilsTest method setUp.
@BeforeEach
public void setUp() throws GitAPIException {
setRevisionTo("bb9ff7e08f7b72d30a2fae326740ef8051701671");
ServiceTemplateId id = new ServiceTemplateId("http://www.winery.opentosca.org/test/targetallocation/servicetemplates", "TargetAllocationFulfillPoliciesTest1", false);
topology = repository.getElement(id).getTopologyTemplate();
}
Aggregations