diff options
author | michal.banka <michal.banka@nokia.com> | 2019-03-06 10:22:50 +0100 |
---|---|---|
committer | michal.banka <michal.banka@nokia.com> | 2019-03-08 10:58:29 +0100 |
commit | 93cf55254a9ee5f3cbab6bcc6ff3c2ef0c2e379b (patch) | |
tree | 754e393ed1e93838309f82595415546c10f35a7f /src/main/java | |
parent | 2d01f5210b6b5c8f0b6cdd99728d8b7b9f2fa886 (diff) |
Improve tests for CsarInstallerImpl
Change-Id: I18ad5789c1ed5a6d3cdf3c954e7b8ff224a589b4
Issue-ID: CLAMP-307
Signed-off-by: michal.banka <michal.banka@nokia.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java | 6 | ||||
-rw-r--r-- | src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java | 41 |
2 files changed, 26 insertions, 21 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java index 1fb86c0c..3f1403f1 100644 --- a/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/spring/CldsSdcControllerConfiguration.java @@ -17,6 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END============================================ + * * Modifications copyright (c) 2019 Nokia * =================================================================== * */ @@ -92,11 +93,6 @@ public class CldsSdcControllerConfiguration { }); } - @Bean(name = "csarInstaller") - public CsarInstaller getCsarInstaller() { - return new CsarInstallerImpl(); - } - @Bean(name = "sdcControllersConfiguration") public SdcControllersConfiguration getSdcControllersConfiguration() { return new SdcControllersConfiguration(); diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java index 1303f2ab..df4e13ab 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java @@ -17,6 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END============================================ + * Modifications copyright (c) 2019 Nokia * =================================================================== * */ @@ -58,6 +59,7 @@ import org.onap.clamp.clds.util.JsonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.yaml.snakeyaml.Yaml; @@ -66,6 +68,7 @@ import org.yaml.snakeyaml.Yaml; * There is no state kept by the bean. It's used to deploy the csar/notification * received from SDC in DB. */ +@Component public class CsarInstallerImpl implements CsarInstaller { private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstallerImpl.class); @@ -80,20 +83,26 @@ public class CsarInstallerImpl implements CsarInstaller { */ @Value("${clamp.config.sdc.blueprint.parser.mapping:'classpath:/clds/blueprint-parser-mapping.json'}") protected String blueprintMappingFile; - @Autowired protected ApplicationContext appContext; - @Autowired private CldsDao cldsDao; - @Autowired CldsTemplateService cldsTemplateService; - @Autowired CldsService cldsService; - @Autowired DcaeInventoryServices dcaeInventoryService; - @Autowired private XslTransformer cldsBpmnTransformer; @Autowired + public CsarInstallerImpl(ApplicationContext appContext, + CldsDao cldsDao, CldsTemplateService cldsTemplateService, CldsService cldsService, + DcaeInventoryServices dcaeInventoryService, XslTransformer cldsBpmnTransformer) { + this.appContext = appContext; + this.cldsDao = cldsDao; + this.cldsTemplateService = cldsTemplateService; + this.cldsService = cldsService; + this.dcaeInventoryService = dcaeInventoryService; + this.cldsBpmnTransformer = cldsBpmnTransformer; + } + + @Autowired private BlueprintParser blueprintParser; @Autowired @@ -154,16 +163,7 @@ public class CsarInstallerImpl implements CsarInstaller { } } - private void createPolicyModel(CsarHandler csar) throws PolicyModelException { - try{ - Optional<String> policyModelYaml = csar.getPolicyModelYaml(); - // save policy model into the database - } catch (IOException e) { - throw new PolicyModelException("TransformerException when decoding the YamlText", e); - } - } - - private BlueprintParserFilesConfiguration searchForRightMapping(BlueprintArtifact blueprintArtifact) + BlueprintParserFilesConfiguration searchForRightMapping(BlueprintArtifact blueprintArtifact) throws SdcArtifactInstallerException { List<BlueprintParserFilesConfiguration> listConfig = new ArrayList<>(); Yaml yaml = new Yaml(); @@ -202,6 +202,15 @@ public class CsarInstallerImpl implements CsarInstaller { return node.toString(); } + private void createPolicyModel(CsarHandler csar) throws PolicyModelException { + try{ + Optional<String> policyModelYaml = csar.getPolicyModelYaml(); + // save policy model into the database + } catch (IOException e) { + throw new PolicyModelException("TransformerException when decoding the YamlText", e); + } + } + private static String searchForPolicyScopePrefix(BlueprintArtifact blueprintArtifact) throws SdcArtifactInstallerException { String policyName = null; |