Search in sources :

Example 1 with WebServer

use of org.opentosca.toscana.model.node.WebServer 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 2 with WebServer

use of org.opentosca.toscana.model.node.WebServer 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 3 with WebServer

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

Aggregations

Test (org.junit.Test)3 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)3 EffectiveModel (org.opentosca.toscana.model.EffectiveModel)3 EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)3 WebServer (org.opentosca.toscana.model.node.WebServer)3 Artifact (org.opentosca.toscana.model.artifact.Artifact)2 Repository (org.opentosca.toscana.model.artifact.Repository)1 Compute (org.opentosca.toscana.model.node.Compute)1 Operation (org.opentosca.toscana.model.operation.Operation)1 HostRequirement (org.opentosca.toscana.model.requirement.HostRequirement)1