Search in sources :

Example 21 with EffectiveModelFactory

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

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

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

Example 24 with EffectiveModelFactory

use of org.opentosca.toscana.model.EffectiveModelFactory 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());
}
Also used : WebServer(org.opentosca.toscana.model.node.WebServer) Operation(org.opentosca.toscana.model.operation.Operation) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) Artifact(org.opentosca.toscana.model.artifact.Artifact) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 25 with EffectiveModelFactory

use of org.opentosca.toscana.model.EffectiveModelFactory 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());
}
Also used : Port(org.opentosca.toscana.model.datatype.Port) WebApplication(org.opentosca.toscana.model.node.WebApplication) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) EndpointCapability(org.opentosca.toscana.model.capability.EndpointCapability) 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