Search in sources :

Example 16 with EffectiveModelFactory

use of org.opentosca.toscana.model.EffectiveModelFactory 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 17 with EffectiveModelFactory

use of org.opentosca.toscana.model.EffectiveModelFactory 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)

Example 18 with EffectiveModelFactory

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

the class EntrypointDetectorTest method parseValidCsar.

@Test
public void parseValidCsar() throws Exception {
    Csar csar = testCsars.getCsar(TestCsars.Testing.EMPTY_TOPOLOGY);
    new EffectiveModelFactory().create(csar);
}
Also used : Csar(org.opentosca.toscana.core.csar.Csar) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseSpringTest(org.opentosca.toscana.core.BaseSpringTest) Test(org.junit.Test)

Example 19 with EffectiveModelFactory

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

the class IntrinsicFunctionResolverTest method getPropertySelfTest.

@Test
public void getPropertySelfTest() {
    EffectiveModel model = new EffectiveModelFactory().create(GET_PROPERTY_SELF, logMock());
    Database database = (Database) model.getNodeMap().get("my_db");
    assertEquals("my_user_name", database.getDatabaseName());
}
Also used : Database(org.opentosca.toscana.model.node.Database) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 20 with EffectiveModelFactory

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

the class IntrinsicFunctionResolverTest method getNestedPropertyTest.

@Test
public void getNestedPropertyTest() {
    EffectiveModel model = new EffectiveModelFactory().create(GET_PROPERTY_IN_INTERFACE, logMock());
    Database database = (Database) model.getNodeMap().get("my_db");
    Set<OperationVariable> inputs = database.getStandardLifecycle().getConfigure().get().getInputs();
    OperationVariable input = inputs.stream().findFirst().orElse(null);
    assertEquals("my_user_name", input.getValue().get());
}
Also used : OperationVariable(org.opentosca.toscana.model.operation.OperationVariable) Database(org.opentosca.toscana.model.node.Database) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Aggregations

EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)37 EffectiveModel (org.opentosca.toscana.model.EffectiveModel)31 Test (org.junit.Test)25 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)22 File (java.io.File)10 Before (org.junit.Before)10 PluginFileAccess (org.opentosca.toscana.core.plugin.PluginFileAccess)6 Database (org.opentosca.toscana.model.node.Database)5 Application (org.opentosca.toscana.plugins.cloudfoundry.application.Application)5 WebApplication (org.opentosca.toscana.model.node.WebApplication)4 BaseSpringTest (org.opentosca.toscana.core.BaseSpringTest)3 Csar (org.opentosca.toscana.core.csar.Csar)3 Log (org.opentosca.toscana.core.transformation.logging.Log)3 Artifact (org.opentosca.toscana.model.artifact.Artifact)3 RootNode (org.opentosca.toscana.model.node.RootNode)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 TransformationContext (org.opentosca.toscana.core.transformation.TransformationContext)2