Search in sources :

Example 6 with LifecyclePhase

use of org.opentosca.toscana.core.plugin.lifecycle.LifecyclePhase in project TOSCAna by StuPro-TOSCAna.

the class CsarImpl method wineryValidate.

private boolean wineryValidate() {
    LifecyclePhase phase = getLifecyclePhase(Csar.Phase.VALIDATE);
    phase.setState(LifecyclePhase.State.EXECUTING);
    logger.info("Validating csar '{}'", identifier);
    logger.debug("  > Validating TOSCA template", identifier);
    try {
        Reader.getReader().parse(Paths.get(this.contentDir.toString()), Paths.get(getTemplate().toString()));
        logger.info("Template validation successful");
        phase.setState(LifecyclePhase.State.DONE);
        return true;
    } catch (InvalidCsarException e) {
        logger.error("Template validation failed");
        phase.setState(LifecyclePhase.State.FAILED);
        return false;
    } catch (MultiException e) {
        logger.error("Template validation failed", e);
        phase.setState(LifecyclePhase.State.FAILED);
        return false;
    }
}
Also used : MultiException(org.eclipse.winery.yaml.common.exception.MultiException) LifecyclePhase(org.opentosca.toscana.core.plugin.lifecycle.LifecyclePhase) InvalidCsarException(org.opentosca.toscana.core.parse.InvalidCsarException)

Aggregations

LifecyclePhase (org.opentosca.toscana.core.plugin.lifecycle.LifecyclePhase)6 File (java.io.File)3 MultiException (org.eclipse.winery.yaml.common.exception.MultiException)2 InvalidCsarException (org.opentosca.toscana.core.parse.InvalidCsarException)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 ZipInputStream (java.util.zip.ZipInputStream)1 Test (org.junit.Test)1 BaseSpringTest (org.opentosca.toscana.core.BaseSpringTest)1 Transformation (org.opentosca.toscana.core.transformation.Transformation)1 EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)1 Logger (org.slf4j.Logger)1