Search in sources :

Example 6 with EffectiveModelFactory

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

the class KubernetesPluginTest method modelCheckTest.

@Test(expected = ValidationFailureException.class)
public void modelCheckTest() throws Exception {
    EffectiveModel singleComputeModel = new EffectiveModelFactory().create(TestCsars.VALID_SINGLE_COMPUTE_WINDOWS_TEMPLATE, logMock());
    TransformationContext context = setUpMockTransformationContext(singleComputeModel);
    KubernetesLifecycle lifecycle = plugin.getInstance(context);
    plugin.transform(lifecycle);
}
Also used : KubernetesLifecycle(org.opentosca.toscana.plugins.kubernetes.lifecycle.KubernetesLifecycle) TransformationContext(org.opentosca.toscana.core.transformation.TransformationContext) TestUtil.setUpMockTransformationContext(org.opentosca.toscana.plugins.util.TestUtil.setUpMockTransformationContext) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) MapperTest(org.opentosca.toscana.plugins.kubernetes.docker.mapper.MapperTest) Test(org.junit.Test)

Example 7 with EffectiveModelFactory

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

the class TestNodeStacks method getLampNodeStacks.

public static Set<NodeStack> getLampNodeStacks(Log log) {
    Map<String, RootNode> map = new EffectiveModelFactory().create(TestCsars.VALID_LAMP_NO_INPUT_TEMPLATE, log).getNodeMap();
    List<KubernetesNodeContainer> webAppNodes = new LinkedList<>();
    KubernetesNodeContainer computeContainer = new KubernetesNodeContainer(map.get("server"));
    computeContainer.hasParentComputeNode();
    webAppNodes.add(new KubernetesNodeContainer(map.get("my_app")));
    webAppNodes.add(new KubernetesNodeContainer(map.get("apache_web_server")));
    webAppNodes.add(computeContainer);
    NodeStack webAppNodeStack = new NodeStack(webAppNodes);
    // Manualy set the docker image tag (used for testing the ResourceFileCreator)
    webAppNodeStack.setDockerImageTag("my-app");
    return Sets.newHashSet(webAppNodeStack);
}
Also used : RootNode(org.opentosca.toscana.model.node.RootNode) KubernetesNodeContainer(org.opentosca.toscana.plugins.kubernetes.util.KubernetesNodeContainer) NodeStack(org.opentosca.toscana.plugins.kubernetes.util.NodeStack) EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) LinkedList(java.util.LinkedList)

Example 8 with EffectiveModelFactory

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

the class CsarImpl method parseValidate.

private boolean parseValidate() {
    LifecyclePhase phase = getLifecyclePhase(Csar.Phase.PARSE);
    phase.setState(LifecyclePhase.State.EXECUTING);
    logger.info("  > Constructing model from TOSCA template");
    try {
        new EffectiveModelFactory().create(this);
        logger.info("Model construction successful");
        phase.setState(LifecyclePhase.State.DONE);
        return true;
    } catch (Exception e) {
        logger.error("Model construction failed", this.identifier, e);
        phase.setState(LifecyclePhase.State.FAILED);
        return false;
    }
}
Also used : EffectiveModelFactory(org.opentosca.toscana.model.EffectiveModelFactory) MultiException(org.eclipse.winery.yaml.common.exception.MultiException) InvalidCsarException(org.opentosca.toscana.core.parse.InvalidCsarException) LifecyclePhase(org.opentosca.toscana.core.plugin.lifecycle.LifecyclePhase)

Example 9 with EffectiveModelFactory

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

the class EntrypointDetectorTest method parseEntrypointMissing.

@Test(expected = InvalidCsarException.class)
public void parseEntrypointMissing() throws FileNotFoundException, InvalidCsarException {
    Csar csar = testCsars.getCsar(TestCsars.Testing.ENTRYPOINT_MISSING);
    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 10 with EffectiveModelFactory

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

the class EntrypointDetectorTest method parseEntrypointAmbiguous.

@Test(expected = InvalidCsarException.class)
public void parseEntrypointAmbiguous() throws FileNotFoundException, InvalidCsarException {
    Csar csar = testCsars.getCsar(TestCsars.Testing.ENTRYPOINT_AMBIGUOUS);
    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)

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