Search in sources :

Example 1 with DataContainer

use of org.opentosca.toscana.plugins.kubernetes.docker.mapper.util.DataContainer 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;
}
Also used : DataContainer(org.opentosca.toscana.plugins.kubernetes.docker.mapper.util.DataContainer) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Preferences(org.opentosca.toscana.core.util.Preferences) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Preferences (org.opentosca.toscana.core.util.Preferences)1 DataContainer (org.opentosca.toscana.plugins.kubernetes.docker.mapper.util.DataContainer)1