use of org.opentosca.toscana.core.plugin.PluginFileAccess in project TOSCAna by StuPro-TOSCAna.
the class BaseDockerfileTest method setUp.
@Before
public void setUp() {
inputDir = new File(tmpdir, INPUT_DIR_NAME);
workDir = new File(tmpdir, WORKING_DIR_NAME);
dockerWorkdir = new File(workDir, WORKING_DIR_SUBFOLDER_NAME);
logger.info("Initialing Environment");
inputDir.mkdirs();
workDir.mkdirs();
access = new PluginFileAccess(inputDir, workDir, logMock());
builder = new DockerfileBuilder("library/ubuntu:latest", WORKING_DIR_SUBFOLDER_NAME, access);
}
use of org.opentosca.toscana.core.plugin.PluginFileAccess in project TOSCAna by StuPro-TOSCAna.
the class TestUtil method setUpMockTransformationContext.
public static TransformationContext setUpMockTransformationContext(EffectiveModel model) throws IOException {
TransformationContext context = mock(TransformationContext.class);
PluginFileAccess pluginFileAccess = mock(PluginFileAccess.class);
when(context.getPluginFileAccess()).thenReturn(pluginFileAccess);
when(context.getModel()).thenReturn(model);
when(context.getLogger((Class<?>) any(Class.class))).thenReturn(LoggerFactory.getLogger("Dummy Logger"));
PluginFileAccess.BufferedLineWriter mock = mock(PluginFileAccess.BufferedLineWriter.class);
when(pluginFileAccess.access(any(String.class))).thenReturn(mock);
when(mock.append(any(String.class))).thenReturn(mock);
return context;
}
use of org.opentosca.toscana.core.plugin.PluginFileAccess 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