Search in sources :

Example 1 with InputProperty

use of org.opentosca.toscana.core.transformation.properties.InputProperty 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 2 with InputProperty

use of org.opentosca.toscana.core.transformation.properties.InputProperty 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)

Example 3 with InputProperty

use of org.opentosca.toscana.core.transformation.properties.InputProperty 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 4 with InputProperty

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

the class CloudFoundryLampITinput 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("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 : 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 InputProperty

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

the class CloudFoundryLampMultiNode 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)

Aggregations

InputProperty (org.opentosca.toscana.core.transformation.properties.InputProperty)6 HashSet (java.util.HashSet)5 Transformation (org.opentosca.toscana.core.transformation.Transformation)5 PropertyInstance (org.opentosca.toscana.core.transformation.properties.PropertyInstance)5 Test (org.junit.Test)1 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)1 EffectiveModel (org.opentosca.toscana.model.EffectiveModel)1 EffectiveModelFactory (org.opentosca.toscana.model.EffectiveModelFactory)1