Search in sources :

Example 1 with Platform

use of org.opentosca.toscana.core.transformation.platform.Platform in project TOSCAna by StuPro-TOSCAna.

the class CloudFoundryPlugin method getPlatformDetails.

private static Platform getPlatformDetails() {
    String platformId = "cloud-foundry";
    String platformName = "CloudFoundry";
    Set<PlatformInput> platformProperties = new HashSet<>();
    PlatformInput cfUserName = new PlatformInput(CF_PROPERTY_KEY_USERNAME, PropertyType.TEXT, "Username of CloudFoundry provideraccount", true);
    PlatformInput cfUserPw = new PlatformInput(CF_PROPERTY_KEY_PASSWORD, PropertyType.SECRET, "Password of CloudFoundry provideraccount", true);
    PlatformInput cfEndpoint = new PlatformInput(CF_PROPERTY_KEY_API, PropertyType.TEXT, "The endpoint of the provider", true);
    PlatformInput cfSpace = new PlatformInput(CF_PROPERTY_KEY_SPACE, PropertyType.TEXT, "The space of the useraccount which should be used to deploy", true);
    PlatformInput cfOrganization = new PlatformInput(CF_PROPERTY_KEY_ORGANIZATION, PropertyType.TEXT, "The organization of the useraccount which should be used to deploy", true);
    platformProperties.add(cfUserName);
    platformProperties.add(cfUserPw);
    platformProperties.add(cfEndpoint);
    platformProperties.add(cfSpace);
    platformProperties.add(cfOrganization);
    return new Platform(platformId, platformName, platformProperties);
}
Also used : Platform(org.opentosca.toscana.core.transformation.platform.Platform) PlatformInput(org.opentosca.toscana.core.transformation.properties.PlatformInput) HashSet(java.util.HashSet)

Example 2 with Platform

use of org.opentosca.toscana.core.transformation.platform.Platform in project TOSCAna by StuPro-TOSCAna.

the class TestPlugins method createFakeTransformationsOnDisk.

/**
 *     In given csarTransformationsDir, creates for every given target platform a fake transformation on disk <p>
 *     Attention: Best is to use platforms which are supported by a plugin -- use TestPlugins.PLATFORMS
 *
 *     @param csarTransformationsDir the absolute path of {csarid}/transformations
 */
public static void createFakeTransformationsOnDisk(File csarTransformationsDir, Set<Platform> targetPlatforms) {
    for (Platform platform : targetPlatforms) {
        File transformationDir = new File(csarTransformationsDir, platform.id);
        transformationDir.mkdir();
    }
}
Also used : Platform(org.opentosca.toscana.core.transformation.platform.Platform) File(java.io.File)

Example 3 with Platform

use of org.opentosca.toscana.core.transformation.platform.Platform in project TOSCAna by StuPro-TOSCAna.

the class TransformationPropertyHandlingTest method setUp.

@Before
public void setUp() throws Exception {
    Csar csar = new CsarImpl(new File(""), MOCK_CSAR_NAME, log);
    HashSet<PlatformInput> props = new HashSet<>();
    for (int i = 0; i < 10; i++) {
        props.add(new PlatformInput("prop-" + i, PropertyType.UNSIGNED_INTEGER, "No real Description", // Only mark the first 5 properties as required
        i < 5));
    }
    Platform p = new Platform("test", "Test Platform", props);
    transformation = new TransformationImpl(csar, p, log, modelMock());
    properties = transformation.getInputs();
}
Also used : Csar(org.opentosca.toscana.core.csar.Csar) Platform(org.opentosca.toscana.core.transformation.platform.Platform) CsarImpl(org.opentosca.toscana.core.csar.CsarImpl) File(java.io.File) PlatformInput(org.opentosca.toscana.core.transformation.properties.PlatformInput) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 4 with Platform

use of org.opentosca.toscana.core.transformation.platform.Platform in project TOSCAna by StuPro-TOSCAna.

the class TransformationPropertyHandlingTest method checkEmptyProperties.

@Test
public void checkEmptyProperties() throws Exception {
    Csar csar = new CsarImpl(new File(""), MOCK_CSAR_NAME, log);
    this.transformation = new TransformationImpl(csar, new Platform("test", "test", new HashSet<>()), logMock(), modelMock());
    assertEquals(TransformationState.READY, transformation.getState());
    assertTrue(transformation.getInputs().isValid());
}
Also used : Csar(org.opentosca.toscana.core.csar.Csar) Platform(org.opentosca.toscana.core.transformation.platform.Platform) CsarImpl(org.opentosca.toscana.core.csar.CsarImpl) File(java.io.File) BaseUnitTest(org.opentosca.toscana.core.BaseUnitTest) Test(org.junit.Test)

Example 5 with Platform

use of org.opentosca.toscana.core.transformation.platform.Platform in project TOSCAna by StuPro-TOSCAna.

the class PropertyInstanceTest method init.

@Before
public void init() {
    HashSet<PlatformInput> properties = new HashSet<>();
    for (int i = 0; i < 10; i++) {
        properties.add(new PlatformInput("p-" + i, PropertyType.INTEGER, "", i < 5));
    }
    Platform testPlatform = new Platform("test", "test", properties);
    transformation = new TransformationImpl(new CsarImpl(new File(""), "test", logMock()), testPlatform, logMock(), modelMock());
    this.instance = new PropertyInstance(new HashSet<>(properties), transformation);
}
Also used : TransformationImpl(org.opentosca.toscana.core.transformation.TransformationImpl) Platform(org.opentosca.toscana.core.transformation.platform.Platform) CsarImpl(org.opentosca.toscana.core.csar.CsarImpl) File(java.io.File) HashSet(java.util.HashSet) Before(org.junit.Before)

Aggregations

Platform (org.opentosca.toscana.core.transformation.platform.Platform)16 HashSet (java.util.HashSet)9 File (java.io.File)7 Csar (org.opentosca.toscana.core.csar.Csar)6 CsarImpl (org.opentosca.toscana.core.csar.CsarImpl)5 PlatformInput (org.opentosca.toscana.core.transformation.properties.PlatformInput)5 TransformationImpl (org.opentosca.toscana.core.transformation.TransformationImpl)4 ApiOperation (io.swagger.annotations.ApiOperation)3 Before (org.junit.Before)3 Test (org.junit.Test)3 Transformation (org.opentosca.toscana.core.transformation.Transformation)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ApiResponses (io.swagger.annotations.ApiResponses)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 PlatformNotFoundException (org.opentosca.toscana.api.exceptions.PlatformNotFoundException)2 BaseUnitTest (org.opentosca.toscana.core.BaseUnitTest)2 AWSCredentials (com.amazonaws.auth.AWSCredentials)1 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1