use of org.opentosca.toscana.core.csar.CsarImpl 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.csar.CsarImpl 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.csar.CsarImpl 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.csar.CsarImpl in project TOSCAna by StuPro-TOSCAna.
the class TransformationPropertyHandlingTest method checkEmptyProperties.
@Test
public void checkEmptyProperties() throws Exception {
Csar csar = new CsarImpl(new File(""), MOCK_CSAR_NAME, log);
this.transformation = new TransformationImpl(csar, new Platform("test", "test", new HashSet<>()), logMock(), modelMock());
assertEquals(TransformationState.READY, transformation.getState());
assertTrue(transformation.getInputs().isValid());
}
use of org.opentosca.toscana.core.csar.CsarImpl 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);
}
Aggregations