use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class LinkResolverTest method resolveImplementationLink.
@Test
public void resolveImplementationLink() {
EffectiveModel model = new EffectiveModelFactory().create(ARTIFACT, logMock());
WebServer node = (WebServer) model.getNodeMap().get("test-node");
Optional<Operation> create = node.getStandardLifecycle().getCreate();
assertTrue(create.isPresent());
Optional<Artifact> artifact = create.get().getArtifact();
assertTrue(artifact.isPresent());
assertEquals("test-file", artifact.get().getFilePath());
}
use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.
the class DataTypeTest method portTest.
@Test
public void portTest() {
EffectiveModel model = new EffectiveModelFactory().create(TestTemplates.Datatypes.PORT, logMock());
WebApplication app = (WebApplication) model.getNodes().iterator().next();
EndpointCapability endpoint = app.getAppEndpoint();
assertEquals(new Port(3000), endpoint.getPort().get());
Port expected = new Port(4000);
endpoint.setPort(expected);
assertEquals(expected, endpoint.getPort().get());
}
use of org.opentosca.toscana.model.EffectiveModel 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.EffectiveModel 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.EffectiveModel 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());
}
Aggregations