X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mod2%2Fhelm-generator%2Fhelmchartgenerator-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdcaegen2%2Fplatform%2Fhelmchartgenerator%2Fchartbuilder%2FChartGenerator.java;h=be02d68df20cd5f22f54c71e538dbb5fc1b078c4;hb=a494a322554924f6f9c3d6cc79240f54d3a8da0b;hp=b9980d73d548466ce38241b2d70b5c92d07e63eb;hpb=0d1b8727a44b0add010b79e495b799e538057d20;p=dcaegen2%2Fplatform.git diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java index b9980d7..be02d68 100644 --- a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java @@ -18,17 +18,14 @@ package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; -import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import org.onap.dcaegen2.platform.helmchartgenerator.Utils; import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.io.File; -import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.cloneFileToTempLocation; -import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.deleteTempFileLocation; - /** * ChartGenerator interacts with HelmClient and generates a packaged helm chart * @author Dhrumin Desai @@ -37,22 +34,25 @@ import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.deleteTempFile @Slf4j public class ChartGenerator { - @Setter @Autowired private HelmClient helmClient; - @Setter @Autowired private KeyValueMerger merger; + @Autowired + private Utils utils; + /** * Constructor for ChartGenerator * @param helmClient HelmClient implementation * @param merger KeyValueMerger implementation + * @param utils */ - public ChartGenerator(HelmClient helmClient, KeyValueMerger merger) { + public ChartGenerator(HelmClient helmClient, KeyValueMerger merger, Utils utils) { this.helmClient = helmClient; this.merger = merger; + this.utils = utils; } /** @@ -63,11 +63,11 @@ public class ChartGenerator { * @return generated helm chart tgz file */ public File generate(String chartBlueprintLocation, ChartInfo chartInfo, String outputLocation) { - File newChartDir = cloneFileToTempLocation(chartBlueprintLocation + "/base"); + File newChartDir = utils.cloneFileToTempLocation(chartBlueprintLocation + "/base"); merger.mergeValuesToChart(chartInfo, newChartDir); helmClient.lint(newChartDir); final File chartLocation = helmClient.packageChart(newChartDir, outputLocation); - deleteTempFileLocation(newChartDir); + utils.deleteTempFileLocation(newChartDir); return chartLocation; } }