Source:
public void testHashesForEachFile() throws Exception { Map<String, Object> exportConfiguration = new HashMap<>(); exportConfiguration.put(INCLUDE_HASHES.name(), null); try (InputStream inputStream = this.createOutputAndInputStream( "origin/plain", new ServiceTemplateId("<LINK_0>", "ServiceTemplateWithAllReqCapVariants", false), exportConfiguration); ZipInputStream zis = new ZipInputStream(inputStream)) { ZipEntry entry; List<CsarContentProperties> elementsList = new ArrayList<>(); ManifestContents manifestContents = null; while ((entry = zis.getNextEntry()) != null) { CsarContentProperties fileProperties = new CsarContentProperties(entry.getName()); elementsList.add(fileProperties); byte[] bytes = IOUtils.toByteArray(zis); fileProperties.setFileHash(HashingUtil.getChecksum(bytes, TOSCAMetaFileAttributes.HASH)); if ("TOSCA-Metadata/TOSCA.meta".equals(fileProperties.getPathInsideCsar())) { String s = new String(bytes, StandardCharsets.UTF_8); manifestContents = new RecoveringManifestParser().parse(s); } } assertNotNull(manifestContents); for (CsarContentProperties fileProperties : elementsList) { Map<String, String> attributes = manifestContents.getAttributesForSection(fileProperties.getPathInsideCsar()); if (!"TOSCA-Metadata/TOSCA.meta".equals(fileProperties.getPathInsideCsar())) { assertTrue(attributes.containsKey(TOSCAMetaFileAttributes.HASH)); assertEquals(fileProperties.getFileHash(), attributes.get(TOSCAMetaFileAttributes.HASH)); } } assertEquals(elementsList.size() - 1, manifestContents.getSectionNames().size()); } }

Target:
public void testHashesForEachFile() throws Exception { Map<String, Object> exportConfiguration = new HashMap<>(); exportConfiguration.put(INCLUDE_HASHES.name(), null); try (InputStream inputStream = this.createOutputAndInputStream( "7c8d8c7057403a07fde90dec1f44f0190ae65ae2", new ServiceTemplateId("<LINK_0>", "ServiceTemplateWithAllReqCapVariants", false), exportConfiguration); ZipInputStream zis = new ZipInputStream(inputStream)) { ZipEntry entry; List<CsarContentProperties> elementsList = new ArrayList<>(); ManifestContents manifestContents = null; while ((entry = zis.getNextEntry()) != null) { CsarContentProperties fileProperties = new CsarContentProperties(entry.getName()); elementsList.add(fileProperties); byte[] array = IOUtils.toByteArray(zis); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(array); fileProperties.setFileHash(HashingUtil.getChecksum(byteArrayInputStream, TOSCAMetaFileAttributes.HASH)); if ("TOSCA-Metadata/TOSCA.meta".equals(fileProperties.getPathInsideCsar())) { String s = new String(array, StandardCharsets.UTF_8); manifestContents = new RecoveringManifestParser().parse(s); } } assertNotNull(manifestContents); for (CsarContentProperties fileProperties : elementsList) { Map<String, String> attributes = manifestContents.getAttributesForSection(fileProperties.getPathInsideCsar()); if (!"TOSCA-Metadata/TOSCA.meta".equals(fileProperties.getPathInsideCsar())) { assertTrue(attributes.containsKey(TOSCAMetaFileAttributes.HASH)); assertEquals(fileProperties.getFileHash(), attributes.get(TOSCAMetaFileAttributes.HASH)); } } assertEquals(elementsList.size() - 1, manifestContents.getSectionNames().size()); } }