use of org.opentosca.toscana.core.plugin.PluginFileAccess in project TOSCAna by StuPro-TOSCAna.
the class ServiceTest method setUp.
@Before
public void setUp() throws IOException {
EffectiveModel lamp = new EffectiveModelFactory().create(TestCsars.VALID_LAMP_NO_INPUT_TEMPLATE, logMock());
this.context = setUpMockTransformationContext(lamp);
envUser = System.getenv(CF_ENVIRONMENT_USER);
envPw = System.getenv(CF_ENVIRONMENT_PW);
envHost = System.getenv(CF_ENVIRONMENT_HOST);
envOrga = System.getenv(CF_ENVIRONMENT_ORGA);
envSpace = System.getenv(CF_ENVIRONMENT_SPACE);
app = new Application(appName, 1, context);
app.setProvider(provider);
connection = createConnection();
app.setConnection(connection);
File sourceDir = new File(tmpdir, "sourceDir");
targetDir = new File(tmpdir, "targetDir");
sourceDir.mkdir();
targetDir.mkdir();
fileAccess = new PluginFileAccess(sourceDir, targetDir, logMock());
}
use of org.opentosca.toscana.core.plugin.PluginFileAccess in project TOSCAna by StuPro-TOSCAna.
the class BashScriptTest method setUp.
@Before
public void setUp() {
bashScript = null;
fileName = UUID.randomUUID().toString();
access = new PluginFileAccess(tmpdir, tmpdir, logMock());
try {
bashScript = new BashScript(access, fileName);
} catch (IOException e) {
e.printStackTrace();
}
targetScriptFolder = new File(tmpdir, SCRIPTS_DIR_PATH);
}
use of org.opentosca.toscana.core.plugin.PluginFileAccess in project TOSCAna by StuPro-TOSCAna.
the class CloudFormationFileCreatorTest method setUp.
@Before
public void setUp() throws Exception {
File sourceDir = new File(tmpdir, "sourceDir");
targetDir = new File(tmpdir, "targetDir");
sourceDir.mkdir();
targetDir.mkdir();
FILEPATH_SOURCE_TEST_FILE = new File(sourceDir, FILENAME_TEST_FILE);
FILEPATH_TARGET_TEST_FILE = new File(targetDir, FILEPATH_TARGET + FILENAME_TEST_FILE);
writeTestFile();
FILEPATH_TARGET_TEST_FILE_LOCAL = RELATIVE_DIRECTORY_PREFIX + FILENAME_TEST_FILE;
when(log.getLogger(any(Class.class))).thenReturn(mock(Logger.class));
PluginFileAccess fileAccess = new PluginFileAccess(sourceDir, targetDir, log);
cfnModule = new CloudFormationModule(fileAccess, "us-west-2", new BasicAWSCredentials("", ""));
TransformationContext context = mock(TransformationContext.class);
when(context.getLogger((Class<?>) any(Class.class))).thenReturn(LoggerFactory.getLogger("File Creator Test Logger"));
fileCreator = new CloudFormationFileCreator(context, cfnModule);
}
use of org.opentosca.toscana.core.plugin.PluginFileAccess in project TOSCAna by StuPro-TOSCAna.
the class CloudFormationPluginTest method setUp.
@Before
public void setUp() throws Exception {
lamp = new EffectiveModelFactory().create(TestCsars.VALID_LAMP_NO_INPUT_TEMPLATE, logMock());
fileAccess = new PluginFileAccess(new File("src/test/resources/csars/yaml/valid/lamp-input/"), tmpdir, logMock());
cfnModule = new CloudFormationModule(fileAccess, "us-west-2", new BasicAWSCredentials("", ""));
TransformationContext context = mock(TransformationContext.class);
when(context.getModel()).thenReturn(lamp);
when(context.getLogger((Class<?>) any(Class.class))).thenReturn(LoggerFactory.getLogger("Dummy Logger"));
TransformModelNodeVisitor cfnNodeVisitorL = new TransformModelNodeVisitor(context, cfnModule);
cfnNodeVisitor = spy(cfnNodeVisitorL);
CapabilityMapper capabilityMapper = mock(CapabilityMapper.class);
when(capabilityMapper.mapOsCapabilityToImageId(any(OsCapability.class))).thenReturn("ami-testami");
when(cfnNodeVisitor.createCapabilityMapper()).thenReturn(capabilityMapper);
}
use of org.opentosca.toscana.core.plugin.PluginFileAccess 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);
}
Aggregations