Search in sources :

Example 11 with EffectiveModel

use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.

the class EffectiveModelSetterTest method setUp.

@Before
public void setUp() {
    EffectiveModel model = new EffectiveModelFactory().create(TestTemplates.Nodes.SOFTWARE_COMPONENT, logMock());
    component = (SoftwareComponent) model.getNodeMap().get("software_component");
    model = new EffectiveModelFactory().create(TestCsars.VALID_SINGLE_COMPUTE_WINDOWS_TEMPLATE, logMock());
    this.compute = (Compute) model.getNodes().iterator().next();
}
Also used : EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) Before(org.junit.Before)

Example 12 with EffectiveModel

use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.

the class EffectiveModelTest method inputTest.

@Test
public void inputTest() {
    EffectiveModel model = new EffectiveModelFactory().create(TestCsars.Testing.INPUTS_TEMPLATE, logMock());
    Map<String, InputProperty> inputs = model.getInputs();
    assertNotNull(inputs);
    assertEquals(4, inputs.size());
    InputProperty input = inputs.get("string-input");
    assertNotNull(input);
    assertTrue(input.getDescription().isPresent());
    assertEquals("description1", input.getDescription().get());
    assertTrue(input.isRequired());
}
Also used : InputProperty(org.opentosca.toscana.core.transformation.properties.InputProperty) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 13 with EffectiveModel

use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.

the class NodeConvertTest method softwareComponent.

@Test
public void softwareComponent() {
    EffectiveModel model = new EffectiveModelFactory().create(SOFTWARE_COMPONENT, logMock());
    SoftwareComponent softwareComponent = (SoftwareComponent) model.getNodes().iterator().next();
    Credential credential = softwareComponent.getAdminCredential().get();
    assertEquals("securePassword", credential.getToken());
    assertEquals("alice", credential.getUser().get());
    assertEquals("3.5.1", softwareComponent.getComponentVersion().get());
}
Also used : Credential(org.opentosca.toscana.model.datatype.Credential) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) SoftwareComponent(org.opentosca.toscana.model.node.SoftwareComponent) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 14 with EffectiveModel

use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.

the class ScalableCapabilityTest method scalableTest.

@Test
public void scalableTest() {
    EffectiveModel model = new EffectiveModelFactory().create(TestTemplates.Capabilities.SCALABLE, logMock());
    Compute compute = (Compute) model.getNodes().iterator().next();
    ScalableCapability scalable = compute.getScalable();
    assertEquals(5, (int) scalable.getMinInstances());
    assertEquals(7, (int) scalable.getDefaultInstances().get());
    assertEquals(Integer.MAX_VALUE, (int) scalable.getMaxInstances());
}
Also used : ScalableCapability(org.opentosca.toscana.model.capability.ScalableCapability) Compute(org.opentosca.toscana.model.node.Compute) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 15 with EffectiveModel

use of org.opentosca.toscana.model.EffectiveModel in project TOSCAna by StuPro-TOSCAna.

the class TemplateConverterTest method dockerConverter.

@Test
public void dockerConverter() {
    EffectiveModel model = new EffectiveModelFactory().create(TestCsars.VALID_MINIMAL_DOCKER_TEMPLATE, logMock());
    assertNotNull(model);
    DockerApplication dockerApp = (DockerApplication) model.getNodeMap().get("simpleTaskApp");
    DockerHostRequirement host = dockerApp.getDockerHost();
    host.getFulfillers().stream().findFirst().get();
}
Also used : DockerApplication(org.opentosca.toscana.model.node.DockerApplication) DockerHostRequirement(org.opentosca.toscana.model.requirement.DockerHostRequirement) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Aggregations

EffectiveModel (org.opentosca.toscana.model.EffectiveModel)33 EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)31 Test (org.junit.Test)22 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)22 File (java.io.File)9 Before (org.junit.Before)9 PluginFileAccess (org.opentosca.toscana.core.plugin.PluginFileAccess)5 Database (org.opentosca.toscana.model.node.Database)5 Application (org.opentosca.toscana.plugins.cloudfoundry.application.Application)5 Log (org.opentosca.toscana.core.transformation.logging.Log)4 WebApplication (org.opentosca.toscana.model.node.WebApplication)4 Artifact (org.opentosca.toscana.model.artifact.Artifact)3 WebServer (org.opentosca.toscana.model.node.WebServer)3 FileCreator (org.opentosca.toscana.plugins.cloudfoundry.filecreator.FileCreator)3 ArrayList (java.util.ArrayList)2 CsarImpl (org.opentosca.toscana.core.csar.CsarImpl)2 PropertyInstance (org.opentosca.toscana.core.transformation.properties.PropertyInstance)2 EndpointCapability (org.opentosca.toscana.model.capability.EndpointCapability)2 Compute (org.opentosca.toscana.model.node.Compute)2 RootNode (org.opentosca.toscana.model.node.RootNode)2