aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/src
diff options
context:
space:
mode:
authorPiotr Darosz <piotr.darosz@nokia.com>2019-07-01 08:23:51 +0200
committerTomasz Golabek <tomasz.golabek@nokia.com>2019-07-16 10:56:33 +0000
commitaf504ed5e03899ebf214d0fec6bd78ac4adb1b77 (patch)
tree65c925464a84f0a9cb0873d0e446b971cebcf632 /asdctool/src
parenta2b6793397b5cd14e7eb636198ff13ddeee920bf (diff)
Constructor injection in asdctool
Use constructor injection where possible Change-Id: Ibc80850166406a6e3230f555818988109e6ca776 Issue-ID: SDC-2403 Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
Diffstat (limited to 'asdctool/src')
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfiguration.java11
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfiguration.java12
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfiguration.java10
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java21
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java9
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfig.java4
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java21
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java19
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java9
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBL.java7
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java136
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java15
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java6
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java15
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuter.java8
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java6
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java6
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuter.java9
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java9
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTask.java7
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTask.java5
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java5
-rw-r--r--asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java2
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java16
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java6
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java12
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java10
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java88
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java15
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java6
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java6
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java9
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java11
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java8
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java8
-rw-r--r--asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java7
39 files changed, 405 insertions, 176 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfiguration.java
index 64f570c00a..317bd26107 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfiguration.java
@@ -24,7 +24,12 @@ package org.openecomp.sdc.asdctool.configuration;
import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix;
import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder;
import org.openecomp.sdc.be.config.CatalogModelSpringConfig;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.config.DAOSpringConfig;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.tosca.CsarUtils;
+import org.openecomp.sdc.be.tosca.ToscaExportHandler;
import org.openecomp.sdc.config.CatalogBESpringConfig;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
@@ -41,8 +46,10 @@ import org.springframework.core.io.FileSystemResource;
public class ArtifactUUIDFixConfiguration {
@Bean
- public ArtifactUuidFix artifactUuidFix() {
- return new ArtifactUuidFix();
+ public ArtifactUuidFix artifactUuidFix(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade, ToscaExportHandler toscaExportHandler,
+ ArtifactCassandraDao artifactCassandraDao, CsarUtils csarUtils) {
+ return new ArtifactUuidFix(janusGraphDao, toscaOperationFacade, toscaExportHandler, artifactCassandraDao, csarUtils);
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfiguration.java
index 672aabb4d2..4768a62f6c 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/CsarGeneratorConfiguration.java
@@ -23,7 +23,12 @@ package org.openecomp.sdc.asdctool.configuration;
import org.openecomp.sdc.asdctool.impl.internal.tool.CsarGenerator;
import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder;
import org.openecomp.sdc.be.config.CatalogModelSpringConfig;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.config.DAOSpringConfig;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.tosca.CsarUtils;
+import org.openecomp.sdc.be.tosca.ToscaExportHandler;
import org.openecomp.sdc.config.CatalogBESpringConfig;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
@@ -39,8 +44,11 @@ import org.springframework.core.io.FileSystemResource;
public class CsarGeneratorConfiguration {
@Bean
- public CsarGenerator csarGenerator() {
- return new CsarGenerator();
+ public CsarGenerator csarGenerator(JanusGraphDao janusGraphDao, CsarUtils csarUtils,
+ ToscaOperationFacade toscaOperationFacade,
+ ArtifactCassandraDao artifactCassandraDao, ToscaExportHandler toscaExportHandler) {
+ return new CsarGenerator(janusGraphDao, csarUtils, toscaOperationFacade,
+ artifactCassandraDao, toscaExportHandler);
}
@Bean(name = "elasticsearchConfig")
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfiguration.java
index eb31717d7d..51956732f5 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/InternalToolConfiguration.java
@@ -23,6 +23,9 @@ package org.openecomp.sdc.asdctool.configuration;
import org.openecomp.sdc.asdctool.impl.internal.tool.DeleteComponentHandler;
import org.openecomp.sdc.be.config.CatalogModelSpringConfig;
import org.openecomp.sdc.be.dao.config.DAOSpringConfig;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -41,8 +44,11 @@ public class InternalToolConfiguration {
}
@Bean
- public DeleteComponentHandler deleteComponentHandler() {
- return new DeleteComponentHandler();
+ public DeleteComponentHandler deleteComponentHandler(
+ JanusGraphDao janusGraphDao,
+ NodeTypeOperation nodeTypeOperation,
+ TopologyTemplateOperation topologyTemplateOperation) {
+ return new DeleteComponentHandler(janusGraphDao, nodeTypeOperation, topologyTemplateOperation);
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
index 7c25843f2b..4dab15fa4b 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFix.java
@@ -89,23 +89,26 @@ public class ArtifactUuidFix {
private static final String FAILED_TO_FETCH_VF_RESOURCES = "Failed to fetch vf resources ";
private static final String UTF8 = "utf-8";
-
- @Autowired
- private JanusGraphDao janusGraphDao;
- @Autowired
+ private JanusGraphDao janusGraphDao;
private ToscaOperationFacade toscaOperationFacade;
- @Autowired
private ToscaExportHandler toscaExportUtils;
- @Autowired
private ArtifactCassandraDao artifactCassandraDao;
-
-
- @Autowired
private CsarUtils csarUtils;
private static Logger log = Logger.getLogger(ArtifactUuidFix.class.getName());
+ @Autowired
+ public ArtifactUuidFix(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade, ToscaExportHandler toscaExportUtils,
+ ArtifactCassandraDao artifactCassandraDao, CsarUtils csarUtils) {
+ this.janusGraphDao = janusGraphDao;
+ this.toscaOperationFacade = toscaOperationFacade;
+ this.toscaExportUtils = toscaExportUtils;
+ this.artifactCassandraDao = artifactCassandraDao;
+ this.csarUtils = csarUtils;
+ }
+
public boolean doFix(String fixComponent, String runMode) {
List<Resource> vfLst = new ArrayList<>();
List<Service> serviceList = new ArrayList<>();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
index 7df5810a2f..2e14b906ff 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/DataMigration.java
@@ -78,11 +78,16 @@ public class DataMigration {
private static Logger log = Logger.getLogger(DataMigration.class.getName());
private ElasticSearchClient elasticSearchClient;
- @Autowired
private AuditCassandraDao auditCassandraDao;
- @Autowired
private ArtifactCassandraDao artifactCassandraDao;
+ @Autowired
+ public DataMigration(AuditCassandraDao auditCassandraDao,
+ ArtifactCassandraDao artifactCassandraDao) {
+ this.auditCassandraDao = auditCassandraDao;
+ this.artifactCassandraDao = artifactCassandraDao;
+ }
+
/**
* the method exports and imports the records from ES to cassandra the flow
* will check to see if the files are not empty if the files are not empty
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfig.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfig.java
index 7056acfab7..6b15cb0075 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfig.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfig.java
@@ -30,8 +30,8 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class EsToCassandraDataMigrationConfig {
@Bean(name = "DataMigrationBean")
- public DataMigration dataMigration() {
- return new DataMigration();
+ public DataMigration dataMigration(AuditCassandraDao auditCassandraDao, ArtifactCassandraDao artifactCassandraDao) {
+ return new DataMigration(auditCassandraDao, artifactCassandraDao);
}
@Bean(name = "artifact-cassandra-dao")
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
index 724fed27a6..4af684b30d 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java
@@ -55,21 +55,24 @@ import org.springframework.beans.factory.annotation.Autowired;
@org.springframework.stereotype.Component("csarGenerator")
public class CsarGenerator extends CommonInternalTool {
- public CsarGenerator() {
- super("generate");
- }
- @Autowired
private JanusGraphDao janusGraphDao;
- @Autowired
private CsarUtils csarUtils;
- @Autowired
private ToscaOperationFacade toscaOperationFacade;
- @Autowired
private ArtifactCassandraDao artifactCassandraDao;
- @Autowired
private ToscaExportHandler toscaExportHandler;
-
+
+ @Autowired
+ public CsarGenerator(JanusGraphDao janusGraphDao, CsarUtils csarUtils,
+ ToscaOperationFacade toscaOperationFacade,
+ ArtifactCassandraDao artifactCassandraDao, ToscaExportHandler toscaExportHandler) {
+ super("generate");
+ this.janusGraphDao = janusGraphDao;
+ this.csarUtils = csarUtils;
+ this.toscaOperationFacade = toscaOperationFacade;
+ this.artifactCassandraDao = artifactCassandraDao;
+ this.toscaExportHandler = toscaExportHandler;
+ }
private static Logger log = Logger.getLogger(CsarGenerator.class.getName());
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
index c0cbe2fa02..3bd13d0eff 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandler.java
@@ -45,20 +45,23 @@ import java.util.Scanner;
@Component("deleteComponentHandler")
public class DeleteComponentHandler extends CommonInternalTool{
- @Autowired
private JanusGraphDao janusGraphDao;
- @Autowired
private NodeTypeOperation nodeTypeOperation;
- @Autowired
private TopologyTemplateOperation topologyTemplateOperation;
-
-
- private static Logger log = Logger.getLogger(DeleteComponentHandler.class.getName());
-
- public DeleteComponentHandler(){
+ @Autowired
+ public DeleteComponentHandler(JanusGraphDao janusGraphDao,
+ NodeTypeOperation nodeTypeOperation,
+ TopologyTemplateOperation topologyTemplateOperation) {
super("delete");
+ this.janusGraphDao = janusGraphDao;
+ this.nodeTypeOperation = nodeTypeOperation;
+ this.topologyTemplateOperation = topologyTemplateOperation;
}
+
+ private static Logger log = Logger.getLogger(DeleteComponentHandler.class.getName());
+
+
public void deleteComponent(String id, Scanner scanner) {
JanusGraphOperationStatus status = JanusGraphOperationStatus.OK;
GraphVertex metadataVertex = janusGraphDao.getVertexById(id).either(l -> l, r -> null);
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java
index f76ce78a5f..2b63193a1e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBL.java
@@ -30,12 +30,17 @@ public class ArtifactToolBL {
private static Logger log = Logger.getLogger(ValidationToolBL.class.getName());
- @Autowired
protected List<IArtifactValidatorExecuter> validators;
private boolean allValid = true;
- public boolean validateAll() {
+ @Autowired
+ public ArtifactToolBL(
+ List<IArtifactValidatorExecuter> validators) {
+ this.validators = validators;
+ }
+
+ public boolean validateAll() {
for (IArtifactValidatorExecuter validatorExec: validators) {
log.debug("ValidatorExecuter "+validatorExec.getName()+" started");
if (!validatorExec.executeValidations()) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBL.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBL.java
index ff762962e8..ae25c3106e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBL.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBL.java
@@ -35,11 +35,16 @@ public class ValidationToolBL {
private static Logger log = Logger.getLogger(ValidationToolBL.class.getName());
- @Autowired
protected List<ValidatorExecuter> validators;
private boolean allValid = true;
+ @Autowired
+ public ValidationToolBL(
+ List<ValidatorExecuter> validators) {
+ this.validators = validators;
+ }
+
public boolean validateAll() {
for (ValidatorExecuter validatorExec: validators) {
log.debug("ValidatorExecuter "+validatorExec.getName()+" started");
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
index adcbfcd34e..47dd7fda0f 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java
@@ -20,65 +20,102 @@
package org.openecomp.sdc.asdctool.impl.validator.config;
+import java.util.List;
+import org.openecomp.sdc.asdctool.impl.VrfObjectFixHandler;
import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL;
import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL;
import org.openecomp.sdc.asdctool.impl.validator.executers.*;
+import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils;
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask;
import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask;
import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager;
+import org.openecomp.sdc.asdctool.migration.config.mocks.DistributionEngineMock;
+import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine;
+import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder;
+import org.openecomp.sdc.be.config.CatalogModelSpringConfig;
import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy;
import org.openecomp.sdc.be.dao.JanusGraphClientStrategy;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.CassandraClient;
+import org.openecomp.sdc.be.dao.config.DAOSpringConfig;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
+import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.model.DerivedNodeTypeResolver;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*;
+import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
+import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation;
+import org.openecomp.sdc.config.CatalogBESpringConfig;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.io.FileSystemResource;
/**
* Created by chaya on 7/3/2017.
*/
@Configuration
+@Import({DAOSpringConfig.class, CatalogBESpringConfig.class, CatalogModelSpringConfig.class})
public class ValidationToolConfiguration {
@Bean
- public ServiceValidatorExecuter basicServiceValidator() { return new ServiceValidatorExecuter();}
-
+ public ServiceValidatorExecuter basicServiceValidator(JanusGraphDao janusGraphDao) {
+ return new ServiceValidatorExecuter(janusGraphDao);
+ }
+
@Bean
- public NodeToscaArtifactsValidatorExecuter NodeToscaArtifactsValidatorValidator() { return new NodeToscaArtifactsValidatorExecuter();}
-
+ public NodeToscaArtifactsValidatorExecuter NodeToscaArtifactsValidatorValidator(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ return new NodeToscaArtifactsValidatorExecuter(janusGraphDao, toscaOperationFacade);
+ }
+
@Bean
- public ServiceToscaArtifactsValidatorExecutor ServiceToscaArtifactsValidator() { return new ServiceToscaArtifactsValidatorExecutor();}
-
+ public ServiceToscaArtifactsValidatorExecutor ServiceToscaArtifactsValidator(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ return new ServiceToscaArtifactsValidatorExecutor(janusGraphDao, toscaOperationFacade);
+ }
+
@Bean
- public VFToscaArtifactValidatorExecutor VFToscaArtifactValidator() { return new VFToscaArtifactValidatorExecutor();}
+ public VFToscaArtifactValidatorExecutor VFToscaArtifactValidator(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ return new VFToscaArtifactValidatorExecutor(janusGraphDao, toscaOperationFacade);
+ }
@Bean
- public VfArtifactValidationTask vfArtifactValidationTask() { return new VfArtifactValidationTask(); }
+ public VfArtifactValidationTask vfArtifactValidationTask(ArtifactValidationUtils artifactValidationUtils) {
+ return new VfArtifactValidationTask(artifactValidationUtils);
+ }
@Bean
- public ServiceArtifactValidationTask serviceArtifactValidationTask() { return new ServiceArtifactValidationTask();}
+ public ServiceArtifactValidationTask serviceArtifactValidationTask(ArtifactValidationUtils artifactValidationUtils) {
+ return new ServiceArtifactValidationTask(artifactValidationUtils);
+ }
@Bean
- public ModuleJsonTask moduleJsonTask() { return new ModuleJsonTask();}
+ public ModuleJsonTask moduleJsonTask(TopologyTemplateOperation topologyTemplateOperation) {
+ return new ModuleJsonTask(topologyTemplateOperation);
+ }
@Bean
- public ValidationToolBL validationToolBL() {
- return new ValidationToolBL();
+ public ValidationToolBL validationToolBL(List<ValidatorExecuter> validators) {
+ return new ValidationToolBL(validators);
}
-
+
@Bean
- public ArtifactToolBL artifactToolBL() {
- return new ArtifactToolBL();
+ public ArtifactToolBL artifactToolBL(List<IArtifactValidatorExecuter> validators) {
+ return new ArtifactToolBL(validators);
}
@Bean
- public VfValidatorExecuter basicVfValidator() { return new VfValidatorExecuter();}
+ public VfValidatorExecuter basicVfValidator(List<VfValidationTask> tasks, JanusGraphDao janusGraphDao) {
+ return new VfValidatorExecuter(tasks, janusGraphDao);
+ }
@Bean
public ReportManager reportManager() { return new ReportManager();}
@@ -89,7 +126,10 @@ public class ValidationToolConfiguration {
}
@Bean
- public ArtifactValidationUtils artifactValidationUtils() { return new ArtifactValidationUtils();}
+ public ArtifactValidationUtils artifactValidationUtils(ArtifactCassandraDao artifactCassandraDao,
+ TopologyTemplateOperation topologyTemplateOperation) {
+ return new ArtifactValidationUtils(artifactCassandraDao, topologyTemplateOperation);
+ }
@Bean(name = "groups-operation")
public GroupsOperation jsonGroupsOperation() {
@@ -132,33 +172,65 @@ public class ValidationToolConfiguration {
return new NodeTemplateOperation();
}
+
@Bean(name = "mig-derived-resolver")
public DerivedNodeTypeResolver migrationDerivedNodeTypeResolver() {
return new ByToscaNameDerivedNodeTypeResolver();
}
- @Bean(name = "janusgraph-dao")
- public JanusGraphDao janusGraphDao(@Qualifier("migration-janusgraph-client") JanusGraphClient janusGraphClient) {
- return new JanusGraphDao(janusGraphClient);
+ @Bean
+ public JanusGraphGenericDao janusGraphGenericDao(@Qualifier("migration-janusgraph-client") JanusGraphClient janusGraphClient) {
+ return new JanusGraphGenericDao(janusGraphClient);
+ }
+
+ @Bean(name = "elasticsearchConfig")
+ public PropertiesFactoryBean mapper() {
+ String configHome = System.getProperty("config.home");
+ PropertiesFactoryBean bean = new PropertiesFactoryBean();
+ bean.setLocation(new FileSystemResource(configHome + "/elasticsearch.yml"));
+ return bean;
}
- @Bean(name = "category-operation")
- public CategoryOperation categoryOperation() {
- return new CategoryOperation();
+ @Bean
+ public ArchiveOperation archiveOperation(JanusGraphDao janusGraphDao, IGraphLockOperation graphLockOperation) {
+ return new ArchiveOperation(janusGraphDao, graphLockOperation);
}
- @Bean(name = "artifacts-operation")
- public ArtifactsOperations artifactsOperation() {
- return new ArtifactsOperations();
+ @Bean
+ public IGraphLockOperation graphLockOperation() {
+ return new GraphLockOperation();
}
- @Bean(name = "tosca-data-operation")
- public ToscaDataOperation toscaDataOperation() {
- return new ToscaDataOperation();
+ @Bean(name = "janusgraph-client")
+ @Primary
+ public JanusGraphClient janusGraphClient(@Qualifier("dao-client-strategy")
+ JanusGraphClientStrategy janusGraphClientStrategy) {
+ return new JanusGraphClient(janusGraphClientStrategy);
}
- @Bean(name = "tosca-element-lifecycle-operation")
- public ToscaElementLifecycleOperation toscaElementLifecycleOperation() {
- return new ToscaElementLifecycleOperation();
+ @Bean(name ="dao-client-strategy")
+ public JanusGraphClientStrategy janusGraphClientStrategy() {
+ return new DAOJanusGraphStrategy();
+ }
+
+ @Bean
+ public VrfObjectFixHandler vrfObjectFixHandler(@Qualifier("janusgraph-dao")
+ JanusGraphDao janusGraphDao){
+ return new VrfObjectFixHandler(janusGraphDao);
+ }
+
+ @Bean(name = "janusgraph-dao")
+ public HealingJanusGraphDao healingJanusGraphDao(JanusGraphClient janusGraphClient) {
+ return new HealingJanusGraphDao(janusGraphClient);
+ }
+
+ @Bean
+ public IDistributionEngine iDistributionEngine() {
+ return new DistributionEngineMock();
+ }
+
+ @Bean
+ public ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder() {
+ return new ServiceDistributionArtifactsBuilder();
}
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
index bea133ae2e..de19d09319 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuter.java
@@ -33,20 +33,23 @@ import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class ArtifactValidatorExecuter{
-
- @Autowired
+
protected JanusGraphDao janusGraphDao;
+ protected ToscaOperationFacade toscaOperationFacade;
+
+ public ArtifactValidatorExecuter(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ this.janusGraphDao = janusGraphDao;
+ this.toscaOperationFacade = toscaOperationFacade;
+ }
- @Autowired
- private ToscaOperationFacade toscaOperationFacade;
- private static Logger log = Logger.getLogger(ArtifactValidatorExecuter.class.getName());
+ private static Logger log = Logger.getLogger(ArtifactValidatorExecuter.class.getName());
protected String name;
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java
index 42c9b6d6bc..99e6637a08 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuter.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -29,11 +30,14 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class NodeToscaArtifactsValidatorExecuter extends ArtifactValidatorExecuter implements IArtifactValidatorExecuter{
protected String name;
- public NodeToscaArtifactsValidatorExecuter() {
+ public NodeToscaArtifactsValidatorExecuter(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ super(janusGraphDao, toscaOperationFacade);
setName("RESOURCE_TOSCA_ARTIFACTS");
}
@Override
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java
index 3ae1ba3790..ed4b6eabf8 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutor.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -29,13 +30,19 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.springframework.beans.factory.annotation.Autowired;
+@org.springframework.stereotype.Component
public class ServiceToscaArtifactsValidatorExecutor extends ArtifactValidatorExecuter implements IArtifactValidatorExecuter{
-
- public ServiceToscaArtifactsValidatorExecutor() {
- setName("SERVICE_TOSCA_ARTIFACTS");
- }
+ @Autowired
+ public ServiceToscaArtifactsValidatorExecutor(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ super(janusGraphDao, toscaOperationFacade);
+ setName("SERVICE_TOSCA_ARTIFACTS");
+ }
+
@Override
public boolean executeValidations() {
Map<GraphPropertyEnum, Object> hasProps = new HashMap<>();
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuter.java
index 4ab8ac22b2..8f36dd3d85 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuter.java
@@ -22,21 +22,25 @@ package org.openecomp.sdc.asdctool.impl.validator.executers;
import org.openecomp.sdc.asdctool.impl.validator.tasks.ServiceValidationTask;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
+import org.springframework.stereotype.Component;
/**
* Created by chaya on 7/4/2017.
*/
+@Component
public class ServiceValidatorExecuter extends TopologyTemplateValidatorExecuter implements ValidatorExecuter {
- @Autowired(required = false)
List<ServiceValidationTask> tasks = new ArrayList<>();
- public ServiceValidatorExecuter() {
+ @Autowired(required = false)
+ public ServiceValidatorExecuter(JanusGraphDao janusGraphDao) {
+ super(janusGraphDao);
setName("SERVICE_VALIDATOR");
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
index ddae03de9a..5287ea1b7a 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java
@@ -43,11 +43,15 @@ public class TopologyTemplateValidatorExecuter {
private static Logger log = Logger.getLogger(VfValidatorExecuter.class.getName());
- @Autowired
protected JanusGraphDao janusGraphDao;
protected String name;
+ @Autowired
+ public TopologyTemplateValidatorExecuter(JanusGraphDao janusGraphDao) {
+ this.janusGraphDao = janusGraphDao;
+ }
+
public void setName(String name) {
this.name = name;
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java
index 60a54d702a..29d49ae592 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutor.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
@@ -30,10 +31,13 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class VFToscaArtifactValidatorExecutor extends ArtifactValidatorExecuter implements IArtifactValidatorExecuter{
- public VFToscaArtifactValidatorExecutor() {
+ public VFToscaArtifactValidatorExecutor(JanusGraphDao janusGraphDao,
+ ToscaOperationFacade toscaOperationFacade) {
+ super(janusGraphDao, toscaOperationFacade);
setName("VF_TOSCA_ARTIFACTS");
}
@Override
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuter.java
index b42ef372e2..080845a999 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuter.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuter.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executers;
import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,10 +34,12 @@ import java.util.List;
*/
public class VfValidatorExecuter extends TopologyTemplateValidatorExecuter implements ValidatorExecuter {
- @Autowired(required = false)
- private List<VfValidationTask> tasks = new ArrayList<>();
+ private List<VfValidationTask> tasks;
- public VfValidatorExecuter() {
+ @Autowired(required = false)
+ public VfValidatorExecuter(List<VfValidationTask> tasks, JanusGraphDao janusGraphDao) {
+ super(janusGraphDao);
+ this.tasks = tasks;
setName("BASIC_VF_VALIDATOR");
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
index a856fe66f2..025e0b61e1 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtils.java
@@ -41,12 +41,17 @@ import java.util.*;
*/
public class ArtifactValidationUtils {
- @Autowired
private ArtifactCassandraDao artifactCassandraDao;
- @Autowired
private TopologyTemplateOperation topologyTemplateOperation;
+ @Autowired
+ public ArtifactValidationUtils(ArtifactCassandraDao artifactCassandraDao,
+ TopologyTemplateOperation topologyTemplateOperation) {
+ this.artifactCassandraDao = artifactCassandraDao;
+ this.topologyTemplateOperation = topologyTemplateOperation;
+ }
+
public ArtifactsVertexResult validateArtifactsAreInCassandra(GraphVertex vertex, String taskName, List<ArtifactDataDefinition> artifacts) {
ArtifactsVertexResult result = new ArtifactsVertexResult(true);
for(ArtifactDataDefinition artifact:artifacts) {
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTask.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTask.java
index 51e54327bc..3b47a81c40 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTask.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTask.java
@@ -30,12 +30,11 @@ import org.springframework.beans.factory.annotation.Autowired;
*/
public class ServiceArtifactValidationTask extends ServiceValidationTask {
- @Autowired
private ArtifactValidationUtils artifactValidationUtils;
-
-
- public ServiceArtifactValidationTask() {
+ @Autowired
+ public ServiceArtifactValidationTask(ArtifactValidationUtils artifactValidationUtils) {
+ this.artifactValidationUtils = artifactValidationUtils;
this.name = "Service Artifact Validation Task";
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTask.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTask.java
index c3e5aae564..c445521f53 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTask.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTask.java
@@ -31,10 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
*/
public class VfArtifactValidationTask extends VfValidationTask {
- @Autowired
ArtifactValidationUtils artifactValidationUtils;
- public VfArtifactValidationTask() {
+ @Autowired
+ public VfArtifactValidationTask(ArtifactValidationUtils artifactValidationUtils) {
+ this.artifactValidationUtils = artifactValidationUtils;
this.name = "VF Artifact Validation Task";
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
index 4f853e9be1..d6fafcbb5e 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java
@@ -45,10 +45,11 @@ import java.util.stream.Collectors;
*/
public class ModuleJsonTask extends ServiceValidationTask {
- @Autowired
private TopologyTemplateOperation topologyTemplateOperation;
- public ModuleJsonTask() {
+ @Autowired
+ public ModuleJsonTask(TopologyTemplateOperation topologyTemplateOperation) {
+ this.topologyTemplateOperation = topologyTemplateOperation;
this.name = "Service Module json Validation Task";
}
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java
index 9f283ed31b..c85385b454 100644
--- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java
+++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ArtifactValidatorTool.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.asdctool.main;
+import org.openecomp.sdc.asdctool.configuration.ConfigurationUploader;
import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL;
import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager;
import org.openecomp.sdc.asdctool.impl.validator.config.ValidationToolConfiguration;
@@ -49,6 +50,7 @@ public class ArtifactValidatorTool {
}
private static AnnotationConfigApplicationContext initContext(String appConfigDir) {
+ ConfigurationUploader.uploadConfigurationFiles(appConfigDir);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValidationToolConfiguration.class);
return context;
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java
index ac394f500c..1ee1c4a700 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/configuration/ArtifactUUIDFixConfigurationTest.java
@@ -20,9 +20,16 @@
package org.openecomp.sdc.asdctool.configuration;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix;
import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.tosca.CsarUtils;
+import org.openecomp.sdc.be.tosca.ToscaExportHandler;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
public class ArtifactUUIDFixConfigurationTest {
@@ -38,7 +45,14 @@ public class ArtifactUUIDFixConfigurationTest {
// default test
testSubject = createTestSubject();
- result = testSubject.artifactUuidFix();
+ JanusGraphDao janusGraphDao = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+ ToscaExportHandler toscaExportHandler = mock(ToscaExportHandler.class);
+ ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+ CsarUtils csarUtils = mock(CsarUtils.class);
+
+ result = testSubject.artifactUuidFix(janusGraphDao, toscaOperationFacade,
+ toscaExportHandler, artifactCassandraDao, csarUtils);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java
index d99a831903..3472721dc6 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/DataMigrationTest.java
@@ -53,6 +53,8 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
+import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.schema.Table;
import org.openecomp.sdc.be.resources.data.auditing.*;
import org.openecomp.sdc.common.datastructure.AuditingFieldsKey;
@@ -63,6 +65,7 @@ import java.util.Date;
import java.util.HashMap;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import static org.openecomp.sdc.common.datastructure.AuditingFieldsKey.*;
@RunWith(MockitoJUnitRunner.class)
@@ -103,7 +106,11 @@ public class DataMigrationTest {
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern);
- private static DataMigration dataMigration = new DataMigration();
+ private static ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+
+ private static AuditCassandraDao auditCassandraDaoMock = mock(AuditCassandraDao.class);
+
+ private static DataMigration dataMigration = new DataMigration(auditCassandraDaoMock, artifactCassandraDao);
private final static String ES_STRING = "{\"" + AuditingFieldsKey.AUDIT_ACTION + "\":\"%s\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_NAME + "\":\"" + RESOURCE_NAME + "\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_TOSCA_NODE_TYPE + "\":\"" + TOSCA_NODE_TYPE +
"\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_PREV_VERSION + "\":\"" + PREV_VERSION + "\", \"" + AuditingFieldsKey.AUDIT_RESOURCE_PREV_STATE + "\":\"" + PREV_STATE +
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java
index 1b907142fd..f1f161b2db 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/EsToCassandraDataMigrationConfigTest.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.asdctool.impl;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
@@ -38,10 +40,12 @@ public class EsToCassandraDataMigrationConfigTest {
public void testDataMigration() throws Exception {
EsToCassandraDataMigrationConfig testSubject;
DataMigration result;
+ AuditCassandraDao auditCassandraDaoMock = mock(AuditCassandraDao.class);
+ ArtifactCassandraDao artifactCassandraDaoMock = mock(ArtifactCassandraDao.class);
// default test
testSubject = createTestSubject();
- result = testSubject.dataMigration();
+ result = testSubject.dataMigration(auditCassandraDaoMock, artifactCassandraDaoMock);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java
index a353612332..da3c858170 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ArtifactToolBLTest.java
@@ -20,15 +20,20 @@
package org.openecomp.sdc.asdctool.impl.validator;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter;
import java.util.LinkedList;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class ArtifactToolBLTest {
private ArtifactToolBL createTestSubject() {
- return new ArtifactToolBL();
+ return new ArtifactToolBL(new ArrayList<>());
}
//Generated test
@@ -38,9 +43,12 @@ public class ArtifactToolBLTest {
boolean result;
// default test
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
testSubject = createTestSubject();
testSubject.validators = new LinkedList();
- testSubject.validators.add(new NodeToscaArtifactsValidatorExecuter());
+ testSubject.validators.add(new NodeToscaArtifactsValidatorExecuter(janusGraphDaoMock,toscaOperationFacade));
result = testSubject.validateAll();
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java
index 071d6373f2..57c4d9c02e 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/ValidationToolBLTest.java
@@ -20,15 +20,20 @@
package org.openecomp.sdc.asdctool.impl.validator;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter;
import java.util.LinkedList;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class ValidationToolBLTest {
private ValidationToolBL createTestSubject() {
- return new ValidationToolBL();
+ return new ValidationToolBL(new ArrayList<>());
}
@Test(expected=NullPointerException.class)
@@ -37,9 +42,10 @@ public class ValidationToolBLTest {
boolean result;
// default test
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
testSubject = createTestSubject();
testSubject.validators = new LinkedList<>();
- testSubject.validators.add(new ServiceValidatorExecuter());
+ testSubject.validators.add(new ServiceValidatorExecuter(janusGraphDaoMock));
result = testSubject.validateAll();
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
index fb2e29848d..a6ae4d2492 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java
@@ -20,6 +20,9 @@
package org.openecomp.sdc.asdctool.impl.validator.config;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL;
import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL;
@@ -48,40 +51,44 @@ public class ValidationToolConfigurationTest {
public void testBasicServiceValidator() {
ValidationToolConfiguration testSubject;
ServiceValidatorExecuter result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
// default test
testSubject = createTestSubject();
- result = testSubject.basicServiceValidator();
+ result = testSubject.basicServiceValidator(janusGraphDaoMock);
}
@Test
public void testVfArtifactValidationTask() {
ValidationToolConfiguration testSubject;
VfArtifactValidationTask result;
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
// default test
testSubject = createTestSubject();
- result = testSubject.vfArtifactValidationTask();
+ result = testSubject.vfArtifactValidationTask(artifactValidationUtilsMock);
}
@Test
public void testServiceArtifactValidationTask() {
ValidationToolConfiguration testSubject;
ServiceArtifactValidationTask result;
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
// default test
testSubject = createTestSubject();
- result = testSubject.serviceArtifactValidationTask();
+ result = testSubject.serviceArtifactValidationTask(artifactValidationUtilsMock);
}
@Test
public void testModuleJsonTask() {
ValidationToolConfiguration testSubject;
ModuleJsonTask result;
+ TopologyTemplateOperation topologyTemplateOperationMock = mock(TopologyTemplateOperation.class);
// default test
testSubject = createTestSubject();
- result = testSubject.moduleJsonTask();
+ result = testSubject.moduleJsonTask(topologyTemplateOperationMock);
}
@Test
@@ -91,17 +98,18 @@ public class ValidationToolConfigurationTest {
// default test
testSubject = createTestSubject();
- result = testSubject.validationToolBL();
+ result = testSubject.validationToolBL(new ArrayList<>());
}
@Test
public void testBasicVfValidator() {
ValidationToolConfiguration testSubject;
VfValidatorExecuter result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
// default test
testSubject = createTestSubject();
- result = testSubject.basicVfValidator();
+ result = testSubject.basicVfValidator(new ArrayList<>(), janusGraphDaoMock);
}
@Test
@@ -118,10 +126,12 @@ public class ValidationToolConfigurationTest {
public void testArtifactValidationUtils() {
ValidationToolConfiguration testSubject;
ArtifactValidationUtils result;
+ ArtifactCassandraDao artifactCassandraDaoMock = mock(ArtifactCassandraDao.class);
+ TopologyTemplateOperation topologyTemplateOperationMock = mock(TopologyTemplateOperation.class);
// default test
testSubject = createTestSubject();
- result = testSubject.artifactValidationUtils();
+ result = testSubject.artifactValidationUtils(artifactCassandraDaoMock, topologyTemplateOperationMock);
}
@Test
@@ -203,86 +213,52 @@ public class ValidationToolConfigurationTest {
// default test
testSubject = createTestSubject();
- result = testSubject.janusGraphDao(janusGraphClient);
- }
-
- @Test
- public void testCategoryOperation() {
- ValidationToolConfiguration testSubject;
- CategoryOperation result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.categoryOperation();
- }
-
- @Test
- public void testArtifactsOperation() {
- ValidationToolConfiguration testSubject;
- ArtifactsOperations result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.artifactsOperation();
- }
-
- @Test
- public void testToscaDataOperation() {
- ValidationToolConfiguration testSubject;
- ToscaDataOperation result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toscaDataOperation();
- }
-
- @Test
- public void testToscaElementLifecycleOperation() {
- ValidationToolConfiguration testSubject;
- ToscaElementLifecycleOperation result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toscaElementLifecycleOperation();
+ result = testSubject.healingJanusGraphDao(janusGraphClient);
}
@Test
- public void testNodeToscaArtifactsValidatorValidator() throws Exception {
+ public void testNodeToscaArtifactsValidatorValidator() {
ValidationToolConfiguration testSubject;
NodeToscaArtifactsValidatorExecuter result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
// default test
testSubject = createTestSubject();
- result = testSubject.NodeToscaArtifactsValidatorValidator();
+ result = testSubject.NodeToscaArtifactsValidatorValidator(janusGraphDaoMock, toscaOperationFacade);
}
@Test
- public void testServiceToscaArtifactsValidator() throws Exception {
+ public void testServiceToscaArtifactsValidator() {
ValidationToolConfiguration testSubject;
ServiceToscaArtifactsValidatorExecutor result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
// default test
testSubject = createTestSubject();
- result = testSubject.ServiceToscaArtifactsValidator();
+ result = testSubject.ServiceToscaArtifactsValidator(janusGraphDaoMock, toscaOperationFacade);
}
@Test
- public void testVFToscaArtifactValidator() throws Exception {
+ public void testVFToscaArtifactValidator() {
ValidationToolConfiguration testSubject;
VFToscaArtifactValidatorExecutor result;
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
// default test
testSubject = createTestSubject();
- result = testSubject.VFToscaArtifactValidator();
+ result = testSubject.VFToscaArtifactValidator(janusGraphDaoMock, toscaOperationFacade);
}
@Test
- public void testArtifactToolBL() throws Exception {
+ public void testArtifactToolBL() {
ValidationToolConfiguration testSubject;
ArtifactToolBL result;
// default test
testSubject = createTestSubject();
- result = testSubject.artifactToolBL();
+ result = testSubject.artifactToolBL(new ArrayList<>());
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java
index e39f28ccaa..a54463bc52 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ArtifactValidatorExecuterTest.java
@@ -20,7 +20,10 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.model.Component;
@@ -30,11 +33,16 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.testng.Assert;
public class ArtifactValidatorExecuterTest {
private ArtifactValidatorExecuter createTestSubject() {
- return new ArtifactValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new ArtifactValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
}
@Test
@@ -68,8 +76,8 @@ public class ArtifactValidatorExecuterTest {
testSubject.setName(name);
}
- @Test(expected=NullPointerException.class)
- public void testValidate() throws Exception {
+ @Test
+ public void testValidate() {
ArtifactValidatorExecuter testSubject;
Map<String, List<Component>> vertices = new HashMap<>();
LinkedList<Component> linkedList = new LinkedList<Component>();
@@ -80,5 +88,6 @@ public class ArtifactValidatorExecuterTest {
// default test
testSubject = createTestSubject();
result = testSubject.validate(vertices);
+ Assert.assertFalse(result);
}
}
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java
index 254cb407a9..a5f816c25c 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/NodeToscaArtifactsValidatorExecuterTest.java
@@ -20,12 +20,19 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class NodeToscaArtifactsValidatorExecuterTest {
private NodeToscaArtifactsValidatorExecuter createTestSubject() {
- return new NodeToscaArtifactsValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new NodeToscaArtifactsValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
}
@Test(expected=NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java
index 3884c38d2a..9c0571cbb8 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceToscaArtifactsValidatorExecutorTest.java
@@ -20,12 +20,19 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class ServiceToscaArtifactsValidatorExecutorTest {
private ServiceToscaArtifactsValidatorExecutor createTestSubject() {
- return new ServiceToscaArtifactsValidatorExecutor();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new ServiceToscaArtifactsValidatorExecutor(janusGraphDaoMock, toscaOperationFacade);
}
@Test(expected = NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java
index 19f512ff1d..6b243b359e 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/ServiceValidatorExecuterTest.java
@@ -20,12 +20,16 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
public class ServiceValidatorExecuterTest {
private ServiceValidatorExecuter createTestSubject() {
- return new ServiceValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ return new ServiceValidatorExecuter(janusGraphDaoMock);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java
index 89568ce8fc..41c04c37ec 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuterTest.java
@@ -20,13 +20,17 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
public class TopologyTemplateValidatorExecuterTest {
private TopologyTemplateValidatorExecuter createTestSubject() {
- return new TopologyTemplateValidatorExecuter();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ return new TopologyTemplateValidatorExecuter(janusGraphDaoMock);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java
index f44f659ee3..1dfd353087 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VFToscaArtifactValidatorExecutorTest.java
@@ -20,12 +20,19 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
public class VFToscaArtifactValidatorExecutorTest {
private VFToscaArtifactValidatorExecutor createTestSubject() {
- return new VFToscaArtifactValidatorExecutor();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+ ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
+
+ return new VFToscaArtifactValidatorExecutor(janusGraphDaoMock, toscaOperationFacade);
}
@Test(expected=NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java
index e833f5c2d0..688f4ca108 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executers/VfValidatorExecuterTest.java
@@ -20,12 +20,21 @@
package org.openecomp.sdc.asdctool.impl.validator.executers;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
import org.junit.Test;
+import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
public class VfValidatorExecuterTest {
private VfValidatorExecuter createTestSubject() {
- return new VfValidatorExecuter();
+ List<VfValidationTask> validationTasks = new ArrayList<>();
+ JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
+
+ return new VfValidatorExecuter(validationTasks, janusGraphDaoMock);
}
@Test
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java
index 326782548d..5053f4b9e3 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java
@@ -20,17 +20,23 @@
package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
+import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import java.util.List;
import java.util.Map;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation;
public class ArtifactValidationUtilsTest {
private ArtifactValidationUtils createTestSubject() {
- return new ArtifactValidationUtils();
+ ArtifactCassandraDao artifactCassandraDao = mock(ArtifactCassandraDao.class);
+ TopologyTemplateOperation topologyTemplateOperation = mock(TopologyTemplateOperation.class);
+ return new ArtifactValidationUtils(artifactCassandraDao, topologyTemplateOperation);
}
@Test(expected=NullPointerException.class)
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java
index 3e1e7cf32e..d55f42131a 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ServiceArtifactValidationTaskTest.java
@@ -20,16 +20,20 @@
package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.testng.Assert;
public class ServiceArtifactValidationTaskTest {
private ServiceArtifactValidationTask createTestSubject() {
- return new ServiceArtifactValidationTask();
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
+ return new ServiceArtifactValidationTask(artifactValidationUtilsMock);
}
- @Test(expected=NullPointerException.class)
+ @Test
public void testValidate() throws Exception {
ServiceArtifactValidationTask testSubject;
GraphVertex vertex = null;
diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java
index 0913be2595..a02f80a785 100644
--- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java
+++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/VfArtifactValidationTaskTest.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts;
+import static org.mockito.Mockito.mock;
+
import org.junit.Test;
import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
@@ -27,10 +29,11 @@ import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
public class VfArtifactValidationTaskTest {
private VfArtifactValidationTask createTestSubject() {
- return new VfArtifactValidationTask();
+ ArtifactValidationUtils artifactValidationUtilsMock = mock(ArtifactValidationUtils.class);
+ return new VfArtifactValidationTask(artifactValidationUtilsMock);
}
- @Test(expected=NullPointerException.class)
+ @Test
public void testValidate() throws Exception {
VfArtifactValidationTask testSubject;
GraphVertex vertex = null;