use of org.opentosca.toscana.core.transformation.TransformationImpl in project TOSCAna by StuPro-TOSCAna.
the class DeploymentPropertyTest method check.
@Test
public void check() {
try {
File input = new File(this.tmpdir, "in");
File output = new File(this.tmpdir, "out");
PropertyInstance instance = new PropertyInstance(new HashSet<>(platform.properties), mock(Transformation.class));
if (this.input != null) {
instance.set(Platform.DEPLOY_AFTER_TRANSFORMATION_KEY, this.input);
}
Csar csar = new CsarImpl(input, "csarId", logMock());
Transformation t = new TransformationImpl(csar, platform, logMock(), mock(EffectiveModel.class));
Transformation transformation = spy(t);
when(transformation.getInputs()).thenReturn(instance);
TransformationContext context = new TransformationContext(transformation, output);
Assert.assertEquals(expected, context.performDeployment());
} catch (Exception e) {
e.printStackTrace(System.out);
if (expectedException == null || !expectedException.isInstance(e)) {
fail();
}
}
}
use of org.opentosca.toscana.core.transformation.TransformationImpl in project TOSCAna by StuPro-TOSCAna.
the class LifecycleAwarePluginTest method setUp.
@Before
public void setUp() throws Exception {
Csar csar = new CsarImpl(tmpdir, "csarId", logMock());
Transformation t = new TransformationImpl(csar, TestPlugins.PLATFORM1, logMock(), mock(EffectiveModel.class));
context = spy(new TransformationContext(t, tmpdir));
doReturn(false).when(context).performDeployment();
lifecycle = spy(new TestTransformationLifecycle(context));
checkModel = true;
plugin = new LifecycleTestPlugin(TestPlugins.PLATFORM1);
}
use of org.opentosca.toscana.core.transformation.TransformationImpl 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);
}
use of org.opentosca.toscana.core.transformation.TransformationImpl in project TOSCAna by StuPro-TOSCAna.
the class TransformerHealthIndicatorTest method initTestEnvironment.
private void initTestEnvironment() {
// Create Dummy Csar
// DummyCsar csar = new DummyCsar("test");
Csar csar = new CsarImpl(new File(""), MOCK_CSAR_NAME, logMock());
csar = spy(csar);
Map<String, Transformation> transformations = new HashMap<>();
Set<Platform> platformSet = new HashSet<>();
for (Object[] d : MOCK_DATA) {
// Initialize transformation Mock
Transformation transformation = new TransformationImpl(csar, (Platform) d[0], logMock(), modelMock());
transformation.setState((TransformationState) d[1]);
transformations.put(((Platform) d[0]).id, transformation);
// Add platform to supported platform list
platformSet.add((Platform) d[0]);
}
// Add Transformations to csar
when(csar.getTransformations()).thenReturn(transformations);
// Platforms
when(pluginService.getSupportedPlatforms()).thenReturn(platformSet);
// Repository
when(repository.findAll()).thenReturn(Collections.singletonList(csar));
}
use of org.opentosca.toscana.core.transformation.TransformationImpl in project TOSCAna by StuPro-TOSCAna.
the class CsarControllerTest method testDeleteCsarBusy.
@Test
public void testDeleteCsarBusy() throws Exception {
// Add mock transformation to csar
Csar csar = service.getCsar(VALID_CSAR_NAME).get();
Transformation transformation = new TransformationImpl(csar, PLATFORM1, logMock(), modelMock());
transformation.setState(TransformationState.TRANSFORMING);
csar.getTransformations().put(PLATFORM1.id, transformation);
// Perform request
mvc.perform(delete(DELETE_VALID_CSAR_URL)).andDo(print()).andExpect(status().is(400));
}
Aggregations