diff options
author | Dhrumin Desai <dd303q@att.com> | 2021-09-29 08:34:18 -0400 |
---|---|---|
committer | Dhrumin Desai <dd303q@att.com> | 2021-10-04 21:30:28 -0400 |
commit | a494a322554924f6f9c3d6cc79240f54d3a8da0b (patch) | |
tree | 60477325bd8d86d2fb50965ec47eb6a9bd541e06 /mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java | |
parent | 0d1b8727a44b0add010b79e495b799e538057d20 (diff) |
Improved helm-generator code to make it more testable and improved code coverage
Issue-ID: DCAEGEN2-2911
Issue-ID: DCAEGEN2-2917
Change-Id: Ifc1f336b627b37a9356a3a72b33fcac18bdaa686
Signed-off-by: Dhrumin Desai <dd303q@att.com>
Diffstat (limited to 'mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java')
-rw-r--r-- | mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java index a74cab1..fd1f19f 100644 --- a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java @@ -26,6 +26,7 @@ import org.json.JSONObject; import org.json.JSONTokener; import org.onap.dcaegen2.platform.helmchartgenerator.Utils; import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base.ComponentSpec; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; @@ -43,6 +44,13 @@ import java.io.InputStream; @Slf4j public class ComponentSpecValidatorImpl implements ComponentSpecValidator { + @Autowired + private Utils utils; + + public ComponentSpecValidatorImpl(Utils utils) { + this.utils = utils; + } + /** * Validates the spec json file against schema and prints errors if found * @param specFileLocation specification json file location @@ -52,7 +60,7 @@ public class ComponentSpecValidatorImpl implements ComponentSpecValidator { @Override public void validateSpecFile(String specFileLocation, String specSchemaLocation) throws IOException { File schemaFile = getSchemaFile(specSchemaLocation); - ComponentSpec cs = Utils.deserializeJsonFileToModel(specFileLocation, ComponentSpec.class); + ComponentSpec cs = utils.deserializeJsonFileToModel(specFileLocation, ComponentSpec.class); validateSpecSchema(new File(specFileLocation), schemaFile); validateHelmRequirements(cs); } |