use of org.opentosca.toscana.model.EffectiveModelFactory in project TOSCAna by StuPro-TOSCAna.
the class DynamicRequirementTest method dynamicRequirementTest.
@Test
public void dynamicRequirementTest() {
EffectiveModel model = new EffectiveModelFactory().create(TestTemplates.Requirements.DYNAMIC_REQUIREMENT, logMock());
WebApplication app = (WebApplication) model.getNodes().iterator().next();
Requirement<? extends Capability, ? extends RootNode, ? extends RootRelationship> dynamicRequirement = app.getRequirements().stream().filter(r -> "dynamic-requirement".equals(r.getEntityName())).findFirst().orElseThrow(() -> new IllegalStateException("dynamic requirement should exist"));
RootRelationship relationship = dynamicRequirement.getRelationship().get();
assertEquals(ConnectsTo.class, relationship.getClass());
Capability capability = dynamicRequirement.get(dynamicRequirement.CAPABILITY);
assertEquals(EndpointCapability.class, capability.getClass());
RootNode fulfiller = dynamicRequirement.getFulfillers().iterator().next();
assertEquals(app, fulfiller);
}
use of org.opentosca.toscana.model.EffectiveModelFactory in project TOSCAna by StuPro-TOSCAna.
the class EffectiveModelTest method outputTest.
@Test
public void outputTest() {
EffectiveModel model = new EffectiveModelFactory().create(TestCsars.Testing.OUTPUTS_TEMPLATE, logMock());
Map<String, OutputProperty> outputs = model.getOutputs();
assertNotNull(outputs);
assertEquals(1, outputs.size());
OutputProperty linkedOutput = outputs.get("test_output_linked");
assertNotNull(linkedOutput);
assertTrue(linkedOutput.getDescription().isPresent());
assertEquals("test-description2", linkedOutput.getDescription().get());
assertTrue(linkedOutput.getValue().isPresent());
assertEquals("8084", linkedOutput.getValue().get());
}
use of org.opentosca.toscana.model.EffectiveModelFactory in project TOSCAna by StuPro-TOSCAna.
the class NodeConvertTest method java.
@Test
public void java() {
EffectiveModel model = new EffectiveModelFactory().create(JAVA, logMock());
JavaApplication app = (JavaApplication) model.getNodeMap().get("app");
assertEquals("test-vm_options", app.getVmOptions().get());
assertEquals("test-arguments", app.getArguments().get());
Artifact artifact = app.getJar();
assertEquals("test-artifact-path", artifact.getFilePath());
JavaRuntime jre = (JavaRuntime) model.getNodeMap().get("jre");
assertEquals("1.8", jre.getComponentVersion().get());
}
use of org.opentosca.toscana.model.EffectiveModelFactory in project TOSCAna by StuPro-TOSCAna.
the class TemplateConverterTest method lampNoInputConverter.
@Test
public void lampNoInputConverter() {
EffectiveModel model = new EffectiveModelFactory().create(TestCsars.VALID_LAMP_NO_INPUT_TEMPLATE, logMock());
assertNotNull(model);
}
use of org.opentosca.toscana.model.EffectiveModelFactory in project TOSCAna by StuPro-TOSCAna.
the class TemplateConverterTest method lampInputConverter.
@Test
public void lampInputConverter() {
EffectiveModel model = new EffectiveModelFactory().create(TestCsars.VALID_LAMP_INPUT_TEMPLATE, logMock());
assertNotNull(model);
}
Aggregations