use of org.opentosca.toscana.core.util.Preferences in project TOSCAna by StuPro-TOSCAna.
the class MapperTest method init.
public static BaseImageMapper init() throws Exception {
ObjectMapper mapper = new ObjectMapper();
InputStream in = BaseImageMapper.class.getClassLoader().getResourceAsStream("kubernetes/base-image-mapper/image-map.json");
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, out);
Preferences preferences = mock(Preferences.class);
when(preferences.getDataDir()).thenReturn(staticTmpDir);
TagStorage tagStorage = new TagStorage(preferences);
BaseImageMapper baseImageMapper = new BaseImageMapper(new DockerBaseImages[] { ALPINE, DEBIAN, UBUNTU }, tagStorage);
DataContainer data = mapper.readValue(new String(out.toByteArray()), DataContainer.class);
baseImageMapper.setImageMap(data.data);
return baseImageMapper;
}
use of org.opentosca.toscana.core.util.Preferences in project TOSCAna by StuPro-TOSCAna.
the class CsarFilesystemDaoTest method returnedCsarHasPopulatedTransformations.
@Test
public void returnedCsarHasPopulatedTransformations() {
// test whether CsarDao calls TransformationDao internally to populate list of transformations
String identifier = createFakeCsarDirectories(1)[0];
Csar csar = new CsarImpl(new File(""), identifier, logMock());
csarDao = new CsarFilesystemDao(preferences, transformationDao);
List<Transformation> transformations = TestPlugins.PLATFORMS.stream().map(platform -> new TransformationImpl(csar, platform, logMock(), modelMock())).collect(Collectors.toList());
when(transformationDao.find(any())).thenReturn(transformations);
csarDao.init();
Optional<Csar> result = csarDao.find(identifier);
assertTrue(result.isPresent());
assertEquals(TestPlugins.PLATFORMS.size(), result.get().getTransformations().size());
}
Aggregations