- public static void extractZipContents(Wrapper<String> yamlStringWrapper, File file) throws ZipException {
- final Map<String, byte[]> unzippedFolder = ZipUtils.readZip(file, false);
- String ymlName = unzippedFolder.keySet().iterator().next();
- fillToscaTemplateFromZip(yamlStringWrapper, ymlName, file);
- }
-
- private static void fillToscaTemplateFromZip(final Wrapper<String> yamlStringWrapper, final String payloadName,
- final File file) throws ZipException {
- final Map<String, byte[]> unzippedFolder = ZipUtils.readZip(file, false);
- final byte[] yamlFileInBytes = unzippedFolder.get(payloadName);
- final String yamlAsString = new String(yamlFileInBytes, StandardCharsets.UTF_8);
- log.debug("received yaml: {}", yamlAsString);
- yamlStringWrapper.setInnerElement(yamlAsString);
- }
-
- protected void fillPayloadDataFromFile(Wrapper<Response> responseWrapper, UploadResourceInfo uploadResourceInfoWrapper, File file) {
- try(InputStream fileInputStream = new FileInputStream(file)){
-
- byte [] data = new byte[(int)file.length()];
- if( fileInputStream.read(data) == -1){
- log.info("Invalid json was received.");
+ protected void fillPayloadDataFromFile(Wrapper<Response> responseWrapper, UploadResourceInfo uploadResourceInfoWrapper, File file) {
+ try (InputStream fileInputStream = new FileInputStream(file)) {
+ byte[] data = new byte[(int) file.length()];
+ if (fileInputStream.read(data) == -1) {
+ log.info(INVALID_JSON_WAS_RECEIVED);