use of com.google.cloud.tools.jib.image.json.BuildableManifestTemplate.ContentDescriptorTemplate in project jib by GoogleContainerTools.
the class V22ManifestTemplateTest method testFromJson_optionalProperties.
@Test
public void testFromJson_optionalProperties() throws IOException, URISyntaxException {
Path jsonFile = Paths.get(Resources.getResource("core/json/v22manifest_optional_properties.json").toURI());
V22ManifestTemplate manifestJson = JsonTemplateMapper.readJsonFromFile(jsonFile, V22ManifestTemplate.class);
List<ContentDescriptorTemplate> layers = manifestJson.getLayers();
Assert.assertEquals(4, layers.size());
Assert.assertNull(layers.get(0).getUrls());
Assert.assertNull(layers.get(0).getAnnotations());
Assert.assertEquals(Arrays.asList("url-foo", "url-bar"), layers.get(1).getUrls());
Assert.assertNull(layers.get(1).getAnnotations());
Assert.assertNull(layers.get(2).getUrls());
Assert.assertEquals(ImmutableMap.of("key-foo", "value-foo"), layers.get(2).getAnnotations());
Assert.assertEquals(Arrays.asList("cool-url"), layers.get(3).getUrls());
Assert.assertEquals(ImmutableMap.of("key1", "value1", "key2", "value2"), layers.get(3).getAnnotations());
}
Aggregations