use of org.opentosca.toscana.plugins.cloudfoundry.filecreator.FileCreator in project TOSCAna by StuPro-TOSCAna.
the class FileCreatorTest method setUp.
@Before
public void setUp() throws IOException {
EffectiveModel lamp = new EffectiveModelFactory().create(TestCsars.VALID_LAMP_NO_INPUT_TEMPLATE, logMock());
this.context = setUpMockTransformationContext(lamp);
appName = "testApp";
testApp = new Application("testApp", 1, context);
testApp.setName(appName);
File sourceDir = new File(tmpdir, "sourceDir");
targetDir = new File(tmpdir, "targetDir");
sourceDir.mkdir();
targetDir.mkdir();
fileAccess = new PluginFileAccess(sourceDir, targetDir, logMock());
List<Application> applications = new ArrayList<>();
applications.add(testApp);
fileCreator = new FileCreator(fileAccess, applications, context);
}
use of org.opentosca.toscana.plugins.cloudfoundry.filecreator.FileCreator in project TOSCAna by StuPro-TOSCAna.
the class ServiceTest method getAllServices.
@Test
public void getAllServices() throws Exception {
assumeNotNull(envUser, envHost, envOrga, envPw, envSpace);
app.addService("my_db1", ServiceTypes.MYSQL);
List<Application> applications = new ArrayList<>();
applications.add(app);
fileCreator = new FileCreator(fileAccess, applications, context);
fileCreator.createFiles();
File all_services = new File(targetDir, SERVICE_FILE_PATH);
String all_services_expected_content = "Following services you could choose:";
String all_services_content = FileUtils.readFileToString(all_services, Charset.defaultCharset());
assertTrue(all_services.exists());
assertThat(all_services_content, CoreMatchers.containsString(all_services_expected_content));
}
use of org.opentosca.toscana.plugins.cloudfoundry.filecreator.FileCreator in project TOSCAna by StuPro-TOSCAna.
the class CloudFoundryLifecycle method transform.
@Override
public void transform() {
logger.info("Begin transformation to Cloud Foundry.");
PluginFileAccess fileAccess = context.getPluginFileAccess();
fillApplications();
try {
FileCreator fileCreator = new FileCreator(fileAccess, filledApplications, context);
fileCreator.createFiles();
} catch (FileNotFoundException f) {
throw new TransformationFailureException("A file which is declared in the template could not be found", f);
} catch (IOException | JSONException e) {
e.printStackTrace();
}
}
Aggregations