use of org.opentosca.toscana.core.transformation.properties.PlatformInput 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);
}
use of org.opentosca.toscana.core.transformation.properties.PlatformInput 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();
}
use of org.opentosca.toscana.core.transformation.properties.PlatformInput in project TOSCAna by StuPro-TOSCAna.
the class TransformationControllerTest method testGetOutputs.
// </editor-fold>
// <editor-fold desc="Output Tests">
@Test
public void testGetOutputs() throws Exception {
List<Transformation> transformations = preInitNonCreationTests();
Transformation t = transformations.get(0);
when(t.getState()).thenReturn(TransformationState.DONE);
String outputKey = "test_output";
List<OutputProperty> outputs = Lists.newArrayList(new PlatformInput(outputKey, PropertyType.TEXT, "", true, "some value"));
when(t.getOutputs()).thenReturn(outputs);
mvc.perform(get(GET_OUTPUT_URL)).andDo(print()).andExpect(status().is(200)).andExpect(jsonPath("$.outputs").isArray()).andExpect(jsonPath("$.links[0].href").value("http://localhost" + GET_OUTPUT_URL)).andExpect(jsonPath("$.outputs[0].key").value(outputKey)).andReturn();
}
use of org.opentosca.toscana.core.transformation.properties.PlatformInput in project TOSCAna by StuPro-TOSCAna.
the class TransformationControllerTest method mockPlatformService.
private void mockPlatformService() {
platformService = mock(PlatformService.class);
Set<Platform> platforms = new HashSet<>();
for (int i = 0; i < 5; i++) {
HashSet<PlatformInput> inputs = new HashSet<>();
for (PropertyType type : PropertyType.values()) {
inputs.add(new PlatformInput(type.getTypeName() + "_input", type));
}
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
if (i == 0) {
inputs.add(new PlatformInput(PROPERTY_TEST_DEFAULT_VALUE_KEY, PropertyType.TEXT, "", false, INPUT_TEST_DEFAULT_VALUE));
}
platforms.add(new Platform("p-" + chars[i], "platform-" + (i + 1), inputs));
}
when(platformService.getSupportedPlatforms()).thenReturn(platforms);
when(platformService.isSupported(any(Platform.class))).thenReturn(false);
when(platformService.findPlatformById(anyString())).thenReturn(Optional.empty());
for (Platform platform : platforms) {
when(platformService.findPlatformById(platform.id)).thenReturn(Optional.of(platform));
when(platformService.isSupported(platform)).thenReturn(true);
}
}
use of org.opentosca.toscana.core.transformation.properties.PlatformInput in project TOSCAna by StuPro-TOSCAna.
the class CloudFormationPlugin method getPlatformDetails.
private static Platform getPlatformDetails() {
String platformId = "cloudformation";
String platformName = "AWS CloudFormation";
Set<PlatformInput> platformProperties = new HashSet<>();
String defaultKeyId = "";
String defaultKeySecret = "";
try {
ProfileCredentialsProvider profileCredentialsProvider = new ProfileCredentialsProvider();
AWSCredentials awsCredentials = profileCredentialsProvider.getCredentials();
defaultKeyId = awsCredentials.getAWSAccessKeyId();
defaultKeySecret = awsCredentials.getAWSSecretKey();
} catch (Exception e) {
logger.debug("Did not find credentials on the system");
}
String defaultRegion = AWS_REGION_DEFAULT;
platformProperties.add(new PlatformInput(AWS_REGION_KEY, PropertyType.TEXT, "The AWS Region this should be transformed to. (The imageId of possible EC2 machines depend on this)", true, defaultRegion));
platformProperties.add(new PlatformInput(AWS_ACCESS_KEY_ID_KEY, PropertyType.TEXT, "The Access key id", true, defaultKeyId));
platformProperties.add(new PlatformInput(AWS_SECRET_KEY_KEY, PropertyType.SECRET, "The Access key secret", true, defaultKeySecret));
platformProperties.add(new PlatformInput(AWS_KEYPAIR_KEY, PropertyType.BOOLEAN, "If enabled, adds a AWS 'Keypair' Parameter to the template in order to access EC2 Instances via SSH. Must be specified during Deplyoment.", true, "false"));
return new Platform(platformId, platformName, platformProperties);
}
Aggregations