Search in sources :

Example 1 with PropertyInstance

use of org.opentosca.toscana.core.transformation.properties.PropertyInstance in project TOSCAna by StuPro-TOSCAna.

the class DeploymentPropertyTest method check.

@Test
public void check() {
    try {
        File input = new File(this.tmpdir, "in");
        File output = new File(this.tmpdir, "out");
        PropertyInstance instance = new PropertyInstance(new HashSet<>(platform.properties), mock(Transformation.class));
        if (this.input != null) {
            instance.set(Platform.DEPLOY_AFTER_TRANSFORMATION_KEY, this.input);
        }
        Csar csar = new CsarImpl(input, "csarId", logMock());
        Transformation t = new TransformationImpl(csar, platform, logMock(), mock(EffectiveModel.class));
        Transformation transformation = spy(t);
        when(transformation.getInputs()).thenReturn(instance);
        TransformationContext context = new TransformationContext(transformation, output);
        Assert.assertEquals(expected, context.performDeployment());
    } catch (Exception e) {
        e.printStackTrace(System.out);
        if (expectedException == null || !expectedException.isInstance(e)) {
            fail();
        }
    }
}
Also used : Csar(org.opentosca.toscana.core.csar.Csar) TransformationImpl(org.opentosca.toscana.core.transformation.TransformationImpl) Transformation(org.opentosca.toscana.core.transformation.Transformation) CsarImpl(org.opentosca.toscana.core.csar.CsarImpl) PropertyInstance(org.opentosca.toscana.core.transformation.properties.PropertyInstance) File(java.io.File) TransformationContext(org.opentosca.toscana.core.transformation.TransformationContext) EffectiveModel(org.opentosca.toscana.model.EffectiveModel) NoSuchPropertyException(org.opentosca.toscana.core.transformation.properties.NoSuchPropertyException) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 2 with PropertyInstance

use of org.opentosca.toscana.core.transformation.properties.PropertyInstance in project TOSCAna by StuPro-TOSCAna.

the class CloudFormationLampIT method getInputs.

@Override
protected PropertyInstance getInputs(EffectiveModel model) throws NoSuchPropertyException {
    PropertyInstance props = new PropertyInstance(new HashSet<>(plugin.getPlatform().properties), mock(Transformation.class));
    props.set(AWS_ACCESS_KEY_ID_KEY, accessKey);
    props.set(AWS_SECRET_KEY_KEY, secretKey);
    props.set(AWS_KEYPAIR_KEY, "true");
    return props;
}
Also used : Transformation(org.opentosca.toscana.core.transformation.Transformation) PropertyInstance(org.opentosca.toscana.core.transformation.properties.PropertyInstance)

Example 3 with PropertyInstance

use of org.opentosca.toscana.core.transformation.properties.PropertyInstance in project TOSCAna by StuPro-TOSCAna.

the class CloudFoundryJavaIT method getInputs.

@Override
protected PropertyInstance getInputs(EffectiveModel model) throws NoSuchPropertyException {
    PropertyInstance props = super.getInputs(model);
    props.set("database_name", "name");
    props.set("database_user", "user");
    props.set("database_port", "3333");
    props.set("database_password", "secrets");
    props.set(CF_PROPERTY_KEY_USERNAME, envUser);
    props.set(CF_PROPERTY_KEY_PASSWORD, envPw);
    props.set(CF_PROPERTY_KEY_API, envHost);
    props.set(CF_PROPERTY_KEY_ORGANIZATION, envOrga);
    props.set(CF_PROPERTY_KEY_SPACE, envSpace);
    return props;
}
Also used : PropertyInstance(org.opentosca.toscana.core.transformation.properties.PropertyInstance)

Example 4 with PropertyInstance

use of org.opentosca.toscana.core.transformation.properties.PropertyInstance in project TOSCAna by StuPro-TOSCAna.

the class CloudFoundryLampIT method getInputs.

