Search in sources :

Example 16 with EffectiveModel

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

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

Example 18 with EffectiveModel

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

the class IntrinsicFunctionResolverTest method getPropertyTest.

@Test
public void getPropertyTest() {
    EffectiveModel model = new EffectiveModelFactory().create(GET_PROPERTY, logMock());
    Database database = (Database) model.getNodeMap().get("my_second_db");
    assertEquals("my_db_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 19 with EffectiveModel

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

the class IntrinsicFunctionResolverTest method correctPropertyNameTest.

/**
 *     Tests whether names of linked properties are correct
 */
@Test
public void correctPropertyNameTest() {
    EffectiveModel model = new EffectiveModelFactory().create(GET_PROPERTY_IN_INPUT, logMock());
    Database myApp = (Database) model.getNodeMap().get("my_db");
    OperationVariable input = myApp.getStandardLifecycle().getConfigure().get().getInputs().iterator().next();
    assertEquals("correct-name", input.getKey());
    assertEquals("test-string", 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)

Example 20 with EffectiveModel

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

the class IntrinsicFunctionResolverTest method getInputTest.

@Test
public void getInputTest() {
    EffectiveModel model = new EffectiveModelFactory().create(GET_INPUT, logMock());
    Database database = (Database) model.getNodeMap().get("my_db");
    assertEquals("my_db_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)

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