From: Dan Timoney Date: Fri, 9 Aug 2019 21:49:29 +0000 (+0000) Subject: Merge "Add declarative acceptance tests" X-Git-Tag: 0.5.2~8 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=4001ac13397c082ee97c7ff440fa2ead5d50b421;p=ccsdk%2Fcds.git Merge "Add declarative acceptance tests" --- 4001ac13397c082ee97c7ff440fa2ead5d50b421 diff --cc ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt index 8517be843,dcfa07feb..2f082db9c --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt @@@ -39,17 -49,14 +49,17 @@@ class BluePrintArchiveUtils * * @param source the base directory * @param destination the output filename - * @param absolute store absolute filepath (from directory) or only filename * @return True if OK */ - fun compress(source: File, destination: File, absolute: Boolean): Boolean { + fun compress(source: File, destination: File): Boolean { try { + if(!destination.parentFile.exists()) { + destination.parentFile.mkdirs() + } destination.createNewFile() - ZipArchiveOutputStream(destination).use { - recurseFiles(source, source, it, absolute) + val ignoreZipFiles = Predicate { path -> !path.endsWith(".zip") && !path.endsWith(".ZIP") } + FileOutputStream(destination).use { out -> + compressFolder(source.toPath(), out, pathFilter = ignoreZipFiles) } } catch (e: Exception) { log.error("Fail to compress folder($source) to path(${destination.path})", e)