protected PropertyInstance getInputs(EffectiveModel model) throws NoSuchPropertyException {
    Set<InputProperty> prop = new HashSet<>(plugin.getPlatform().properties);
    prop.addAll(model.getInputs().values());
    PropertyInstance props = new PropertyInstance(prop, mock(Transformation.class));
    props.set(CF_PROPERTY_KEY_USERNAME, envUser);
    props.set(CF_PROPERTY_KEY_PASSWORD, envPw);
    props.set(CF_PROPERTY_KEY_API, envHost);
    props.set(CF_PROPERTY_KEY_ORGANIZATION, envOrga);
    props.set(CF_PROPERTY_KEY_SPACE, envSpace);
    return props;
}
Also used : Transformation(org.opentosca.toscana.core.transformation.Transformation) InputProperty(org.opentosca.toscana.core.transformation.properties.InputProperty) PropertyInstance(org.opentosca.toscana.core.transformation.properties.PropertyInstance) HashSet(java.util.HashSet)

Example 5 with PropertyInstance

use of org.opentosca.toscana.core.transformation.properties.PropertyInstance in project TOSCAna by StuPro-TOSCAna.

the class KubernetesLampIT method getInputs.

@Override
protected PropertyInstance getInputs(EffectiveModel model) throws NoSuchPropertyException {
    Set<InputProperty> prop = new HashSet<>(plugin.getPlatform().properties);
    prop.addAll(model.getInputs().values());
    PropertyInstance instance = new PropertyInstance(prop, mock(Transformation.class));
    if (System.getenv("DH_USERNAME") != null) {
        // This Transformation is performed by pushing to a registry
        instance.set(DOCKER_PUSH_TO_REGISTRY_PROPERTY_KEY, "true");
        instance.set(DOCKER_REGISTRY_USERNAME_PROPERTY_KEY, System.getenv("DH_USERNAME"));
        instance.set(DOCKER_REGISTRY_PASSWORD_PROPERTY_KEY, System.getenv("DH_PASSWORD"));
        instance.set(DOCKER_REGISTRY_URL_PROPERTY_KEY, System.getenv("DH_URL"));
        instance.set(DOCKER_REGISTRY_REPOSITORY_PROPERTY_KEY, System.getenv("DH_REPOSITORY"));
    } else {
        // This Transformation is performed by storing the files in Tar archives
        instance.set(DOCKER_PUSH_TO_REGISTRY_PROPERTY_KEY, "false");
    }
    return instance;
}
Also used : Transformation(org.opentosca.toscana.core.transformation.Transformation) InputProperty(org.opentosca.toscana.core.transformation.properties.InputProperty) PropertyInstance(org.opentosca.toscana.core.transformation.properties.PropertyInstance) HashSet(java.util.HashSet)

Aggregations

PropertyInstance (org.opentosca.toscana.core.transformation.properties.PropertyInstance)11 Transformation (org.opentosca.toscana.core.transformation.Transformation)9 HashSet (java.util.HashSet)6 InputProperty (org.opentosca.toscana.core.transformation.properties.InputProperty)5 Csar (org.opentosca.toscana.core.csar.Csar)2 NoSuchPropertyException (org.opentosca.toscana.core.transformation.properties.NoSuchPropertyException)2 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 IllegalTransformationStateException (org.opentosca.toscana.api.exceptions.IllegalTransformationStateException)1 GetInputsResponse (org.opentosca.toscana.api.model.GetInputsResponse)1 InputWrap (org.opentosca.toscana.api.model.InputWrap)1 InputsResponse (org.opentosca.toscana.api.model.InputsResponse)1 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)1 CsarImpl (org.opentosca.toscana.core.csar.CsarImpl)1 TransformationContext (org.opentosca.toscana.core.transformation.TransformationContext)1 TransformationImpl (org.opentosca.toscana.core.transformation.TransformationImpl)1 TransformationState (org.opentosca.toscana.core.transformation.TransformationState)1