diff options
Diffstat (limited to 'asdctool/src/main/java')
23 files changed, 253 insertions, 99 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; } |