Search in sources :

Example 11 with EffectiveModelFactory

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

the class LinkResolverTest method resolveRequirementLink.

@Test
public void resolveRequirementLink() {
    EffectiveModel model = new EffectiveModelFactory().create(REQUIREMENT, logMock());
    WebServer node = (WebServer) model.getNodeMap().get("test-node1");
    HostRequirement requirement = node.getHost();
    assertNotNull(requirement);
    Set<Compute> fulfillers = requirement.getFulfillers();
    assertEquals(1, fulfillers.size());
    Compute fulfiller = fulfillers.iterator().next();
    assertEquals("test-node2", fulfiller.getEntityName());
}
Also used : WebServer(org.opentosca.toscana.model.node.WebServer) HostRequirement(org.opentosca.toscana.model.requirement.HostRequirement) 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 12 with EffectiveModelFactory

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

the class LinkResolverTest method resolveRepositoryLink.

@Test
public void resolveRepositoryLink() {
    EffectiveModel model = new EffectiveModelFactory().create(REPOSITORY, logMock());
    WebServer node = (WebServer) model.getNodeMap().get("test-node");
    Set<Artifact> artifacts = node.getArtifacts();
    Artifact artifact = artifacts.iterator().next();
    assertNotNull(artifact);
    Optional<Repository> repo = artifact.getRepository();
    assertTrue(repo.isPresent());
    assertEquals("http://test.repo.com/", repo.get().getUrl());
}
Also used : Repository(org.opentosca.toscana.model.artifact.Repository) WebServer(org.opentosca.toscana.model.node.WebServer) 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 13 with EffectiveModelFactory

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

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

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

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