From bc741a1eeb2455903734a5603281cc17ca898d11 Mon Sep 17 00:00:00 2001 From: vasraz Date: Wed, 25 Aug 2021 12:05:32 +0100 Subject: Remove usage of outdated library JMockit (catalog-dao) Move JanusGraph to correct folder Signed-off-by: Vasyl Razinkov Change-Id: I726b2a714e0b59422865ef6ca2e7ba9f5881353b Issue-ID: SDC-3379 --- .../ArtifactUUIDFixConfiguration.java | 2 +- .../configuration/CsarGeneratorConfiguration.java | 2 +- .../configuration/InternalToolConfiguration.java | 2 +- .../configuration/VrfObjectFixConfiguration.java | 2 +- .../sdc/asdctool/impl/ArtifactUuidFix.java | 2 +- .../sdc/asdctool/impl/VrfObjectFixHandler.java | 2 +- .../asdctool/impl/internal/tool/CsarGenerator.java | 2 +- .../impl/internal/tool/DeleteComponentHandler.java | 2 +- .../config/ValidationToolConfiguration.java | 4 +- .../executor/ArtifactValidatorExecutor.java | 2 +- .../NodeToscaArtifactsValidatorExecutor.java | 2 +- .../ServiceToscaArtifactsValidatorExecutor.java | 2 +- .../TopologyTemplateValidatorExecutor.java | 2 +- .../executor/VFToscaArtifactValidatorExecutor.java | 2 +- .../ArtifactUUIDFixConfigurationTest.java | 2 +- .../sdc/asdctool/impl/ArtifactUuidFixTest.java | 2 +- .../sdc/asdctool/impl/VrfObjectFixHandlerTest.java | 2 +- .../impl/internal/tool/CsarGeneratorTest.java | 2 +- .../internal/tool/DeleteComponentHandlerTest.java | 2 +- .../impl/validator/ArtifactToolBLTest.java | 2 +- .../impl/validator/ValidationToolBLTest.java | 2 +- .../config/ValidationToolConfigurationTest.java | 2 +- .../ArtifactValidatorExecutorContract.java | 2 +- .../IArtifactValidatorExecutorContract.java | 2 +- .../NodeToscaArtifactsValidatorExecutorTest.java | 2 +- ...ServiceToscaArtifactsValidatorExecutorTest.java | 2 +- .../VFToscaArtifactValidatorExecutorTest.java | 2 +- .../validator/executor/ValidatorExecutorTest.java | 2 +- .../csar/YamlTemplateParsingHandler.java | 2 +- .../be/components/impl/ArchiveBusinessLogic.java | 2 +- .../sdc/be/components/impl/BaseBusinessLogic.java | 2 +- .../be/components/impl/GroupTypeBusinessLogic.java | 10 +- .../components/impl/PolicyTypeBusinessLogic.java | 14 +- .../be/components/impl/ResourceBusinessLogic.java | 214 ++-- .../be/components/impl/utils/ExceptionUtils.java | 2 +- .../lifecycle/CertificationChangeTransition.java | 2 +- .../be/components/lifecycle/CheckinTransition.java | 2 +- .../components/lifecycle/CheckoutTransition.java | 2 +- .../components/lifecycle/LifeCycleTransition.java | 2 +- .../lifecycle/LifecycleBusinessLogic.java | 2 +- .../lifecycle/UndoCheckoutTransition.java | 2 +- .../components/upgrade/UpgradeBusinessLogic.java | 2 +- .../openecomp/sdc/be/filters/BeServletFilter.java | 2 +- .../java/org/openecomp/sdc/be/MockGenerator.java | 2 +- .../components/BaseServiceBusinessLogicTest.java | 2 +- .../be/components/PropertyBusinessLogicTest.java | 2 +- .../AdditionalInformationBusinessLogicTest.java | 2 +- .../components/impl/ArtifactBusinessLogicTest.java | 2 +- .../impl/ArtifactsBusinessLogicTest.java | 2 +- .../impl/AttributeBusinessLogicTest.java | 2 +- .../impl/CapabilitiesBusinessLogicTest.java | 2 +- .../impl/ComponentInstanceBusinessLogicTest.java | 2 +- ...mponentInterfaceOperationBusinessLogicTest.java | 2 +- .../impl/ComponentNodeFilterBusinessLogicTest.java | 2 +- ...mponentSubstitutionFilterBusinessLogicTest.java | 3 +- .../sdc/be/components/impl/ElementBLTest.java | 2 +- .../components/impl/ElementBusinessLogicTest.java | 2 +- .../be/components/impl/GroupBusinessLogicTest.java | 2 +- .../components/impl/InputsBusinessLogicTest.java | 2 +- .../impl/InterfaceOperationBusinessLogicTest.java | 2 +- .../components/impl/OutputsBusinessLogicTest.java | 16 +- .../components/impl/PolicyBusinessLogicTest.java | 2 +- .../impl/PolicyPropertiesBusinessLogicTest.java | 2 +- .../impl/PolicyTypeBusinessLogicTest.java | 2 +- .../components/impl/ProductBusinessLogicTest.java | 2 +- .../impl/RequirementBusinessLogicTest.java | 2 +- .../impl/ResourceBusinessLogicMockitoTest.java | 2 +- .../components/impl/ResourceBusinessLogicTest.java | 2 +- .../impl/ServiceBussinessLogicBaseTestSetup.java | 2 +- .../ServiceImportBussinessLogicBaseTestSetup.java | 2 +- .../impl/utils/YamlTemplateParsingHandlerTest.java | 2 +- .../be/components/lifecycle/LifecycleTestBase.java | 2 +- .../merge/utils/MergeInstanceUtilsTest.java | 2 +- .../be/components/path/BaseForwardingPathTest.java | 2 +- .../be/components/path/utils/GraphTestUtils.java | 2 +- .../upgrade/UpgradeBusinessLogicTest.java | 2 +- .../servlet/ExternalRefServletTest.java | 2 +- .../sdc/be/servlets/ArchiveEndpointTest.java | 2 +- .../be/servlets/AutomatedUpgradeEndpointTest.java | 2 +- .../sdc/be/servlets/GroupTypesEndpointTest.java | 7 +- .../src/test/resources/paths/path-context.xml | 86 +- catalog-dao/pom.xml | 6 - .../sdc/be/dao/config/JanusGraphSpringConfig.java | 2 +- .../be/dao/janusgraph/HealingJanusGraphDao.java | 56 + .../sdc/be/dao/janusgraph/JanusGraphDao.java | 1233 +++++++++++++++++++ .../sdc/be/dao/jsongraph/HealingJanusGraphDao.java | 57 - .../sdc/be/dao/jsongraph/JanusGraphDao.java | 1234 -------------------- .../sdc/be/dao/cassandra/CassandraClientTest.java | 70 +- .../be/dao/janusgraph/JanusGraphDaoMockTest.java | 545 +++++++++ .../sdc/be/dao/janusgraph/JanusGraphDaoTest.java | 329 ++++++ .../be/dao/jsongraph/JanusGraphDaoMockTest.java | 606 ---------- .../sdc/be/dao/jsongraph/JanusGraphDaoTest.java | 332 ------ .../sdc/be/utils/DAOConfDependentTest.java | 11 +- .../operations/ArchiveOperation.java | 2 +- .../jsonjanusgraph/operations/BaseOperation.java | 2 +- .../ByToscaNameDerivedNodeTypeResolver.java | 2 +- .../operations/ExternalReferencesOperation.java | 2 +- .../jsonjanusgraph/operations/PolicyOperation.java | 2 +- .../operations/ToscaOperationFacade.java | 2 +- .../be/model/operations/impl/ElementOperation.java | 2 +- .../be/model/operations/impl/GroupOperation.java | 2 +- .../be/model/operations/impl/ModelOperation.java | 2 +- .../be/model/operations/impl/OperationUtils.java | 2 +- .../operations/ArchiveOperationTest.java | 2 +- .../operations/CapabilitiesOperationTest.java | 2 +- .../ExternalReferencesOperationTest.java | 2 +- .../operations/GroupsOperationTest.java | 2 +- .../operations/InterfaceOperationTest.java | 2 +- .../operations/NodeTemplateOperationGraphTest.java | 2 +- .../operations/NodeTemplateOperationTest.java | 2 +- .../operations/PolicyOperationIntegrationTest.java | 2 +- .../operations/PolicyOperationTest.java | 2 +- ...TemplateOperationCapabilityIntegrationTest.java | 2 +- .../operations/TopologyTemplateOperationTest.java | 2 +- .../ToscaElementOperationCatalogTest.java | 2 +- .../operations/ToscaElementOperationTest.java | 2 +- .../ToscaOperationFacadePoliciesTest.java | 2 +- .../operations/ToscaOperationFacadeTest.java | 2 +- .../operations/UpgradeOperationTest.java | 2 +- .../model/jsonjanusgraph/utils/GraphTestUtils.java | 2 +- .../operations/impl/ElementOperationTest.java | 3 +- .../model/operations/impl/ModelOperationTest.java | 2 +- .../model/operations/impl/OperationUtilsTest.java | 2 +- .../impl/ToscaElementLifecycleOperationTest.java | 2 +- .../openecomp-tosca-converter-core/pom.xml | 6 - 125 files changed, 2499 insertions(+), 2551 deletions(-) create mode 100644 catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphDao.java create mode 100644 catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java delete mode 100644 catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java delete mode 100644 catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java create mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java delete mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java delete mode 100644 catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java 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 1eb4b2a33f..5d5c85a2f9 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 @@ -23,7 +23,7 @@ import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix; 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.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.be.tosca.ToscaExportHandler; 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 a55d9656c2..fad14d8e16 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,7 @@ import org.openecomp.sdc.asdctool.impl.internal.tool.CsarGenerator; 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.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.be.tosca.ToscaExportHandler; 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 c0d65b2ebe..b0b46a90c9 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 @@ -22,7 +22,7 @@ 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.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; import org.springframework.context.annotation.Bean; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java index 4df895fb16..6013591ebd 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/configuration/VrfObjectFixConfiguration.java @@ -23,7 +23,7 @@ import org.openecomp.sdc.asdctool.impl.VrfObjectFixHandler; import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy; import org.openecomp.sdc.be.dao.JanusGraphClientStrategy; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; 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 b256f122a7..d6aad24a24 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 @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java index cadab7f8a5..5623735ee1 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandler.java @@ -36,7 +36,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.sdc.asdctool.migration.tasks.handlers.XlsOutputHandler; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; 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 2b655b0bfb..a34d9046e9 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 @@ -32,7 +32,7 @@ import org.openecomp.sdc.asdctool.utils.ConsoleWriter; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; 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 b286ffd796..1a3234e1bc 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 @@ -31,7 +31,7 @@ import org.janusgraph.core.JanusGraphVertex; import org.openecomp.sdc.asdctool.utils.ConsoleWriter; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; 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 05cdcd2ea2..8c0b28d986 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 @@ -46,8 +46,8 @@ import org.openecomp.sdc.be.dao.config.DAOSpringConfig; import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; 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.dao.janusgraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.DerivedNodeTypeResolver; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ByToscaNameDerivedNodeTypeResolver; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutor.java index 367c2a97b0..531d54a466 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutor.java @@ -38,7 +38,7 @@ import java.util.Set; import java.util.stream.Collectors; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutor.java index 2b22963076..b8beb0813d 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutor.java @@ -22,7 +22,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.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; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutor.java index 64401f7e38..99ba7726cc 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutor.java @@ -22,7 +22,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.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; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutor.java index ab568c3c85..a4f540fe7c 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/TopologyTemplateValidatorExecutor.java @@ -32,7 +32,7 @@ import org.openecomp.sdc.asdctool.impl.validator.tasks.TopologyTemplateValidatio import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask; import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.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; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutor.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutor.java index 8de7efc4d7..81f7f5d5be 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutor.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutor.java @@ -22,7 +22,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.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; 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 bc1c87d398..e9806106f2 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 @@ -24,7 +24,7 @@ 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.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.be.tosca.ToscaExportHandler; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java index 4e17123bd7..51e5657b7f 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/ArtifactUuidFixTest.java @@ -33,7 +33,7 @@ import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java index 9e6b2e424e..05dbdd69e7 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/VrfObjectFixHandlerTest.java @@ -27,7 +27,7 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import static org.assertj.core.api.Assertions.assertThat; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java index b3bd487b55..3558d279b3 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGeneratorTest.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java index b9cf317e70..de2657838b 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/internal/tool/DeleteComponentHandlerTest.java @@ -39,7 +39,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate; 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 79166e552c..d5251ac40f 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 @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.openecomp.sdc.asdctool.impl.validator.executor.IArtifactValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.executor.NodeToscaArtifactsValidatorExecutor; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import java.util.ArrayList; 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 529a9b6768..b2b3ab6e1c 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 @@ -27,7 +27,7 @@ import org.openecomp.sdc.asdctool.impl.validator.executor.TopologyTemplateValida import org.openecomp.sdc.asdctool.impl.validator.executor.ValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.report.Report; import org.openecomp.sdc.asdctool.impl.validator.report.ReportFile; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import java.util.ArrayList; import java.util.List; 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 9efd4c4893..a3f0d8e407 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 @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.DerivedNodeTypeResolver; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java index 21a931cc86..621b832898 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ArtifactValidatorExecutorContract.java @@ -29,7 +29,7 @@ import java.util.List; import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.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; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java index 35c6ac1173..8af265e715 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/IArtifactValidatorExecutorContract.java @@ -22,7 +22,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import static org.mockito.Mockito.mock; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java index b189b27d97..d75bd8958f 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/NodeToscaArtifactsValidatorExecutorTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; public class NodeToscaArtifactsValidatorExecutorTest diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java index ef35d45e63..314f54dcf6 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ServiceToscaArtifactsValidatorExecutorTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; public class ServiceToscaArtifactsValidatorExecutorTest diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java index 3beec33e50..ca6c7fc250 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/VFToscaArtifactValidatorExecutorTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; public class VFToscaArtifactValidatorExecutorTest diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ValidatorExecutorTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ValidatorExecutorTest.java index faab454a79..3f8b4af9ba 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ValidatorExecutorTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/executor/ValidatorExecutorTest.java @@ -21,7 +21,7 @@ package org.openecomp.sdc.asdctool.impl.validator.executor; import org.junit.jupiter.api.Test; import org.openecomp.sdc.asdctool.impl.validator.report.Report; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import java.util.ArrayList; import java.util.function.Function; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java index 6a56da2c4d..0006f833b2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/YamlTemplateParsingHandler.java @@ -78,7 +78,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx import org.openecomp.sdc.be.components.utils.PropertiesUtils; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java index 58a0ebf41a..19afff0668 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogic.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.catalog.enums.ChangeTypeEnum; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.validation.AccessValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.facade.operations.CatalogOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index 3cb76806c8..db03c72778 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -43,7 +43,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.ArtifactUtils; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java index 5ee62c0b19..055abdc765 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeBusinessLogic.java @@ -32,11 +32,11 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component("groupTypeBusinessLogic") @@ -45,14 +45,12 @@ public class GroupTypeBusinessLogic { private final GroupTypeOperation groupTypeOperation; private final JanusGraphDao janusGraphDao; private final UserValidations userValidations; - private final ComponentsUtils componentsUtils; - public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, JanusGraphDao janusGraphDao, UserValidations userValidations, - ComponentsUtils componentsUtils) { + @Autowired + public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, JanusGraphDao janusGraphDao, UserValidations userValidations) { this.groupTypeOperation = groupTypeOperation; this.janusGraphDao = janusGraphDao; this.userValidations = userValidations; - this.componentsUtils = componentsUtils; } public List getAllGroupTypes(String userId, String internalComponentType, String internalComponentModel) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java index 1e0a55fd07..c7e6a98d92 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java @@ -29,31 +29,27 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PolicyTypeOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -@Component +@Component("policyTypeBusinessLogic") public class PolicyTypeBusinessLogic { private PolicyTypeOperation policyTypeOperation; private JanusGraphDao janusGraphDao; - private ComponentsUtils componentsUtils; private UserValidations userValidations; - public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, JanusGraphDao janusGraphDao, ComponentsUtils componentsUtils, - UserValidations userValidations) { + @Autowired + public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, JanusGraphDao janusGraphDao, UserValidations userValidations) { this.policyTypeOperation = policyTypeOperation; this.janusGraphDao = janusGraphDao; - this.componentsUtils = componentsUtils; this.userValidations = userValidations; } - @Transactional public List getAllPolicyTypes(String userId, String internalComponentType, String modelName) { Set excludedPolicyTypes = getExcludedPolicyTypes(internalComponentType); userValidations.validateUserExists(userId); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 6185dc9b0e..9bb4f62f01 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -83,7 +83,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datamodel.utils.ArtifactUtils; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; @@ -564,15 +564,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { preparedResource = updateExistingResourceByImport(newResource, oldResource, csarInfo.getModifier(), inTransaction, shouldLock, isNested).left; log.trace("YAML topology file found in CSAR, file name: {}, contents: {}", yamlFileName, yamlFileContent); - handleResourceGenericType(preparedResource, yamlFileContent, uploadComponentInstanceInfoMap, uploadComponentInstanceInfoMap.getSubstitutionMappingNodeType()); + handleResourceGenericType(preparedResource, yamlFileContent, uploadComponentInstanceInfoMap, + uploadComponentInstanceInfoMap.getSubstitutionMappingNodeType()); handleNodeTypes(yamlFileName, preparedResource, yamlFileContent, shouldLock, nodeTypesArtifactsToHandle, createdArtifacts, nodeTypesInfo, csarInfo, nodeName, newResource.getModel()); preparedResource = createInputsOnResource(preparedResource, uploadComponentInstanceInfoMap.getInputs()); Map existingNodeTypesByResourceNames = new HashMap<>(); - final Map instancesToCreate = getInstancesToCreate(uploadComponentInstanceInfoMap, newResource.getModel()); + final Map instancesToCreate = getInstancesToCreate(uploadComponentInstanceInfoMap, + newResource.getModel()); preparedResource = createResourceInstances(yamlFileName, preparedResource, oldResource, instancesToCreate, csarInfo.getCreatedNodes(), existingNodeTypesByResourceNames); - preparedResource = createResourceInstancesRelations(csarInfo.getModifier(), yamlFileName, preparedResource, oldResource, instancesToCreate, + preparedResource = createResourceInstancesRelations(csarInfo.getModifier(), yamlFileName, preparedResource, oldResource, + instancesToCreate, existingNodeTypesByResourceNames); } catch (ComponentException e) { ResponseFormat responseFormat = @@ -718,28 +721,32 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } return Either.left(resource); } - + private Resource handleResourceGenericType(Resource resource) { Resource genericResource = fetchAndSetDerivedFromGenericType(resource); - + if (resource.shouldGenerateInputs()) { generateAndAddInputsFromGenericTypeProperties(resource, genericResource); } return genericResource; } - private Resource handleResourceGenericType(final Resource resource, final String topologyTemplateYaml, final ParsedToscaYamlInfo parsedToscaYamlInfo, final String substitutionMappingNodeType) { + private Resource handleResourceGenericType(final Resource resource, final String topologyTemplateYaml, + final ParsedToscaYamlInfo parsedToscaYamlInfo, final String substitutionMappingNodeType) { if (processSubstitutableAsNodeType(resource, parsedToscaYamlInfo)) { - final Map substitutableAsNodeType = getSubstitutableAsNodeTypeFromTemplate((Map) new Yaml().load(topologyTemplateYaml), substitutionMappingNodeType); - final Resource genericResource = fetchAndSetDerivedFromGenericType(resource, (String)substitutableAsNodeType.get(TypeUtils.ToscaTagNamesEnum.DERIVED_FROM.getElementName())); - + final Map substitutableAsNodeType = getSubstitutableAsNodeTypeFromTemplate( + (Map) new Yaml().load(topologyTemplateYaml), substitutionMappingNodeType); + final Resource genericResource = fetchAndSetDerivedFromGenericType(resource, + (String) substitutableAsNodeType.get(TypeUtils.ToscaTagNamesEnum.DERIVED_FROM.getElementName())); + generatePropertiesFromGenericType(resource, genericResource); generatePropertiesFromNodeType(resource, substitutableAsNodeType); final String resourceId = resource.getUniqueId(); - resource.getProperties().forEach(propertyDefinition -> propertyDefinition.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId(resourceId, propertyDefinition.getName()))); + resource.getProperties().forEach(propertyDefinition -> propertyDefinition.setUniqueId( + UniqueIdBuilder.buildPropertyUniqueId(resourceId, propertyDefinition.getName()))); createResourcePropertiesOnGraph(resource); return genericResource; - } + } return handleResourceGenericType(resource); } @@ -989,7 +996,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (!nodes.isEmpty()) { for (Entry nodeType : nodes.entrySet()) { final ImmutablePair toscaResourceName = buildNestedToscaResourceName(ResourceTypeEnum.VFC.name(), vfResourceName, - nodeType.getKey()); + nodeType.getKey()); vfcToscaNames.put(nodeType.getKey(), toscaResourceName); } } @@ -1108,7 +1115,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { boolean needLock, Map>> nodeTypesArtifactsToHandle, List nodeTypesNewCreatedArtifacts, - Map nodeTypesInfo, CsarInfo csarInfo, final String substitutableAsNodeType) { + Map nodeTypesInfo, CsarInfo csarInfo, + final String substitutableAsNodeType) { Either toscaVersion = findFirstToscaStringElement(mappedToscaTemplate, TypeUtils.ToscaTagNamesEnum.TOSCA_VERSION); if (toscaVersion.isRight()) { throw new ByActionStatusComponentException(ActionStatus.INVALID_TOSCA_TEMPLATE); @@ -1123,17 +1131,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { private Map getNodeTypesFromTemplate(final Map mappedToscaTemplate, final String substitutableAsNodeType) { final Map nodeTypes = getAllNodeTypesInTemplate(mappedToscaTemplate); - if (StringUtils.isNotEmpty(substitutableAsNodeType)){ - nodeTypes.remove(substitutableAsNodeType); + if (StringUtils.isNotEmpty(substitutableAsNodeType)) { + nodeTypes.remove(substitutableAsNodeType); } return nodeTypes; } - + @SuppressWarnings("unchecked") - private Map getSubstitutableAsNodeTypeFromTemplate(final Map mappedToscaTemplate, final String substitutableAsNodeType) { - return (Map)getAllNodeTypesInTemplate(mappedToscaTemplate).get(substitutableAsNodeType); + private Map getSubstitutableAsNodeTypeFromTemplate(final Map mappedToscaTemplate, + final String substitutableAsNodeType) { + return (Map) getAllNodeTypesInTemplate(mappedToscaTemplate).get(substitutableAsNodeType); } - + private Map getAllNodeTypesInTemplate(final Map mappedToscaTemplate) { return ImportUtils.findFirstToscaMapElement(mappedToscaTemplate, TypeUtils.ToscaTagNamesEnum.NODE_TYPES).left().orValue(HashMap::new); } @@ -1445,24 +1454,28 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { loggerSupportability.log(LoggerSupportabilityActions.CREATE_INPUTS, resource.getComponentMetadataForSupportLog(), StatusCode.STARTED, "Starting to add inputs from yaml: {}", yamlName); if (processSubstitutableAsNodeType(resource, parsedToscaYamlInfo)) { - final Map substitutableAsNodeType = getSubstitutableAsNodeTypeFromTemplate((Map) new Yaml().load(topologyTemplateYaml), parsedToscaYamlInfo.getSubstitutionMappingNodeType()); + final Map substitutableAsNodeType = getSubstitutableAsNodeTypeFromTemplate( + (Map) new Yaml().load(topologyTemplateYaml), parsedToscaYamlInfo.getSubstitutionMappingNodeType()); resource.setToscaResourceName(parsedToscaYamlInfo.getSubstitutionMappingNodeType()); - final Resource genericResource = fetchAndSetDerivedFromGenericType(resource, (String)substitutableAsNodeType.get(TypeUtils.ToscaTagNamesEnum.DERIVED_FROM.getElementName())); + final Resource genericResource = fetchAndSetDerivedFromGenericType(resource, + (String) substitutableAsNodeType.get(TypeUtils.ToscaTagNamesEnum.DERIVED_FROM.getElementName())); resource = createResourceTransaction(resource, csarInfo.getModifier(), isNormative); generatePropertiesFromGenericType(resource, genericResource); generatePropertiesFromNodeType(resource, substitutableAsNodeType); final String resourceId = resource.getUniqueId(); - resource.getProperties().forEach(propertyDefinition -> propertyDefinition.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId(resourceId, propertyDefinition.getName()))); + resource.getProperties().forEach(propertyDefinition -> propertyDefinition.setUniqueId( + UniqueIdBuilder.buildPropertyUniqueId(resourceId, propertyDefinition.getName()))); createResourcePropertiesOnGraph(resource); final Map instancesToCreate = getInstancesToCreate(parsedToscaYamlInfo, resource.getModel()); - + log.trace("************* Going to create nodes, RI's and Relations from yaml {}", yamlName); loggerSupportability .log(LoggerSupportabilityActions.CREATE_RESOURCE_FROM_YAML, resource.getComponentMetadataForSupportLog(), StatusCode.STARTED, "Start create nodes, RI and Relations from yaml: {}", yamlName); resource = createRIAndRelationsFromYaml(yamlName, resource, instancesToCreate, topologyTemplateYaml, - nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeTypesArtifactsToCreate, nodeName, parsedToscaYamlInfo.getSubstitutionMappingNodeType()); + nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeTypesArtifactsToCreate, nodeName, + parsedToscaYamlInfo.getSubstitutionMappingNodeType()); } else { final Resource genericResource = fetchAndSetDerivedFromGenericType(resource, null); resource = createResourceTransaction(resource, csarInfo.getModifier(), isNormative); @@ -1473,7 +1486,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } final Map inputs = parsedToscaYamlInfo.getInputs(); resource = createInputsOnResource(resource, inputs); - + log.trace("************* Finish to add inputs from yaml {}", yamlName); loggerSupportability.log(LoggerSupportabilityActions.CREATE_INPUTS, resource.getComponentMetadataForSupportLog(), StatusCode.COMPLETE, "Finish to add inputs from yaml: {}", yamlName); @@ -1483,21 +1496,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { log.trace("************* Adding software information to PNF"); softwareInformationBusinessLogic.setSoftwareInformation(resource, csarInfo); log.trace("************* Removing non-mano software information file from PNF"); - if (csarInfo.getSoftwareInformationPath().isPresent() && !softwareInformationBusinessLogic.removeSoftwareInformationFile(csarInfo)) { + if (csarInfo.getSoftwareInformationPath().isPresent() && !softwareInformationBusinessLogic.removeSoftwareInformationFile( + csarInfo)) { log.warn(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, ResourceBusinessLogic.class.getName(), "catalog-be", "Could not remove the software information file."); } } final Map instancesToCreate = getInstancesToCreate(parsedToscaYamlInfo); - + log.trace("************* Going to create nodes, RI's and Relations from yaml {}", yamlName); loggerSupportability .log(LoggerSupportabilityActions.CREATE_RESOURCE_FROM_YAML, resource.getComponentMetadataForSupportLog(), StatusCode.STARTED, "Start create nodes, RI and Relations from yaml: {}", yamlName); resource = createRIAndRelationsFromYaml(yamlName, resource, instancesToCreate, topologyTemplateYaml, nodeTypesNewCreatedArtifacts, nodeTypesInfo, csarInfo, nodeTypesArtifactsToCreate, nodeName, null); - } - + } + log.trace("************* Finished to create nodes, RI and Relation from yaml {}", yamlName); loggerSupportability.log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.COMPLETE, "Finished to create nodes, RI and Relation from yaml: {}", yamlName); @@ -1560,11 +1574,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts); throw new ByResponseFormatComponentException(e.getResponseFormat()); } catch (final ComponentException e) { - log.error(EcompLoggerErrorCode.SCHEMA_ERROR, ResourceBusinessLogic.class.getName(), - "An error has occurred during resource and resource instance creation", e); - rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts); - throw new ByResponseFormatComponentException(e.getResponseFormat()); - } catch (final Exception e) { + log.error(EcompLoggerErrorCode.SCHEMA_ERROR, ResourceBusinessLogic.class.getName(), + "An error has occurred during resource and resource instance creation", e); + rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts); + throw new ByResponseFormatComponentException(e.getResponseFormat()); + } catch (final Exception e) { log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, ResourceBusinessLogic.class.getName(), "An error has occurred during resource and resource instance creation", e); rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts); @@ -1578,20 +1592,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } } - + private boolean processSubstitutableAsNodeType(final Resource resource, final ParsedToscaYamlInfo parsedToscaYamlInfo) { - return !resource.getResourceType().isAtomicType() && StringUtils.isNotEmpty(resource.getModel()) && parsedToscaYamlInfo.getSubstitutionMappingNodeType() != null; + return !resource.getResourceType().isAtomicType() && StringUtils.isNotEmpty(resource.getModel()) + && parsedToscaYamlInfo.getSubstitutionMappingNodeType() != null; } - + private Map getInstancesToCreate(final ParsedToscaYamlInfo parsedToscaYamlInfo) { return getInstancesToCreate(parsedToscaYamlInfo, null); } - + private Map getInstancesToCreate(final ParsedToscaYamlInfo parsedToscaYamlInfo, final String model) { if (StringUtils.isEmpty(model) || StringUtils.isEmpty(parsedToscaYamlInfo.getSubstitutionMappingNodeType())) { return parsedToscaYamlInfo.getInstances(); } - return parsedToscaYamlInfo.getInstances().entrySet().stream().filter(entry -> !parsedToscaYamlInfo.getSubstitutionMappingNodeType().equals(entry.getValue().getType())) + return parsedToscaYamlInfo.getInstances().entrySet().stream() + .filter(entry -> !parsedToscaYamlInfo.getSubstitutionMappingNodeType().equals(entry.getValue().getType())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } @@ -1778,7 +1794,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } return resource; } - + private Resource generatePropertiesFromNodeType(final Resource resource, final Map nodeType) { final Either, ResultStatusEnum> properties = ImportUtils.getProperties(nodeType); if (properties.isLeft()) { @@ -1794,20 +1810,21 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } resource.getProperties().addAll(propertiesList); - } + } return resource; } - + private Resource createResourcePropertiesOnGraph(final Resource resource) { final List resourceProperties = resource.getProperties(); - for (PropertyDefinition propertyDefinition: resourceProperties) { + for (PropertyDefinition propertyDefinition : resourceProperties) { final Either addPropertyEither = toscaOperationFacade - .addPropertyToComponent(propertyDefinition.getName(), propertyDefinition, resource); - + .addPropertyToComponent(propertyDefinition.getName(), propertyDefinition, resource); + if (addPropertyEither.isRight()) { final String error = String.format("failed to add properties from yaml: {}", addPropertyEither.right().value()); - loggerSupportability.log(LoggerSupportabilityActions.CREATE_PROPERTIES, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, - error); + loggerSupportability.log(LoggerSupportabilityActions.CREATE_PROPERTIES, resource.getComponentMetadataForSupportLog(), + StatusCode.ERROR, + error); throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(addPropertyEither.right().value()), error); } } @@ -2293,7 +2310,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { private boolean isValidArtifactType(ArtifactDefinition artifact) { return artifact.getArtifactType() != null && ArtifactTypeEnum.parse(artifact.getArtifactType()) != ArtifactTypeEnum.VENDOR_LICENSE - && ArtifactTypeEnum.parse(artifact.getArtifactType()) != ArtifactTypeEnum.VF_LICENSE; + && ArtifactTypeEnum.parse(artifact.getArtifactType()) != ArtifactTypeEnum.VF_LICENSE; } private Resource createResourceInstancesRelations(User user, String yamlName, Resource resource, Resource oldResource, @@ -2509,7 +2526,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { .getResponseFormatByResource(componentsUtils.convertFromStorageResponse(getResourceRes.right().value()), resource); throw new ByResponseFormatComponentException(responseFormat); } - + } private void addRelationsToRI(String yamlName, Resource resource, Map uploadResInstancesMap, @@ -2677,7 +2694,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Either updateRes = null; Map>> updatedInstCapabilities = new HashMap<>(); Map>> updatedInstRequirements = new HashMap<>(); - + StorageOperationStatus status = toscaOperationFacade.deleteAllCalculatedCapabilitiesRequirements(resource.getUniqueId()); if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { log.debug("Failed to delete all calculated capabilities and requirements of resource {} upon update. Status is {}", @@ -2700,23 +2717,24 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } return updateRes; } - + private Either updateCalculatedCapReqWithSubstitutionMappingsForVf(final Resource resource, - final Map uploadResInstancesMap) { + final Map uploadResInstancesMap) { Either updateRes = null; final Map>> updatedInstCapabilities = new HashMap<>(); final Map>> updatedInstRequirements = new HashMap<>(); - + resource.getComponentInstances().forEach(i -> { setExternalCapabilities(updatedInstCapabilities, i, uploadResInstancesMap.get(i.getName()).getCapabilitiesNamesToUpdate()); setExternalRequirements(updatedInstRequirements, i, uploadResInstancesMap.get(i.getName()).getRequirementsNamesToUpdate()); }); - final StorageOperationStatus status = toscaOperationFacade.updateCalculatedCapabilitiesRequirements(updatedInstCapabilities, updatedInstRequirements, resource); + final StorageOperationStatus status = toscaOperationFacade.updateCalculatedCapabilitiesRequirements(updatedInstCapabilities, + updatedInstRequirements, resource); if (status != StorageOperationStatus.OK) { log.debug( - "Failed to update capabilities and requirements of resource {}. Status is {}", - resource.getUniqueId(), status); + "Failed to update capabilities and requirements of resource {}. Status is {}", + resource.getUniqueId(), status); updateRes = Either.right(status); } @@ -2743,7 +2761,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (isNotEmpty(requirementsNamesToUpdate)) { for (Map.Entry> requirements : instance.getRequirements().entrySet()) { updatedRequirements.put(requirements.getKey(), requirements.getValue().stream().filter( - r -> requirementsNamesToUpdate.containsKey(r.getName()) && !updatedReqNames.contains(requirementsNamesToUpdate.get(r.getName()))) + r -> requirementsNamesToUpdate.containsKey(r.getName()) && !updatedReqNames.contains(requirementsNamesToUpdate.get(r.getName()))) .map(r -> { r.setParentName(r.getName()); r.setName(requirementsNamesToUpdate.get(r.getName())); @@ -2756,48 +2774,48 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { updatedInstRequirements.put(instance, updatedRequirements); } } - + private void setExternalRequirements( - final Map>> updatedInstRequirements, - final ComponentInstance instance, final Map requirementsNamesToUpdate) { + final Map>> updatedInstRequirements, + final ComponentInstance instance, final Map requirementsNamesToUpdate) { final Map> updatedRequirements = new HashMap<>(); final Set updatedReqNames = new HashSet<>(); if (isNotEmpty(requirementsNamesToUpdate)) { for (Map.Entry> requirements : instance.getRequirements().entrySet()) { updatedRequirements.put(requirements.getKey(), - requirements.getValue().stream() - .filter(r -> requirementsNamesToUpdate.containsKey(r.getName()) - && !updatedReqNames.contains(requirementsNamesToUpdate.get(r.getName()))) - .map(r -> { - r.setExternal(true); - r.setExternalName(requirementsNamesToUpdate.get(r.getName())); - updatedReqNames.add(r.getName()); - return r; - }).collect(toList())); + requirements.getValue().stream() + .filter(r -> requirementsNamesToUpdate.containsKey(r.getName()) + && !updatedReqNames.contains(requirementsNamesToUpdate.get(r.getName()))) + .map(r -> { + r.setExternal(true); + r.setExternalName(requirementsNamesToUpdate.get(r.getName())); + updatedReqNames.add(r.getName()); + return r; + }).collect(toList())); } } if (isNotEmpty(updatedRequirements)) { updatedInstRequirements.put(instance, updatedRequirements); } } - + private void setExternalCapabilities( - final Map>> updatedInstCapabilties, - final ComponentInstance instance, Map capabilitiesNamesToUpdate) { + final Map>> updatedInstCapabilties, + final ComponentInstance instance, Map capabilitiesNamesToUpdate) { final Map> updatedCapabilities = new HashMap<>(); final Set updatedCapNames = new HashSet<>(); if (isNotEmpty(capabilitiesNamesToUpdate)) { for (Map.Entry> requirements : instance.getCapabilities().entrySet()) { updatedCapabilities.put(requirements.getKey(), - requirements.getValue().stream() - .filter(c -> capabilitiesNamesToUpdate.containsKey(c.getName()) - && !updatedCapNames.contains(capabilitiesNamesToUpdate.get(c.getName()))) - .map(c -> { - c.setExternal(true); - c.setExternalName(capabilitiesNamesToUpdate.get(c.getName())); - updatedCapNames.add(c.getName()); - return c; - }).collect(toList())); + requirements.getValue().stream() + .filter(c -> capabilitiesNamesToUpdate.containsKey(c.getName()) + && !updatedCapNames.contains(capabilitiesNamesToUpdate.get(c.getName()))) + .map(c -> { + c.setExternal(true); + c.setExternalName(capabilitiesNamesToUpdate.get(c.getName())); + updatedCapNames.add(c.getName()); + return c; + }).collect(toList())); } } if (isNotEmpty(updatedCapabilities)) { @@ -2812,7 +2830,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (isNotEmpty(capabilitiesNamesToUpdate)) { for (Map.Entry> requirements : instance.getCapabilities().entrySet()) { updatedCapabilities.put(requirements.getKey(), requirements.getValue().stream().filter( - c -> capabilitiesNamesToUpdate.containsKey(c.getName()) && !updatedCapNames.contains(capabilitiesNamesToUpdate.get(c.getName()))) + c -> capabilitiesNamesToUpdate.containsKey(c.getName()) && !updatedCapNames.contains(capabilitiesNamesToUpdate.get(c.getName()))) .map(c -> { c.setParentName(c.getName()); c.setName(capabilitiesNamesToUpdate.get(c.getName())); @@ -2851,19 +2869,19 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { for (UploadReqInfo uploadRegInfo : uploadRegInfoList) { log.debug("Going to create relation {}", uploadRegInfo.getName()); loggerSupportability - .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.STARTED, - "Started to create relations on instance: {}", uploadRegInfo.getName()); + .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.STARTED, + "Started to create relations on instance: {}", uploadRegInfo.getName()); String regName = uploadRegInfo.getName(); RequirementCapabilityRelDef regCapRelDef = new RequirementCapabilityRelDef(); regCapRelDef.setFromNode(resourceInstanceId); log.debug("try to find available requirement {} ", regName); Either eitherReqStatus = findAviableRequiremen(regName, yamlName, nodesInfoValue, - currentCompInstance, uploadRegInfo.getCapabilityName()); + currentCompInstance, uploadRegInfo.getCapabilityName()); if (eitherReqStatus.isRight()) { log.debug("failed to find available requirement {} status is {}", regName, eitherReqStatus.right().value()); loggerSupportability - .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, - "ERROR while search available requirement {} status is: {}", regName, eitherReqStatus.right().value()); + .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, + "ERROR while search available requirement {} status is: {}", regName, eitherReqStatus.right().value()); return eitherReqStatus.right().value(); } RequirementDefinition validReq = eitherReqStatus.left().value(); @@ -2888,11 +2906,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (currentCapCompInstance == null) { log.debug("The component instance with name {} not found on resource {} ", uploadRegInfo.getNode(), resource.getUniqueId()); loggerSupportability - .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, - "ERROR component instance with name: {} not found on resource: {}", uploadRegInfo.getNode(), resource.getUniqueId()); + .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, + "ERROR component instance with name: {} not found on resource: {}", uploadRegInfo.getNode(), resource.getUniqueId()); BeEcompErrorManager.getInstance() - .logInternalDataError(COMPONENT_INSTANCE_WITH_NAME + uploadRegInfo.getNode() + IN_RESOURCE, resource.getUniqueId(), - ErrorSeverity.ERROR); + .logInternalDataError(COMPONENT_INSTANCE_WITH_NAME + uploadRegInfo.getNode() + IN_RESOURCE, resource.getUniqueId(), + ErrorSeverity.ERROR); return componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, yamlName); } regCapRelDef.setToNode(currentCapCompInstance.getUniqueId()); @@ -2900,14 +2918,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { CapabilityDefinition aviableCapForRel = findAvailableCapabilityByTypeOrName(validReq, currentCapCompInstance, uploadRegInfo); if (aviableCapForRel == null) { log.debug("aviable capability was not found. req name is {} component instance is {}", validReq.getName(), - currentCapCompInstance.getUniqueId()); + currentCapCompInstance.getUniqueId()); loggerSupportability - .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, - "ERROR available capability was not found. req name is: {} component instance is: {}", validReq.getName(), - currentCapCompInstance.getUniqueId()); + .log(LoggerSupportabilityActions.CREATE_RELATIONS, resource.getComponentMetadataForSupportLog(), StatusCode.ERROR, + "ERROR available capability was not found. req name is: {} component instance is: {}", validReq.getName(), + currentCapCompInstance.getUniqueId()); BeEcompErrorManager.getInstance().logInternalDataError( - "aviable capability was not found. req name is " + validReq.getName() + " component instance is " + currentCapCompInstance - .getUniqueId(), resource.getUniqueId(), ErrorSeverity.ERROR); + "aviable capability was not found. req name is " + validReq.getName() + " component instance is " + currentCapCompInstance + .getUniqueId(), resource.getUniqueId(), ErrorSeverity.ERROR); return componentsUtils.getResponseFormat(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, yamlName); } reqAndRelationshipPair.setCapability(aviableCapForRel.getName()); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java index 316b82b94e..381cdf9681 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/utils/ExceptionUtils.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java index 757c789d5c..f33a87b696 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java @@ -29,7 +29,7 @@ import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java index 61243d4aba..985dabc2a0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckinTransition.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.version.VesionUpdateHandler; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java index 44505ec10c..90778105af 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java @@ -25,7 +25,7 @@ import java.util.List; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java index bd3923e9ac..a4cac10cea 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifeCycleTransition.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java index 6f4c6416f0..8b01ff1853 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java @@ -37,7 +37,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.impl.version.VesionUpdateHandler; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.facade.operations.CatalogOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java index 0502741e7e..c8b50d28a6 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.catalog.enums.ChangeTypeEnum; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.facade.operations.CatalogOperation; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java index fb8c873240..2f9fb78163 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogic.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java index ea1df86906..ddf9e8fbd1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BeServletFilter.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java b/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java index 562d2676c8..7962da901c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/MockGenerator.java @@ -22,7 +22,7 @@ package org.openecomp.sdc.be; import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import static org.mockito.Mockito.mock; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java index d5fe4f159e..268534a67a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java @@ -47,7 +47,7 @@ import org.openecomp.sdc.be.components.utils.ComponentBusinessLogicMock; import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java index 9fc9d3034f..63bb0b8828 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java index 56f5a928bf..0b2d1ba81e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java @@ -41,7 +41,7 @@ import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java index fddb76efe6..f1a1aaaea1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactBusinessLogicTest.java @@ -47,7 +47,7 @@ import org.openecomp.sdc.be.config.ComponentType; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java index 341dce9f49..1c680e5a15 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java @@ -94,7 +94,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java index 7db449df6a..c62d17c967 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogicTest.java @@ -38,7 +38,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.AttributeDefinition; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java index 1783b35008..9bbe64f3f8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java @@ -29,7 +29,7 @@ import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.validation.CapabilitiesValidation; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java index 3029bf7bc1..99034f7785 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java @@ -73,7 +73,7 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java index 0fd61845e6..93334d19dc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogicTest.java @@ -43,7 +43,7 @@ import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java index 91abd16259..a5ff6d9ce4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java @@ -56,7 +56,7 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.ConstraintConvertor; import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java index 1d643b704c..ffda5ecd80 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentSubstitutionFilterBusinessLogicTest.java @@ -49,7 +49,7 @@ import org.openecomp.sdc.be.components.impl.utils.NodeFilterConstraintAction; import org.openecomp.sdc.be.components.validation.NodeFilterValidator; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.ConstraintConvertor; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementSubstitutionFilterPropertyDataDefinition; @@ -58,7 +58,6 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.SubstitutionFilterOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java index f312914400..53d48493fe 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBLTest.java @@ -33,7 +33,7 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java index f52ae209db..3fdc42fc21 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogicTest.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponent import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java index e7cadc4b98..35fae9dff5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java @@ -60,7 +60,7 @@ import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java index b9f6bf004c..9700a86f7e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java @@ -54,7 +54,7 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java index 724bf6ab34..5ff6f40797 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java @@ -48,7 +48,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogicTest.java index 4c74b5f640..88d98de279 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/OutputsBusinessLogicTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -32,47 +31,35 @@ import static org.mockito.Mockito.when; import fj.data.Either; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.components.attribute.AttributeDeclarationOrchestrator; -import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; -import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; -import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstOutputsMap; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceOutput; import org.openecomp.sdc.be.model.ComponentInstanceAttribOutput; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; -import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.OutputDefinition; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; @@ -81,7 +68,6 @@ import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.AttributeOperation; import org.openecomp.sdc.be.user.UserBusinessLogic; -import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java index a183d52913..8ee13e8e59 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogicTest.java @@ -54,7 +54,7 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java index 0dbb69dfcb..0dd51e6611 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyPropertiesBusinessLogicTest.java @@ -38,7 +38,7 @@ import org.openecomp.sdc.be.components.utils.ResourceBuilder; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java index 7391d91309..88a16f6d96 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogicTest.java @@ -43,7 +43,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponent import org.openecomp.sdc.be.components.utils.PolicyTypeBuilder; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.User; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java index 50e19c4338..42d4e4b2ad 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogicTest.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.components.utils.ComponentBusinessLogicMock; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.components.validation.ValidationUtils; import org.openecomp.sdc.be.components.validation.component.ComponentNameValidator; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Product; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java index 13e8e35faf..671715e721 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.validation.RequirementValidation; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicMockitoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicMockitoTest.java index 6920555697..fbb6539e3f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicMockitoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicMockitoTest.java @@ -45,7 +45,7 @@ package org.openecomp.sdc.be.components.impl; //import org.openecomp.sdc.be.components.merge.utils.MergeInstanceUtils; //import org.openecomp.sdc.be.components.validation.UserValidations; //import org.openecomp.sdc.be.dao.api.ActionStatus; -//import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +//import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; //import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; //import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; //import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java index b369773892..fda7c0807e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java @@ -86,7 +86,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java index a4a3b4d628..64b84d4b00 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBussinessLogicBaseTestSetup.java @@ -60,7 +60,7 @@ import org.openecomp.sdc.be.components.validation.service.ServiceTypeValidator; import org.openecomp.sdc.be.components.validation.service.ServiceValidator; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBussinessLogicBaseTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBussinessLogicBaseTestSetup.java index a56114ae49..d309ccedd8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBussinessLogicBaseTestSetup.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBussinessLogicBaseTestSetup.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.components.validation.component.*; import org.openecomp.sdc.be.components.validation.service.*; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java index 3b7ffd70cf..65ad5fc1a6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/YamlTemplateParsingHandlerTest.java @@ -37,7 +37,7 @@ import org.openecomp.sdc.be.components.impl.AnnotationBusinessLogic; import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic; import org.openecomp.sdc.be.components.impl.PolicyTypeBusinessLogic; import org.openecomp.sdc.be.components.validation.AnnotationValidator; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstanceProperty; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java index 6c4d27dd40..a6ead78dcf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/LifecycleTestBase.java @@ -38,7 +38,7 @@ import org.openecomp.sdc.be.components.validation.NodeFilterValidator; import org.openecomp.sdc.be.components.validation.ServiceDistributionValidation; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java index 381aced39b..4090f04e66 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtilsTest.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder; import org.openecomp.sdc.be.components.utils.GroupDefinitionBuilder; import org.openecomp.sdc.be.components.utils.ResourceBuilder; import org.openecomp.sdc.be.components.utils.ServiceBuilder; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java index e2cba1ab30..62db6e283b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/BaseForwardingPathTest.java @@ -33,7 +33,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java index 0456988beb..0c1399bc51 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/utils/GraphTestUtils.java @@ -26,7 +26,7 @@ import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphVertex; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java index dd16d1ae89..7b4e8d90d6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/upgrade/UpgradeBusinessLogicTest.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java index 52d8ce976d..b9765f2c29 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java @@ -68,7 +68,7 @@ import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.dto.ExternalRefDTO; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java index 8a15f473c9..18cdb424f6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java @@ -67,7 +67,7 @@ import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java index 42ffa1af9f..6149d8de7d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java @@ -53,7 +53,7 @@ import org.openecomp.sdc.be.components.upgrade.UpgradeStatus; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java index e3de541376..a03f8d42c9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupTypesEndpointTest.java @@ -51,8 +51,8 @@ import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic; import org.openecomp.sdc.be.components.utils.GroupTypeBuilder; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -108,7 +108,7 @@ class GroupTypesEndpointTest extends JerseySpringBaseTest { @Bean GroupTypeBusinessLogic groupTypeBusinessLogic() { - return new GroupTypeBusinessLogic(groupTypeOperation(), janusGraphDao, userValidations, componentsUtils); + return new GroupTypeBusinessLogic(groupTypeOperation(), janusGraphDao, userValidations); } @Bean @@ -170,7 +170,8 @@ class GroupTypesEndpointTest extends JerseySpringBaseTest { void getGroupTypes_validUser_Success() { List testConfigGroupTypes = buildGroupTypesList(); List fetchedGroupTypes = buildGetGroupTypesCall(USER_ID, COMPONENT_TYPE) - .get(new GenericType<>() {}); + .get(new GenericType<>() { + }); verifyGroupTypesList(testConfigGroupTypes, fetchedGroupTypes); } diff --git a/catalog-be/src/test/resources/paths/path-context.xml b/catalog-be/src/test/resources/paths/path-context.xml index f6306d0f67..752e4ecf13 100644 --- a/catalog-be/src/test/resources/paths/path-context.xml +++ b/catalog-be/src/test/resources/paths/path-context.xml @@ -21,18 +21,18 @@ Modifications copyright (c) 2018 Nokia ================================================================================ --> - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml index e582887ded..f8f1c6cb8f 100644 --- a/catalog-dao/pom.xml +++ b/catalog-dao/pom.xml @@ -173,12 +173,6 @@ Modifications copyright (c) 2018 Nokia ${regex.version} - - org.jmockit - jmockit - test - - com.google.code.bean-matchers bean-matchers diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java index 5f6c237085..31d072c182 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java @@ -34,7 +34,7 @@ import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration -@ComponentScan({"org.openecomp.sdc.be.dao.jsongraph",}) +@ComponentScan({"org.openecomp.sdc.be.dao.janusgraph"}) @EnableTransactionManagement public class JanusGraphSpringConfig { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphDao.java new file mode 100644 index 0000000000..78f99fd063 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphDao.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.openecomp.sdc.be.dao.janusgraph; + +import fj.data.Either; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component("janusgraph-dao") +public class HealingJanusGraphDao extends JanusGraphDao { + + private HealingPipelineDao healingPipelineDao; + + @Autowired + public HealingJanusGraphDao(HealingPipelineDao healingPipelineDao, JanusGraphClient janusGraphClient) { + super(janusGraphClient); + this.healingPipelineDao = healingPipelineDao; + } + + @Override + public Either, JanusGraphOperationStatus> getChildrenVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + Either, JanusGraphOperationStatus> childrenVertecies = super.getChildrenVertices(parentVertex, edgeLabel, parseFlag); + return Either.iif(childrenVertecies.isRight(), () -> childrenVertecies.right().value(), + () -> childrenVertecies.left().value().stream().map(graphVertex -> transformVertex(graphVertex, edgeLabel)).collect(Collectors.toList())); + } + + private GraphVertex transformVertex(GraphVertex graphVertex, EdgeLabelEnum edgeLabelEnum) { + Optional optional = healingPipelineDao.performGraphReadHealing(graphVertex, edgeLabelEnum); + return optional.orElse(graphVertex); + } + + public void setHealingPipelineDao(HealingPipelineDao healingPipelineDao) { + this.healingPipelineDao = healingPipelineDao; + } +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java new file mode 100644 index 0000000000..5d0c4cffb6 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDao.java @@ -0,0 +1,1233 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.sdc.be.dao.janusgraph; + +import static org.apache.commons.collections.CollectionUtils.isEmpty; + +import fj.data.Either; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; +import java.util.Optional; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphEdge; +import org.janusgraph.core.JanusGraphQuery; +import org.janusgraph.core.JanusGraphVertex; +import org.janusgraph.core.JanusGraphVertexQuery; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.graphdb.query.JanusGraphPredicate; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils; +import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import org.openecomp.sdc.common.jsongraph.util.CommonUtility; +import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; +import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; +import org.openecomp.sdc.common.log.wrappers.Logger; +import org.springframework.beans.factory.annotation.Qualifier; + +public class JanusGraphDao { + + private static final Logger logger = Logger.getLogger(JanusGraphDao.class); + JanusGraphClient janusGraphClient; + + public JanusGraphDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient) { + this.janusGraphClient = janusGraphClient; + logger.info("** JanusGraphDao created"); + } + + public JanusGraphOperationStatus commit() { + logger.debug("#commit - The operation succeeded. Doing commit..."); + return janusGraphClient.commit(); + } + + public JanusGraphOperationStatus rollback() { + logger.debug("#rollback - The operation failed. Doing rollback..."); + return janusGraphClient.rollback(); + } + + public Either getGraph() { + return janusGraphClient.getGraph(); + } + + /** + * @param graphVertex + * @return + */ + public Either createVertex(GraphVertex graphVertex) { + logger.trace("try to create vertex for ID [{}]", graphVertex.getUniqueId()); + Either graph = janusGraphClient.getGraph(); + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + JanusGraphVertex vertex = tGraph.addVertex(); + setVertexProperties(vertex, graphVertex); + graphVertex.setVertex(vertex); + return Either.left(graphVertex); + } catch (Exception e) { + logger + .error(EcompLoggerErrorCode.DATA_ERROR, "JanusGraphDao", "Failed to create Node for ID '{}'", (Object) graphVertex.getUniqueId(), + e); + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + logger.debug("Failed to create vertex for ID '{}' {}", graphVertex.getUniqueId(), graph.right().value()); + return Either.right(graph.right().value()); + } + } + + /** + * @param name + * @param value + * @param label + * @return + */ + public Either getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label) { + return getVertexByPropertyAndLabel(name, value, label, JsonParseFlagEnum.ParseAll); + } + + public Either getVertexByLabel(VertexTypeEnum label) { + return janusGraphClient.getGraph().left().map(graph -> graph.query().has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices()) + .left().bind(janusGraphVertices -> getFirstFoundVertex(JsonParseFlagEnum.NoParse, janusGraphVertices)); + } + + private Either getFirstFoundVertex(JsonParseFlagEnum parseFlag, Iterable vertices) { + Iterator iterator = vertices.iterator(); + if (iterator.hasNext()) { + JanusGraphVertex vertex = iterator.next(); + GraphVertex graphVertex = createAndFill(vertex, parseFlag); + return Either.left(graphVertex); + } + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + + /** + * @param name + * @param value + * @param label + * @param parseFlag + * @return + */ + public Either getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label, + JsonParseFlagEnum parseFlag) { + Either graph = janusGraphClient.getGraph(); + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + @SuppressWarnings("unchecked") Iterable vertecies = tGraph.query().has(name.getProperty(), value) + .has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices(); + java.util.Iterator iterator = vertecies.iterator(); + if (iterator.hasNext()) { + JanusGraphVertex vertex = iterator.next(); + GraphVertex graphVertex = createAndFill(vertex, parseFlag); + return Either.left(graphVertex); + } + if (logger.isDebugEnabled()) { + logger.debug("No vertex in graph for key = {} and value = {} label = {}", name, value, label); + } + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failed to get vertex in graph for key ={} and value = {} label = {}", name, value, label); + } + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("No vertex in graph for key ={} and value = {} label = {} error :{}", name, value, label, graph.right().value()); + } + return Either.right(graph.right().value()); + } + } + + /** + * @param id + * @return + */ + public Either getVertexById(String id) { + return getVertexById(id, JsonParseFlagEnum.ParseAll); + } + + /** + * @param id + * @param parseFlag + * @return + */ + public Either getVertexById(String id, JsonParseFlagEnum parseFlag) { + Either graph = janusGraphClient.getGraph(); + if (id == null) { + if (logger.isDebugEnabled()) { + logger.debug("No vertex in graph for id = {} ", id); + } + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + @SuppressWarnings("unchecked") Iterable vertecies = tGraph.query() + .has(GraphPropertyEnum.UNIQUE_ID.getProperty(), id).vertices(); + java.util.Iterator iterator = vertecies.iterator(); + if (iterator.hasNext()) { + JanusGraphVertex vertex = iterator.next(); + GraphVertex graphVertex = createAndFill(vertex, parseFlag); + return Either.left(graphVertex); + } else { + if (logger.isDebugEnabled()) { + logger.debug("No vertex in graph for id = {}", id); + } + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failed to get vertex in graph for id {} ", id); + } + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("No vertex in graph for id {} error : {}", id, graph.right().value()); + } + return Either.right(graph.right().value()); + } + } + + private void setVertexProperties(JanusGraphVertex vertex, GraphVertex graphVertex) throws IOException { + if (graphVertex.getMetadataProperties() != null) { + for (Map.Entry entry : graphVertex.getMetadataProperties().entrySet()) { + if (entry.getValue() != null) { + vertex.property(entry.getKey().getProperty(), entry.getValue()); + } + } + } + vertex.property(GraphPropertyEnum.LABEL.getProperty(), graphVertex.getLabel().getName()); + Map json = graphVertex.getJson(); + if (json != null) { + String jsonStr = JsonParserUtils.toJson(json); + vertex.property(GraphPropertyEnum.JSON.getProperty(), jsonStr); + } + Map jsonMetadata = graphVertex.getMetadataJson(); + if (jsonMetadata != null) { + String jsonMetadataStr = JsonParserUtils.toJson(jsonMetadata); + vertex.property(GraphPropertyEnum.METADATA.getProperty(), jsonMetadataStr); + } + } + + public void setVertexProperties(Vertex vertex, Map properties) throws IOException { + for (Map.Entry entry : properties.entrySet()) { + if (entry.getValue() != null) { + vertex.property(entry.getKey(), entry.getValue()); + } + } + } + + private GraphVertex createAndFill(JanusGraphVertex vertex, JsonParseFlagEnum parseFlag) { + GraphVertex graphVertex = new GraphVertex(); + graphVertex.setVertex(vertex); + parseVertexProperties(graphVertex, parseFlag); + return graphVertex; + } + + public void parseVertexProperties(GraphVertex graphVertex, JsonParseFlagEnum parseFlag) { + JanusGraphVertex vertex = graphVertex.getVertex(); + Map properties = getVertexProperties(vertex); + VertexTypeEnum label = VertexTypeEnum.getByName((String) (properties.get(GraphPropertyEnum.LABEL))); + for (Map.Entry entry : properties.entrySet()) { + GraphPropertyEnum key = entry.getKey(); + switch (key) { + case UNIQUE_ID: + graphVertex.setUniqueId((String) entry.getValue()); + break; + case LABEL: + graphVertex.setLabel(VertexTypeEnum.getByName((String) entry.getValue())); + break; + case COMPONENT_TYPE: + String type = (String) entry.getValue(); + if (type != null) { + graphVertex.setType(ComponentTypeEnum.valueOf(type)); + } + break; + case JSON: + if (parseFlag == JsonParseFlagEnum.ParseAll || parseFlag == JsonParseFlagEnum.ParseJson) { + String json = (String) entry.getValue(); + Map jsonObj = JsonParserUtils.toMap(json, label.getClassOfJson()); + graphVertex.setJson(jsonObj); + } + break; + case METADATA: + if (parseFlag == JsonParseFlagEnum.ParseAll || parseFlag == JsonParseFlagEnum.ParseMetadata) { + String json = (String) entry.getValue(); + Map metadatObj = JsonParserUtils.toMap(json); + graphVertex.setMetadataJson(metadatObj); + } + break; + default: + graphVertex.addMetadataProperty(key, entry.getValue()); + break; + } + } + } + + public JanusGraphOperationStatus createEdge(GraphVertex from, GraphVertex to, EdgeLabelEnum label, Map properties) { + return createEdge(from.getVertex(), to.getVertex(), label, properties); + } + + public JanusGraphOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Map properties) { + if (logger.isTraceEnabled()) { + logger.trace("Try to connect {} with {} label {} properties {}", + from == null ? "NULL" : from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), + to == null ? "NULL" : to.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), label, properties); + } + if (from == null || to == null) { + logger.trace("No JanusGraph vertex for id from {} or id to {}", + from == null ? "NULL" : from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), + to == null ? "NULL" : to.property(GraphPropertyEnum.UNIQUE_ID.getProperty())); + return JanusGraphOperationStatus.NOT_FOUND; + } + Edge edge = from.addEdge(label.name(), to); + JanusGraphOperationStatus status; + try { + setEdgeProperties(edge, properties); + status = JanusGraphOperationStatus.OK; + } catch (IOException e) { + logger.error(EcompLoggerErrorCode.DATA_ERROR, "JanusGraphDao", "Failed to set properties on edge properties [{}]", properties, e); + status = JanusGraphOperationStatus.GENERAL_ERROR; + } + return status; + } + + public Map getVertexProperties(Element element) { + Map result = new HashMap<>(); + if (element != null && element.keys() != null && element.keys().size() > 0) { + Map propertyMap = ElementHelper.propertyMap(element, element.keys().toArray(new String[element.keys().size()])); + for (Entry entry : propertyMap.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue().value(); + GraphPropertyEnum valueOf = GraphPropertyEnum.getByProperty(key); + if (valueOf != null) { + result.put(valueOf, value); + } + } + // add print to properties that can't be converted by enum + } + return result; + } + + public Map getEdgeProperties(Element element) { + Map result = new HashMap<>(); + if (element != null && element.keys() != null && element.keys().size() > 0) { + Map propertyMap = ElementHelper.propertyMap(element, element.keys().toArray(new String[element.keys().size()])); + for (Entry entry : propertyMap.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue().value(); + EdgePropertyEnum valueOf = EdgePropertyEnum.getByProperty(key); + if (valueOf != null) { + if (valueOf == EdgePropertyEnum.INSTANCES) { + List list = JsonParserUtils.toList((String) value, String.class); + result.put(valueOf, list); + } else { + result.put(valueOf, value); + } + } + } + } + return result; + } + + public void setEdgeProperties(Element element, Map properties) throws IOException { + if (properties != null && !properties.isEmpty()) { + Object[] propertyKeyValues = new Object[properties.size() * 2]; + int i = 0; + for (Entry entry : properties.entrySet()) { + propertyKeyValues[i++] = entry.getKey().getProperty(); + Object value = entry.getValue(); + if (entry.getKey() == EdgePropertyEnum.INSTANCES) { + String jsonStr = JsonParserUtils.toJson(value); + propertyKeyValues[i++] = jsonStr; + } else { + propertyKeyValues[i++] = entry.getValue(); + } + } + ElementHelper.attachProperties(element, propertyKeyValues); + } + } + + public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props) { + return getByCriteria(type, props, JsonParseFlagEnum.ParseAll); + } + + public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props, + JsonParseFlagEnum parseFlag) { + Either graph = janusGraphClient.getGraph(); + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + JanusGraphQuery query = tGraph.query(); + if (type != null) { + query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); + } + if (props != null && !props.isEmpty()) { + for (Map.Entry entry : props.entrySet()) { + query = query.has(entry.getKey().getProperty(), entry.getValue()); + } + } + Iterable vertices = query.vertices(); + if (vertices == null) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + Iterator iterator = vertices.iterator(); + List result = new ArrayList<>(); + while (iterator.hasNext()) { + JanusGraphVertex vertex = iterator.next(); + Map newProp = getVertexProperties(vertex); + GraphVertex graphVertex = createAndFill(vertex, parseFlag); + result.add(graphVertex); + } + if (logger.isDebugEnabled()) { + logger + .debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size()); + } + if (result.size() == 0) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + return Either.left(result); + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e); + } + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("Failed get by criteria for type ={} and properties = {} error : {}", type, props, graph.right().value()); + } + return Either.right(graph.right().value()); + } + } + + public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props, + Map hasNotProps, + JsonParseFlagEnum parseFlag, + String model) { + return getByCriteria(type, props, hasNotProps, null, parseFlag, model); + } + + public Either, JanusGraphOperationStatus> getByCriteria(final VertexTypeEnum type, + final Map hasProps, + final Map hasNotProps, + final Map> predicates, + final JsonParseFlagEnum parseFlag, + final String model) { + Either graph = janusGraphClient.getGraph(); + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + JanusGraphQuery query = tGraph.query(); + + if (type != null) { + query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); + } + if (hasProps != null && !hasProps.isEmpty()) { + for (Map.Entry entry : hasProps.entrySet()) { + query = query.has(entry.getKey().getProperty(), entry.getValue()); + } + } + if (hasNotProps != null && !hasNotProps.isEmpty()) { + for (Map.Entry entry : hasNotProps.entrySet()) { + if (entry.getValue() instanceof List) { + buildMultipleNegateQueryFromList(entry, query); + } else { + query = query.hasNot(entry.getKey().getProperty(), entry.getValue()); + } + } + } + if (predicates != null && !predicates.isEmpty()) { + for (Map.Entry> entry : predicates.entrySet()) { + JanusGraphPredicate predicate = entry.getValue().getKey(); + Object object = entry.getValue().getValue(); + query = query.has(entry.getKey(), predicate, object); + } + } + Iterable vertices = query.vertices(); + if (vertices == null || !vertices.iterator().hasNext()) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + List result = new ArrayList<>(); + + final Predicate filterPredicate = StringUtils.isEmpty(model) ? this::vertexNotConnectedToAnyModel : vertex -> vertexValidForModel(vertex, model); + final List verticesForModel = StreamSupport.stream(vertices.spliterator(), false).filter(filterPredicate).collect(Collectors.toList()); + if (verticesForModel == null || verticesForModel.size() == 0) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + + verticesForModel.forEach(vertex -> result.add(createAndFill(vertex, parseFlag))); + if (logger.isDebugEnabled()) { + logger.debug("Number of fetched nodes in graph for criteria : from type '{}' and properties '{}' is '{}'", type, hasProps, + result.size()); + } + return Either.left(result); + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failed to get by criteria for type '{}' and properties '{}'", type, hasProps, e); + } + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("Failed to get by criteria for type '{}' and properties '{}'. Error : '{}'", type, hasProps, graph.right().value()); + } + return Either.right(graph.right().value()); + } + } + + public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, + Map props, Map hasNotProps, + JsonParseFlagEnum parseFlag) { + return getByCriteria(type, props, hasNotProps, null, parseFlag); + } + + public Either, JanusGraphOperationStatus> getByCriteria(final VertexTypeEnum type, + final Map hasProps, final Map hasNotProps, + final Map> predicates, final JsonParseFlagEnum parseFlag) { + Either graph = janusGraphClient.getGraph(); + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + JanusGraphQuery query = tGraph.query(); + + if (type != null) { + query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); + } + if (hasProps != null && !hasProps.isEmpty()) { + for (Map.Entry entry : hasProps.entrySet()) { + query = query.has(entry.getKey().getProperty(), entry.getValue()); + } + } + if (hasNotProps != null && !hasNotProps.isEmpty()) { + for (Map.Entry entry : hasNotProps.entrySet()) { + if (entry.getValue() instanceof List) { + buildMultipleNegateQueryFromList(entry, query); + } else { + query = query.hasNot(entry.getKey().getProperty(), entry.getValue()); + } + } + } + if (predicates != null && !predicates.isEmpty()) { + for (Map.Entry> entry : predicates.entrySet()) { + JanusGraphPredicate predicate = entry.getValue().getKey(); + Object object = entry.getValue().getValue(); + query = query.has(entry.getKey(), predicate, object); + } + } + Iterable vertices = query.vertices(); + if (vertices == null || !vertices.iterator().hasNext()) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + List result = new ArrayList<>(); + + vertices.forEach(vertex -> result.add(createAndFill(vertex, parseFlag))); + if (logger.isDebugEnabled()) { + logger.debug( + "Number of fetched nodes in graph for criteria : from type '{}' and properties '{}' is '{}'", + type, hasProps, result.size()); + } + return Either.left(result); + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failed to get by criteria for type '{}' and properties '{}'", type, hasProps, e); + } + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("Failed to get by criteria for type '{}' and properties '{}'. Error : '{}'", type, + hasProps, graph.right().value()); + } + return Either.right(graph.right().value()); + } + } + + private boolean vertexValidForModel(final JanusGraphVertex vertex, final String model) { + final String vertexLabel = (String)vertex.property(GraphPropertyEnum.LABEL.getProperty()).value(); + final VertexTypeEnum vertexType = VertexTypeEnum.getByName(vertexLabel); + final GraphEdgeLabels edgeLabel = vertexType.equals(VertexTypeEnum.TOPOLOGY_TEMPLATE) ? GraphEdgeLabels.MODEL : GraphEdgeLabels.MODEL_ELEMENT; + final Either>, JanusGraphOperationStatus> modelVertices = getParentVerticies(vertex, edgeLabel); + + return modelVertices.isLeft() && modelVertices.left().value().stream().anyMatch(vertexPair -> modelVertexMatchesModel(vertexPair.getLeft(), model)); + } + + private boolean modelVertexMatchesModel(final JanusGraphVertex modelVertex, final String model) { + if (model.equals((String)modelVertex.property("name").value())) { + return true; + } + final Either>, JanusGraphOperationStatus> derivedModels = + getParentVerticies(modelVertex, GraphEdgeLabels.DERIVED_FROM); + return derivedModels.isLeft() && derivedModels.left().value().stream().anyMatch(derivedModel ->modelVertexMatchesModel(derivedModel.left, model)); + } + + private Either>, JanusGraphOperationStatus> getParentVerticies( + final JanusGraphVertex rootVertex, final GraphEdgeLabels edgeType) { + return getEdgeVerticies(rootVertex, Direction.IN, edgeType); + } + + private Either>, JanusGraphOperationStatus> getEdgeVerticies( + final JanusGraphVertex rootVertex, final Direction direction, final GraphEdgeLabels edgeType) { + final List> immutablePairs = new ArrayList<>(); + final Iterator edgesCreatorIterator = rootVertex.edges(direction, edgeType.getProperty()); + if (edgesCreatorIterator != null) { + while (edgesCreatorIterator.hasNext()) { + Edge edge = edgesCreatorIterator.next(); + JanusGraphVertex vertex = Direction.OUT.equals(direction)? (JanusGraphVertex) edge.inVertex() : (JanusGraphVertex) edge.outVertex(); + ImmutablePair immutablePair = new ImmutablePair<>(vertex, edge); + immutablePairs.add(immutablePair); + } + } + if (immutablePairs.isEmpty()) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + return Either.left(immutablePairs); + } + + private boolean vertexNotConnectedToAnyModel(final JanusGraphVertex vertex) { + String vt = (String)vertex.property(GraphPropertyEnum.LABEL.getProperty()).value(); + VertexTypeEnum vertexType = VertexTypeEnum.getByName(vt); + EdgeLabelEnum edgeLabel = vertexType.equals(VertexTypeEnum.TOPOLOGY_TEMPLATE) ? EdgeLabelEnum.MODEL : EdgeLabelEnum.MODEL_ELEMENT; + return !vertex.edges(Direction.IN, edgeLabel.name()).hasNext(); + } + + public Either, JanusGraphOperationStatus> getCatalogOrArchiveVerticies(boolean isCatalog) { + Either graph = janusGraphClient.getGraph(); + if (graph.isLeft()) { + try { + JanusGraph tGraph = graph.left().value(); + String name = isCatalog ? VertexTypeEnum.CATALOG_ROOT.getName() : VertexTypeEnum.ARCHIVE_ROOT.getName(); + Iterable vCatalogIter = tGraph.query().has(GraphPropertyEnum.LABEL.getProperty(), name).vertices(); + if (vCatalogIter == null) { + logger.debug("Failed to fetch catalog vertex"); + return Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + } + JanusGraphVertex catalogV = vCatalogIter.iterator().next(); + if (catalogV == null) { + logger.debug("Failed to fetch catalog vertex"); + return Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + } + String edgeLabel = isCatalog ? EdgeLabelEnum.CATALOG_ELEMENT.name() : EdgeLabelEnum.ARCHIVE_ELEMENT.name(); + Iterator vertices = catalogV.vertices(Direction.OUT, edgeLabel); + return Either.left(vertices); + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Failed get by criteria: ", e); + } + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + } else { + if (logger.isDebugEnabled()) { + logger.debug("Failed get by criteria : ", graph.right().value()); + } + return Either.right(graph.right().value()); + } + } + + private void buildMultipleNegateQueryFromList(Map.Entry entry, JanusGraphQuery query) { + List negateList = (List) entry.getValue(); + for (Object listItem : negateList) { + query.hasNot(entry.getKey().getProperty(), listItem); + } + } + + /** + * @param parentVertex + * @param edgeLabel + * @param parseFlag + * @return + */ + public Either getChildVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + Either, JanusGraphOperationStatus> childrenVertecies = getChildrenVertices(parentVertex, edgeLabel, parseFlag); + if (childrenVertecies.isRight()) { + return Either.right(childrenVertecies.right().value()); + } + return Either.left(childrenVertecies.left().value().get(0)); + } + + /** + * @param parentVertex + * @param edgeLabel + * @param parseFlag + * @return + */ + public Either getChildVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) { + Either, JanusGraphOperationStatus> childrenVertecies = getChildrenVertices(parentVertex, edgeLabel, parseFlag); + if (childrenVertecies.isRight()) { + return Either.right(childrenVertecies.right().value()); + } + return Either.left(childrenVertecies.left().value().get(0)); + } + + public Either getParentVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + Either, JanusGraphOperationStatus> childrenVertecies = getParentVertices(parentVertex, edgeLabel, parseFlag); + if (childrenVertecies.isRight()) { + return Either.right(childrenVertecies.right().value()); + } + if (isEmpty(childrenVertecies.left().value())) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + return Either.left(childrenVertecies.left().value().get(0)); + } + + public Either getParentVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) { + Either, JanusGraphOperationStatus> childrenVertecies = getParentVertices(parentVertex, edgeLabel, parseFlag); + if (childrenVertecies.isRight()) { + return Either.right(childrenVertecies.right().value()); + } + if (isEmpty(childrenVertecies.left().value())) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + return Either.left(childrenVertecies.left().value().get(0)); + } + + /** + * @param parentVertex + * @param edgeLabel + * @param parseFlag + * @return + */ + public Either, JanusGraphOperationStatus> getChildrenVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.OUT); + } + + public Either, JanusGraphOperationStatus> getParentVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.IN); + } + + public Either, JanusGraphOperationStatus> getParentVertices(Vertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.IN); + } + + private Either, JanusGraphOperationStatus> getAdjacentVertices(Vertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag, Direction direction) { + List list = new ArrayList<>(); + try { + Either graphRes = janusGraphClient.getGraph(); + if (graphRes.isRight()) { + logger.error("Failed to retrieve graph. status is {}", graphRes); + return Either.right(graphRes.right().value()); + } + Iterator edgesCreatorIterator = parentVertex.edges(direction, edgeLabel.name()); + if (edgesCreatorIterator != null) { + while (edgesCreatorIterator.hasNext()) { + Edge edge = edgesCreatorIterator.next(); + JanusGraphVertex vertex; + if (direction == Direction.IN) { + vertex = (JanusGraphVertex) edge.outVertex(); + } else { + vertex = (JanusGraphVertex) edge.inVertex(); + } + // GraphVertex graphVertex = createAndFill(vertex, parseFlag); + list.add(vertex); + } + } + if (list.isEmpty()) { + return Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + } catch (Exception e) { + logger.error("Failed to perform graph operation ", e); + Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + return Either.left(list); + } + + /** + * @param parentVertex + * @param edgeLabel + * @param parseFlag + * @return + */ + public Either, JanusGraphOperationStatus> getChildrenVertices(Vertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag) { + return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.OUT); + } + + private Either, JanusGraphOperationStatus> getAdjacentVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, + JsonParseFlagEnum parseFlag, Direction direction) { + List list = new ArrayList<>(); + Either, JanusGraphOperationStatus> adjacentVerticies = getAdjacentVertices(parentVertex.getVertex(), edgeLabel, parseFlag, + direction); + if (adjacentVerticies.isRight()) { + return Either.right(adjacentVerticies.right().value()); + } + adjacentVerticies.left().value().stream().forEach(vertex -> { + list.add(createAndFill((JanusGraphVertex) vertex, parseFlag)); + }); + return Either.left(list); + } + + /** + * Searches Edge by received label and criteria + * + * @param vertex + * @param label + * @param properties + * @return found edge or JanusGraphOperationStatus + */ + public Either getBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, + Map properties) { + Either result = null; + Edge matchingEdge = null; + String notFoundMsg = "No edges in graph for criteria"; + try { + JanusGraphVertexQuery query = vertex.getVertex().query().labels(label.name()); + if (properties != null && !properties.isEmpty()) { + for (Map.Entry entry : properties.entrySet()) { + query = query.has(entry.getKey().getProperty(), entry.getValue()); + } + } + Iterable edges = query.edges(); + if (edges == null) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg); + result = Either.right(JanusGraphOperationStatus.NOT_FOUND); + } else { + Iterator eIter = edges.iterator(); + if (eIter.hasNext()) { + matchingEdge = eIter.next(); + } else { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg); + result = Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + } + if (result == null) { + result = Either.left(matchingEdge); + } + } catch (Exception e) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", + vertex.getUniqueId(), e); + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + return result; + } + + public Either getEdgeByChildrenVertexProperties(GraphVertex vertex, EdgeLabelEnum label, + Map properties) { + Either result = null; + Edge matchingEdge = null; + String notFoundMsg = "No edges in graph for criteria"; + try { + Iterator edges = vertex.getVertex().edges(Direction.OUT, label.name()); + while (edges.hasNext()) { + matchingEdge = edges.next(); + Vertex childV = matchingEdge.inVertex(); + Map vertexProperties = getVertexProperties(childV); + Optional> findNotMatch = properties.entrySet().stream() + .filter(e -> vertexProperties.get(e.getKey()) == null || !vertexProperties.get(e.getKey()).equals(e.getValue())).findFirst(); + if (!findNotMatch.isPresent()) { + result = Either.left(matchingEdge); + } + } + if (result == null) { + //no match + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg); + result = Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + } catch (Exception e) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", + vertex.getUniqueId(), e); + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + return result; + } + + /** + * Deletes Edge by received label and criteria + * + * @param vertex + * @param label + * @param properties + * @return + */ + public Either deleteBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, + Map properties) { + Either result = null; + try { + result = getBelongingEdgeByCriteria(vertex, label, properties); + if (result.isLeft()) { + Edge edge = result.left().value(); + CommonUtility + .addRecordToLog(logger, LogLevelEnum.TRACE, "Going to delete an edge with the label {} belonging to the vertex {} ", label.name(), + vertex.getUniqueId()); + edge.remove(); + result = Either.left(edge); + } else { + CommonUtility + .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to find an edge with the label {} belonging to the vertex {} ", label.name(), + vertex.getUniqueId()); + } + } catch (Exception e) { + CommonUtility + .addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge by criteria for the component with id {}. {}", + vertex == null ? "NULL" : vertex.getUniqueId(), e); + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + return result; + } + + @SuppressWarnings("unchecked") + /** + * Deletes an edge between vertices fromVertex and toVertex according to received label + * + * @param fromVertex + * @param toVertex + * @param label + * @return + */ + public Either deleteEdge(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) { + return deleteEdge(fromVertex.getVertex(), toVertex.getVertex(), label, fromVertex.getUniqueId(), toVertex.getUniqueId(), false); + } + + public Either deleteAllEdges(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) { + return deleteEdge(fromVertex.getVertex(), toVertex.getVertex(), label, fromVertex.getUniqueId(), toVertex.getUniqueId(), true); + } + + public Either deleteEdge(JanusGraphVertex fromVertex, JanusGraphVertex toVertex, EdgeLabelEnum label, + String uniqueIdFrom, String uniqueIdTo, boolean deleteAll) { + Either result = null; + Vertex problemV = null; + try { + Iterable edges = fromVertex.query().labels(label.name()).edges(); + Iterator eIter = edges.iterator(); + while (eIter.hasNext()) { + Edge edge = eIter.next(); + problemV = edge.inVertex(); + String currVertexUniqueId = null; + try { + currVertexUniqueId = edge.inVertex().value(GraphPropertyEnum.UNIQUE_ID.getProperty()); + } catch (Exception e) { + // AutoHealing procedure + logger.info("Corrupted vertex and edge were found and deleted {}", e); + if (problemV != null) { + Map props = getVertexProperties(problemV); + logger.debug("problematic Vertex properties:"); + logger.debug("props size: {}", props.size()); + for (Map.Entry entry : props.entrySet()) { + logger.debug("{}{}", entry.getKey() + ":" + entry.getValue()); + } + Either, JanusGraphOperationStatus> childrenVertices = getChildrenVertices(problemV, EdgeLabelEnum.VERSION, + JsonParseFlagEnum.NoParse); + if (childrenVertices.isLeft()) { + childrenVertices.left().value().size(); + logger.debug("number of children that problematic Vertex has: {}", props.size()); + } + try { + edge.remove(); + } catch (Exception e1) { + logger.debug("failed to remove problematic edge. {}", e1); + } + try { + problemV.remove(); + } catch (Exception e2) { + logger.debug("failed to remove problematic vertex . {}", e2); + } + } + continue; + } + if (currVertexUniqueId != null && currVertexUniqueId.equals(uniqueIdTo)) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to delete an edge with the label {} between vertices {} and {}. ", + label.name(), uniqueIdFrom, uniqueIdTo); + edge.remove(); + result = Either.left(edge); + if (!deleteAll) { + break; + } + } + } + if (result == null) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to delete an edge with the label {} between vertices {} and {}. ", + label.name(), uniqueIdFrom, uniqueIdTo); + result = Either.right(JanusGraphOperationStatus.NOT_FOUND); + } + } catch (Exception e) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, + "Exception occured during deleting an edge with the label {} between vertices {} and {}. {}", label.name(), uniqueIdFrom, uniqueIdTo, + e); + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + return result; + } + + public JanusGraphOperationStatus deleteEdgeByDirection(GraphVertex fromVertex, Direction direction, EdgeLabelEnum label) { + try { + Iterator edges = fromVertex.getVertex().edges(direction, label.name()); + while (edges.hasNext()) { + Edge edge = edges.next(); + edge.remove(); + } + } catch (Exception e) { + logger.debug("Failed to remove from vertex {} edges {} by direction {} ", fromVertex.getUniqueId(), label, direction, e); + return JanusGraphClient.handleJanusGraphException(e); + } + return JanusGraphOperationStatus.OK; + } + + /** + * Updates vertex properties. Note that graphVertex argument should contain updated data + * + * @param graphVertex + * @return + */ + public Either updateVertex(GraphVertex graphVertex) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId()); + try { + graphVertex.updateMetadataJsonWithCurrentMetadataProperties(); + setVertexProperties(graphVertex.getVertex(), graphVertex); + } catch (Exception e) { + CommonUtility + .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId(), e); + return Either.right(JanusGraphClient.handleJanusGraphException(e)); + } + return Either.left(graphVertex); + } + + /** + * Fetches vertices by uniqueId according to received parse flag + * + * @param verticesToGet + * @return + */ + public Either, JanusGraphOperationStatus> getVerticesByUniqueIdAndParseFlag( + Map> verticesToGet) { + Either, JanusGraphOperationStatus> result = null; + Map vertices = new HashMap<>(); + JanusGraphOperationStatus titatStatus; + Either getVertexRes = null; + for (Map.Entry> entry : verticesToGet.entrySet()) { + if (entry.getValue().getKey() == GraphPropertyEnum.UNIQUE_ID) { + getVertexRes = getVertexById(entry.getKey(), entry.getValue().getValue()); + } else if (entry.getValue().getKey() == GraphPropertyEnum.USERID) { + getVertexRes = getVertexByPropertyAndLabel(entry.getValue().getKey(), entry.getKey(), VertexTypeEnum.USER, + entry.getValue().getValue()); + } + if (getVertexRes == null) { + titatStatus = JanusGraphOperationStatus.ILLEGAL_ARGUMENT; + CommonUtility + .addRecordToLog(logger, LogLevelEnum.DEBUG, "Invalid vertex type label {} has been received. ", entry.getValue().getKey(), + titatStatus); + return Either.right(titatStatus); + } + if (getVertexRes.isRight()) { + titatStatus = getVertexRes.right().value(); + CommonUtility + .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to get vertex by id {} . Status is {}. ", entry.getKey(), titatStatus); + result = Either.right(titatStatus); + break; + } else { + vertices.put(entry.getKey(), getVertexRes.left().value()); + } + } + if (result == null) { + result = Either.left(vertices); + } + return result; + } + + /** + * Creates edge between "from" and "to" vertices with specified label and properties extracted from received edge + * + * @param from + * @param to + * @param label + * @param edgeToCopy + * @return + */ + public JanusGraphOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Edge edgeToCopy) { + return createEdge(from, to, label, getEdgeProperties(edgeToCopy)); + } + + public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, Edge prevEdge, EdgeLabelEnum prevLabel, + EdgeLabelEnum newLabel) { + CommonUtility + .addRecordToLog(logger, LogLevelEnum.TRACE, "Going to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel, + fromVertex != null ? fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : "NULL", + toVertex != null ? toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : "NULL"); + JanusGraphOperationStatus result = createEdge(fromVertex, toVertex, newLabel, prevEdge); + if (result == JanusGraphOperationStatus.OK) { + prevEdge.remove(); + } + return result; + } + + /** + * Replaces previous label of edge with new label + * + * @param fromVertex + * @param toVertex + * @param prevLabel + * @param newLabel + * @return + */ + public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) { + Iterator prevEdgeIter = toVertex.edges(Direction.IN, prevLabel.name()); + if (prevEdgeIter == null || !prevEdgeIter.hasNext()) { + CommonUtility + .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to replace edge with label {} to {} between vertices {} and {}", prevLabel, + newLabel, fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), + toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty())); + return JanusGraphOperationStatus.NOT_FOUND; + } else { + return replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel); + } + } + + /** + * Updates metadata properties of vertex on graph. Json metadata property of the vertex will be updated with received properties too. + * + * @param vertex + * @param properties + * @return + */ + public JanusGraphOperationStatus updateVertexMetadataPropertiesWithJson(Vertex vertex, Map properties) { + try { + if (!MapUtils.isEmpty(properties)) { + String jsonMetadataStr = (String) vertex.property(GraphPropertyEnum.METADATA.getProperty()).value(); + Map jsonMetadataMap = JsonParserUtils.toMap(jsonMetadataStr); + for (Map.Entry property : properties.entrySet()) { + vertex.property(property.getKey().getProperty(), property.getValue()); + jsonMetadataMap.put(property.getKey().getProperty(), property.getValue()); + } + vertex.property(GraphPropertyEnum.METADATA.getProperty(), JsonParserUtils.toJson(jsonMetadataMap)); + } + } catch (Exception e) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occurred during update vertex metadata properties with json{}. {}", + vertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), e.getMessage()); + return JanusGraphClient.handleJanusGraphException(e); + } + return JanusGraphOperationStatus.OK; + } + + public JanusGraphOperationStatus disassociateAndDeleteLast(GraphVertex vertex, Direction direction, EdgeLabelEnum label) { + try { + Iterator edges = vertex.getVertex().edges(direction, label.name()); + while (edges.hasNext()) { + Edge edge = edges.next(); + Vertex secondVertex; + Direction reverseDirection; + if (direction == Direction.IN) { + secondVertex = edge.outVertex(); + reverseDirection = Direction.OUT; + } else { + secondVertex = edge.inVertex(); + reverseDirection = Direction.IN; + } + edge.remove(); + CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Edge {} with direction {} was removed from {}", label.name(), direction, + vertex.getVertex()); + Iterator restOfEdges = secondVertex.edges(reverseDirection, label.name()); + if (!restOfEdges.hasNext()) { + secondVertex.remove(); + CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "This was last edge . Vertex {} was removed ", vertex.getUniqueId()); + } + } + } catch (Exception e) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, + "Exception occured during deleting an edge with the label {} direction {} from vertex {}. {}", label.name(), direction, + vertex.getUniqueId(), e); + return JanusGraphClient.handleJanusGraphException(e); + } + return JanusGraphOperationStatus.OK; + } + + public Object getProperty(JanusGraphVertex vertex, String key) { + PropertyKey propertyKey = janusGraphClient.getGraph().left().value().getPropertyKey(key); + return vertex.valueOrNull(propertyKey); + } + + public Object getProperty(Edge edge, EdgePropertyEnum key) { + Object value = null; + try { + Property property = edge.property(key.getProperty()); + if (property != null) { + value = property.orElse(null); + if (value != null && key == EdgePropertyEnum.INSTANCES) { + return JsonParserUtils.toList((String) value, String.class); + } + return value; + } + } catch (Exception e) { + } + return value; + } + + /** + * @param vertexA + * @param vertexB + * @param label + * @param direction + * @return + */ + public JanusGraphOperationStatus moveEdge(GraphVertex vertexA, GraphVertex vertexB, EdgeLabelEnum label, Direction direction) { + JanusGraphOperationStatus result = deleteEdgeByDirection(vertexA, direction, label); + if (result != JanusGraphOperationStatus.OK) { + logger.error("Failed to diassociate {} from element {}. error {} ", label, vertexA.getUniqueId(), result); + return result; + } + JanusGraphOperationStatus createRelation; + if (direction == Direction.IN) { + createRelation = createEdge(vertexB, vertexA, label, null); + } else { + createRelation = createEdge(vertexA, vertexB, label, null); + } + if (createRelation != JanusGraphOperationStatus.OK) { + return createRelation; + } + return JanusGraphOperationStatus.OK; + } + + public Either getBelongingEdgeByCriteria(String parentId, EdgeLabelEnum label, + Map properties) { + Either getVertexRes = getVertexById(parentId, JsonParseFlagEnum.NoParse); + if (getVertexRes.isRight()) { + return Either.right(getVertexRes.right().value()); + } + return getBelongingEdgeByCriteria(getVertexRes.left().value(), label, properties); + } +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java deleted file mode 100644 index 38a86985e4..0000000000 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright © 2016-2018 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openecomp.sdc.be.dao.jsongraph; - -import fj.data.Either; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component("janusgraph-dao") -public class HealingJanusGraphDao extends JanusGraphDao { - - private HealingPipelineDao healingPipelineDao; - - @Autowired - public HealingJanusGraphDao(HealingPipelineDao healingPipelineDao, JanusGraphClient janusGraphClient) { - super(janusGraphClient); - this.healingPipelineDao = healingPipelineDao; - } - - @Override - public Either, JanusGraphOperationStatus> getChildrenVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - Either, JanusGraphOperationStatus> childrenVertecies = super.getChildrenVertices(parentVertex, edgeLabel, parseFlag); - return Either.iif(childrenVertecies.isRight(), () -> childrenVertecies.right().value(), - () -> childrenVertecies.left().value().stream().map(graphVertex -> transformVertex(graphVertex, edgeLabel)).collect(Collectors.toList())); - } - - private GraphVertex transformVertex(GraphVertex graphVertex, EdgeLabelEnum edgeLabelEnum) { - Optional optional = healingPipelineDao.performGraphReadHealing(graphVertex, edgeLabelEnum); - return optional.orElse(graphVertex); - } - - public void setHealingPipelineDao(HealingPipelineDao healingPipelineDao) { - this.healingPipelineDao = healingPipelineDao; - } -} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java deleted file mode 100644 index 8614f4beb4..0000000000 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java +++ /dev/null @@ -1,1234 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.sdc.be.dao.jsongraph; - -import static org.apache.commons.collections.CollectionUtils.isEmpty; - -import fj.data.Either; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; -import java.util.Optional; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.janusgraph.core.JanusGraph; -import org.janusgraph.core.JanusGraphEdge; -import org.janusgraph.core.JanusGraphQuery; -import org.janusgraph.core.JanusGraphVertex; -import org.janusgraph.core.JanusGraphVertexQuery; -import org.janusgraph.core.PropertyKey; -import org.janusgraph.graphdb.query.JanusGraphPredicate; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils; -import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.common.jsongraph.util.CommonUtility; -import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; -import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; -import org.openecomp.sdc.common.log.wrappers.Logger; -import org.springframework.beans.factory.annotation.Qualifier; - -public class JanusGraphDao { - - private static Logger logger = Logger.getLogger(JanusGraphDao.class.getName()); - JanusGraphClient janusGraphClient; - - public JanusGraphDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient) { - this.janusGraphClient = janusGraphClient; - logger.info("** JanusGraphDao created"); - } - - public JanusGraphOperationStatus commit() { - logger.debug("#commit - The operation succeeded. Doing commit..."); - return janusGraphClient.commit(); - } - - public JanusGraphOperationStatus rollback() { - logger.debug("#rollback - The operation failed. Doing rollback..."); - return janusGraphClient.rollback(); - } - - public Either getGraph() { - return janusGraphClient.getGraph(); - } - - /** - * @param graphVertex - * @return - */ - public Either createVertex(GraphVertex graphVertex) { - logger.trace("try to create vertex for ID [{}]", graphVertex.getUniqueId()); - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - JanusGraphVertex vertex = tGraph.addVertex(); - setVertexProperties(vertex, graphVertex); - graphVertex.setVertex(vertex); - return Either.left(graphVertex); - } catch (Exception e) { - logger - .error(EcompLoggerErrorCode.DATA_ERROR, "JanusGraphDao", "Failed to create Node for ID '{}'", (Object) graphVertex.getUniqueId(), - e); - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - logger.debug("Failed to create vertex for ID '{}' {}", graphVertex.getUniqueId(), graph.right().value()); - return Either.right(graph.right().value()); - } - } - - /** - * @param name - * @param value - * @param label - * @return - */ - public Either getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label) { - return getVertexByPropertyAndLabel(name, value, label, JsonParseFlagEnum.ParseAll); - } - - public Either getVertexByLabel(VertexTypeEnum label) { - return janusGraphClient.getGraph().left().map(graph -> graph.query().has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices()) - .left().bind(janusGraphVertices -> getFirstFoundVertex(JsonParseFlagEnum.NoParse, janusGraphVertices)); - } - - private Either getFirstFoundVertex(JsonParseFlagEnum parseFlag, Iterable vertices) { - Iterator iterator = vertices.iterator(); - if (iterator.hasNext()) { - JanusGraphVertex vertex = iterator.next(); - GraphVertex graphVertex = createAndFill(vertex, parseFlag); - return Either.left(graphVertex); - } - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - - /** - * @param name - * @param value - * @param label - * @param parseFlag - * @return - */ - public Either getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label, - JsonParseFlagEnum parseFlag) { - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - @SuppressWarnings("unchecked") Iterable vertecies = tGraph.query().has(name.getProperty(), value) - .has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices(); - java.util.Iterator iterator = vertecies.iterator(); - if (iterator.hasNext()) { - JanusGraphVertex vertex = iterator.next(); - GraphVertex graphVertex = createAndFill(vertex, parseFlag); - return Either.left(graphVertex); - } - if (logger.isDebugEnabled()) { - logger.debug("No vertex in graph for key = {} and value = {} label = {}", name, value, label); - } - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed to get vertex in graph for key ={} and value = {} label = {}", name, value, label); - } - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("No vertex in graph for key ={} and value = {} label = {} error :{}", name, value, label, graph.right().value()); - } - return Either.right(graph.right().value()); - } - } - - /** - * @param id - * @return - */ - public Either getVertexById(String id) { - return getVertexById(id, JsonParseFlagEnum.ParseAll); - } - - /** - * @param id - * @param parseFlag - * @return - */ - public Either getVertexById(String id, JsonParseFlagEnum parseFlag) { - Either graph = janusGraphClient.getGraph(); - if (id == null) { - if (logger.isDebugEnabled()) { - logger.debug("No vertex in graph for id = {} ", id); - } - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - @SuppressWarnings("unchecked") Iterable vertecies = tGraph.query() - .has(GraphPropertyEnum.UNIQUE_ID.getProperty(), id).vertices(); - java.util.Iterator iterator = vertecies.iterator(); - if (iterator.hasNext()) { - JanusGraphVertex vertex = iterator.next(); - GraphVertex graphVertex = createAndFill(vertex, parseFlag); - return Either.left(graphVertex); - } else { - if (logger.isDebugEnabled()) { - logger.debug("No vertex in graph for id = {}", id); - } - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed to get vertex in graph for id {} ", id); - } - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("No vertex in graph for id {} error : {}", id, graph.right().value()); - } - return Either.right(graph.right().value()); - } - } - - private void setVertexProperties(JanusGraphVertex vertex, GraphVertex graphVertex) throws IOException { - if (graphVertex.getMetadataProperties() != null) { - for (Map.Entry entry : graphVertex.getMetadataProperties().entrySet()) { - if (entry.getValue() != null) { - vertex.property(entry.getKey().getProperty(), entry.getValue()); - } - } - } - vertex.property(GraphPropertyEnum.LABEL.getProperty(), graphVertex.getLabel().getName()); - Map json = graphVertex.getJson(); - if (json != null) { - String jsonStr = JsonParserUtils.toJson(json); - vertex.property(GraphPropertyEnum.JSON.getProperty(), jsonStr); - } - Map jsonMetadata = graphVertex.getMetadataJson(); - if (jsonMetadata != null) { - String jsonMetadataStr = JsonParserUtils.toJson(jsonMetadata); - vertex.property(GraphPropertyEnum.METADATA.getProperty(), jsonMetadataStr); - } - } - - public void setVertexProperties(Vertex vertex, Map properties) throws IOException { - for (Map.Entry entry : properties.entrySet()) { - if (entry.getValue() != null) { - vertex.property(entry.getKey(), entry.getValue()); - } - } - } - - private GraphVertex createAndFill(JanusGraphVertex vertex, JsonParseFlagEnum parseFlag) { - GraphVertex graphVertex = new GraphVertex(); - graphVertex.setVertex(vertex); - parseVertexProperties(graphVertex, parseFlag); - return graphVertex; - } - - public void parseVertexProperties(GraphVertex graphVertex, JsonParseFlagEnum parseFlag) { - JanusGraphVertex vertex = graphVertex.getVertex(); - Map properties = getVertexProperties(vertex); - VertexTypeEnum label = VertexTypeEnum.getByName((String) (properties.get(GraphPropertyEnum.LABEL))); - for (Map.Entry entry : properties.entrySet()) { - GraphPropertyEnum key = entry.getKey(); - switch (key) { - case UNIQUE_ID: - graphVertex.setUniqueId((String) entry.getValue()); - break; - case LABEL: - graphVertex.setLabel(VertexTypeEnum.getByName((String) entry.getValue())); - break; - case COMPONENT_TYPE: - String type = (String) entry.getValue(); - if (type != null) { - graphVertex.setType(ComponentTypeEnum.valueOf(type)); - } - break; - case JSON: - if (parseFlag == JsonParseFlagEnum.ParseAll || parseFlag == JsonParseFlagEnum.ParseJson) { - String json = (String) entry.getValue(); - Map jsonObj = JsonParserUtils.toMap(json, label.getClassOfJson()); - graphVertex.setJson(jsonObj); - } - break; - case METADATA: - if (parseFlag == JsonParseFlagEnum.ParseAll || parseFlag == JsonParseFlagEnum.ParseMetadata) { - String json = (String) entry.getValue(); - Map metadatObj = JsonParserUtils.toMap(json); - graphVertex.setMetadataJson(metadatObj); - } - break; - default: - graphVertex.addMetadataProperty(key, entry.getValue()); - break; - } - } - } - - public JanusGraphOperationStatus createEdge(GraphVertex from, GraphVertex to, EdgeLabelEnum label, Map properties) { - return createEdge(from.getVertex(), to.getVertex(), label, properties); - } - - public JanusGraphOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Map properties) { - if (logger.isTraceEnabled()) { - logger.trace("Try to connect {} with {} label {} properties {}", - from == null ? "NULL" : from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), - to == null ? "NULL" : to.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), label, properties); - } - if (from == null || to == null) { - logger.trace("No JanusGraph vertex for id from {} or id to {}", - from == null ? "NULL" : from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), - to == null ? "NULL" : to.property(GraphPropertyEnum.UNIQUE_ID.getProperty())); - return JanusGraphOperationStatus.NOT_FOUND; - } - Edge edge = from.addEdge(label.name(), to); - JanusGraphOperationStatus status; - try { - setEdgeProperties(edge, properties); - status = JanusGraphOperationStatus.OK; - } catch (IOException e) { - logger.error(EcompLoggerErrorCode.DATA_ERROR, "JanusGraphDao", "Failed to set properties on edge properties [{}]", properties, e); - status = JanusGraphOperationStatus.GENERAL_ERROR; - } - return status; - } - - public Map getVertexProperties(Element element) { - Map result = new HashMap<>(); - if (element != null && element.keys() != null && element.keys().size() > 0) { - Map propertyMap = ElementHelper.propertyMap(element, element.keys().toArray(new String[element.keys().size()])); - for (Entry entry : propertyMap.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue().value(); - GraphPropertyEnum valueOf = GraphPropertyEnum.getByProperty(key); - if (valueOf != null) { - result.put(valueOf, value); - } - } - // add print to properties that can't be converted by enum - } - return result; - } - - public Map getEdgeProperties(Element element) { - Map result = new HashMap<>(); - if (element != null && element.keys() != null && element.keys().size() > 0) { - Map propertyMap = ElementHelper.propertyMap(element, element.keys().toArray(new String[element.keys().size()])); - for (Entry entry : propertyMap.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue().value(); - EdgePropertyEnum valueOf = EdgePropertyEnum.getByProperty(key); - if (valueOf != null) { - if (valueOf == EdgePropertyEnum.INSTANCES) { - List list = JsonParserUtils.toList((String) value, String.class); - result.put(valueOf, list); - } else { - result.put(valueOf, value); - } - } - } - } - return result; - } - - public void setEdgeProperties(Element element, Map properties) throws IOException { - if (properties != null && !properties.isEmpty()) { - Object[] propertyKeyValues = new Object[properties.size() * 2]; - int i = 0; - for (Entry entry : properties.entrySet()) { - propertyKeyValues[i++] = entry.getKey().getProperty(); - Object value = entry.getValue(); - if (entry.getKey() == EdgePropertyEnum.INSTANCES) { - String jsonStr = JsonParserUtils.toJson(value); - propertyKeyValues[i++] = jsonStr; - } else { - propertyKeyValues[i++] = entry.getValue(); - } - } - ElementHelper.attachProperties(element, propertyKeyValues); - } - } - - public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props) { - return getByCriteria(type, props, JsonParseFlagEnum.ParseAll); - } - - public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props, - JsonParseFlagEnum parseFlag) { - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - JanusGraphQuery query = tGraph.query(); - if (type != null) { - query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); - } - if (props != null && !props.isEmpty()) { - for (Map.Entry entry : props.entrySet()) { - query = query.has(entry.getKey().getProperty(), entry.getValue()); - } - } - Iterable vertices = query.vertices(); - if (vertices == null) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - Iterator iterator = vertices.iterator(); - List result = new ArrayList<>(); - while (iterator.hasNext()) { - JanusGraphVertex vertex = iterator.next(); - Map newProp = getVertexProperties(vertex); - GraphVertex graphVertex = createAndFill(vertex, parseFlag); - result.add(graphVertex); - } - if (logger.isDebugEnabled()) { - logger - .debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size()); - } - if (result.size() == 0) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - return Either.left(result); - } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e); - } - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("Failed get by criteria for type ={} and properties = {} error : {}", type, props, graph.right().value()); - } - return Either.right(graph.right().value()); - } - } - - public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props, - Map hasNotProps, - JsonParseFlagEnum parseFlag, - String model) { - return getByCriteria(type, props, hasNotProps, null, parseFlag, model); - } - - public Either, JanusGraphOperationStatus> getByCriteria(final VertexTypeEnum type, - final Map hasProps, - final Map hasNotProps, - final Map> predicates, - final JsonParseFlagEnum parseFlag, - final String model) { - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - JanusGraphQuery query = tGraph.query(); - - if (type != null) { - query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); - } - if (hasProps != null && !hasProps.isEmpty()) { - for (Map.Entry entry : hasProps.entrySet()) { - query = query.has(entry.getKey().getProperty(), entry.getValue()); - } - } - if (hasNotProps != null && !hasNotProps.isEmpty()) { - for (Map.Entry entry : hasNotProps.entrySet()) { - if (entry.getValue() instanceof List) { - buildMultipleNegateQueryFromList(entry, query); - } else { - query = query.hasNot(entry.getKey().getProperty(), entry.getValue()); - } - } - } - if (predicates != null && !predicates.isEmpty()) { - for (Map.Entry> entry : predicates.entrySet()) { - JanusGraphPredicate predicate = entry.getValue().getKey(); - Object object = entry.getValue().getValue(); - query = query.has(entry.getKey(), predicate, object); - } - } - Iterable vertices = query.vertices(); - if (vertices == null || !vertices.iterator().hasNext()) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - List result = new ArrayList<>(); - - final Predicate filterPredicate = StringUtils.isEmpty(model) ? this::vertexNotConnectedToAnyModel : vertex -> vertexValidForModel(vertex, model); - final List verticesForModel = StreamSupport.stream(vertices.spliterator(), false).filter(filterPredicate).collect(Collectors.toList()); - if (verticesForModel == null || verticesForModel.size() == 0) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - - verticesForModel.forEach(vertex -> result.add(createAndFill(vertex, parseFlag))); - if (logger.isDebugEnabled()) { - logger.debug("Number of fetched nodes in graph for criteria : from type '{}' and properties '{}' is '{}'", type, hasProps, - result.size()); - } - return Either.left(result); - } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed to get by criteria for type '{}' and properties '{}'", type, hasProps, e); - } - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("Failed to get by criteria for type '{}' and properties '{}'. Error : '{}'", type, hasProps, graph.right().value()); - } - return Either.right(graph.right().value()); - } - } - - public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, - Map props, Map hasNotProps, - JsonParseFlagEnum parseFlag) { - return getByCriteria(type, props, hasNotProps, null, parseFlag); - } - - public Either, JanusGraphOperationStatus> getByCriteria(final VertexTypeEnum type, - final Map hasProps, final Map hasNotProps, - final Map> predicates, final JsonParseFlagEnum parseFlag) { - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - JanusGraphQuery query = tGraph.query(); - - if (type != null) { - query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); - } - if (hasProps != null && !hasProps.isEmpty()) { - for (Map.Entry entry : hasProps.entrySet()) { - query = query.has(entry.getKey().getProperty(), entry.getValue()); - } - } - if (hasNotProps != null && !hasNotProps.isEmpty()) { - for (Map.Entry entry : hasNotProps.entrySet()) { - if (entry.getValue() instanceof List) { - buildMultipleNegateQueryFromList(entry, query); - } else { - query = query.hasNot(entry.getKey().getProperty(), entry.getValue()); - } - } - } - if (predicates != null && !predicates.isEmpty()) { - for (Map.Entry> entry : predicates.entrySet()) { - JanusGraphPredicate predicate = entry.getValue().getKey(); - Object object = entry.getValue().getValue(); - query = query.has(entry.getKey(), predicate, object); - } - } - Iterable vertices = query.vertices(); - if (vertices == null || !vertices.iterator().hasNext()) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - List result = new ArrayList<>(); - - vertices.forEach(vertex -> result.add(createAndFill(vertex, parseFlag))); - if (logger.isDebugEnabled()) { - logger.debug( - "Number of fetched nodes in graph for criteria : from type '{}' and properties '{}' is '{}'", - type, hasProps, result.size()); - } - return Either.left(result); - } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed to get by criteria for type '{}' and properties '{}'", type, hasProps, e); - } - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("Failed to get by criteria for type '{}' and properties '{}'. Error : '{}'", type, - hasProps, graph.right().value()); - } - return Either.right(graph.right().value()); - } - } - - private boolean vertexValidForModel(final JanusGraphVertex vertex, final String model) { - final String vertexLabel = (String)vertex.property(GraphPropertyEnum.LABEL.getProperty()).value(); - final VertexTypeEnum vertexType = VertexTypeEnum.getByName(vertexLabel); - final GraphEdgeLabels edgeLabel = vertexType.equals(VertexTypeEnum.TOPOLOGY_TEMPLATE) ? GraphEdgeLabels.MODEL : GraphEdgeLabels.MODEL_ELEMENT; - final Either>, JanusGraphOperationStatus> modelVertices = getParentVerticies(vertex, edgeLabel); - - return modelVertices.isLeft() && modelVertices.left().value().stream().anyMatch(vertexPair -> modelVertexMatchesModel(vertexPair.getLeft(), model)); - } - - private boolean modelVertexMatchesModel(final JanusGraphVertex modelVertex, final String model) { - if (model.equals((String)modelVertex.property("name").value())) { - return true; - } - final Either>, JanusGraphOperationStatus> derivedModels = - getParentVerticies(modelVertex, GraphEdgeLabels.DERIVED_FROM); - return derivedModels.isLeft() && derivedModels.left().value().stream().anyMatch(derivedModel ->modelVertexMatchesModel(derivedModel.left, model)); - } - - private Either>, JanusGraphOperationStatus> getParentVerticies( - final JanusGraphVertex rootVertex, final GraphEdgeLabels edgeType) { - return getEdgeVerticies(rootVertex, Direction.IN, edgeType); - } - - private Either>, JanusGraphOperationStatus> getEdgeVerticies( - final JanusGraphVertex rootVertex, final Direction direction, final GraphEdgeLabels edgeType) { - final List> immutablePairs = new ArrayList<>(); - final Iterator edgesCreatorIterator = rootVertex.edges(direction, edgeType.getProperty()); - if (edgesCreatorIterator != null) { - while (edgesCreatorIterator.hasNext()) { - Edge edge = edgesCreatorIterator.next(); - JanusGraphVertex vertex = Direction.OUT.equals(direction)? (JanusGraphVertex) edge.inVertex() : (JanusGraphVertex) edge.outVertex(); - ImmutablePair immutablePair = new ImmutablePair<>(vertex, edge); - immutablePairs.add(immutablePair); - } - } - if (immutablePairs.isEmpty()) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - return Either.left(immutablePairs); - } - - private boolean vertexNotConnectedToAnyModel(final JanusGraphVertex vertex) { - String vt = (String)vertex.property(GraphPropertyEnum.LABEL.getProperty()).value(); - VertexTypeEnum vertexType = VertexTypeEnum.getByName(vt); - EdgeLabelEnum edgeLabel = vertexType.equals(VertexTypeEnum.TOPOLOGY_TEMPLATE) ? EdgeLabelEnum.MODEL : EdgeLabelEnum.MODEL_ELEMENT; - return !vertex.edges(Direction.IN, edgeLabel.name()).hasNext(); - } - - public Either, JanusGraphOperationStatus> getCatalogOrArchiveVerticies(boolean isCatalog) { - Either graph = janusGraphClient.getGraph(); - if (graph.isLeft()) { - try { - JanusGraph tGraph = graph.left().value(); - String name = isCatalog ? VertexTypeEnum.CATALOG_ROOT.getName() : VertexTypeEnum.ARCHIVE_ROOT.getName(); - Iterable vCatalogIter = tGraph.query().has(GraphPropertyEnum.LABEL.getProperty(), name).vertices(); - if (vCatalogIter == null) { - logger.debug("Failed to fetch catalog vertex"); - return Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - } - JanusGraphVertex catalogV = vCatalogIter.iterator().next(); - if (catalogV == null) { - logger.debug("Failed to fetch catalog vertex"); - return Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - } - String edgeLabel = isCatalog ? EdgeLabelEnum.CATALOG_ELEMENT.name() : EdgeLabelEnum.ARCHIVE_ELEMENT.name(); - Iterator vertices = catalogV.vertices(Direction.OUT, edgeLabel); - return Either.left(vertices); - } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed get by criteria: ", e); - } - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("Failed get by criteria : ", graph.right().value()); - } - return Either.right(graph.right().value()); - } - } - - private void buildMultipleNegateQueryFromList(Map.Entry entry, JanusGraphQuery query) { - List negateList = (List) entry.getValue(); - for (Object listItem : negateList) { - query.hasNot(entry.getKey().getProperty(), listItem); - } - } - - /** - * @param parentVertex - * @param edgeLabel - * @param parseFlag - * @return - */ - public Either getChildVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - Either, JanusGraphOperationStatus> childrenVertecies = getChildrenVertices(parentVertex, edgeLabel, parseFlag); - if (childrenVertecies.isRight()) { - return Either.right(childrenVertecies.right().value()); - } - return Either.left(childrenVertecies.left().value().get(0)); - } - - /** - * @param parentVertex - * @param edgeLabel - * @param parseFlag - * @return - */ - public Either getChildVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) { - Either, JanusGraphOperationStatus> childrenVertecies = getChildrenVertices(parentVertex, edgeLabel, parseFlag); - if (childrenVertecies.isRight()) { - return Either.right(childrenVertecies.right().value()); - } - return Either.left(childrenVertecies.left().value().get(0)); - } - - public Either getParentVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - Either, JanusGraphOperationStatus> childrenVertecies = getParentVertices(parentVertex, edgeLabel, parseFlag); - if (childrenVertecies.isRight()) { - return Either.right(childrenVertecies.right().value()); - } - if (isEmpty(childrenVertecies.left().value())) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - return Either.left(childrenVertecies.left().value().get(0)); - } - - public Either getParentVertex(Vertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) { - Either, JanusGraphOperationStatus> childrenVertecies = getParentVertices(parentVertex, edgeLabel, parseFlag); - if (childrenVertecies.isRight()) { - return Either.right(childrenVertecies.right().value()); - } - if (isEmpty(childrenVertecies.left().value())) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - return Either.left(childrenVertecies.left().value().get(0)); - } - - /** - * @param parentVertex - * @param edgeLabel - * @param parseFlag - * @return - */ - public Either, JanusGraphOperationStatus> getChildrenVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.OUT); - } - - public Either, JanusGraphOperationStatus> getParentVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.IN); - } - - public Either, JanusGraphOperationStatus> getParentVertices(Vertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.IN); - } - - private Either, JanusGraphOperationStatus> getAdjacentVertices(Vertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag, Direction direction) { - List list = new ArrayList<>(); - try { - Either graphRes = janusGraphClient.getGraph(); - if (graphRes.isRight()) { - logger.error("Failed to retrieve graph. status is {}", graphRes); - return Either.right(graphRes.right().value()); - } - Iterator edgesCreatorIterator = parentVertex.edges(direction, edgeLabel.name()); - if (edgesCreatorIterator != null) { - while (edgesCreatorIterator.hasNext()) { - Edge edge = edgesCreatorIterator.next(); - JanusGraphVertex vertex; - if (direction == Direction.IN) { - vertex = (JanusGraphVertex) edge.outVertex(); - } else { - vertex = (JanusGraphVertex) edge.inVertex(); - } - // GraphVertex graphVertex = createAndFill(vertex, parseFlag); - list.add(vertex); - } - } - if (list.isEmpty()) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - } catch (Exception e) { - logger.error("Failed to perform graph operation ", e); - Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - return Either.left(list); - } - - /** - * @param parentVertex - * @param edgeLabel - * @param parseFlag - * @return - */ - public Either, JanusGraphOperationStatus> getChildrenVertices(Vertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag) { - return getAdjacentVertices(parentVertex, edgeLabel, parseFlag, Direction.OUT); - } - - private Either, JanusGraphOperationStatus> getAdjacentVertices(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, - JsonParseFlagEnum parseFlag, Direction direction) { - List list = new ArrayList<>(); - Either, JanusGraphOperationStatus> adjacentVerticies = getAdjacentVertices(parentVertex.getVertex(), edgeLabel, parseFlag, - direction); - if (adjacentVerticies.isRight()) { - return Either.right(adjacentVerticies.right().value()); - } - adjacentVerticies.left().value().stream().forEach(vertex -> { - list.add(createAndFill((JanusGraphVertex) vertex, parseFlag)); - }); - return Either.left(list); - } - - /** - * Searches Edge by received label and criteria - * - * @param vertex - * @param label - * @param properties - * @return found edge or JanusGraphOperationStatus - */ - public Either getBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, - Map properties) { - Either result = null; - Edge matchingEdge = null; - String notFoundMsg = "No edges in graph for criteria"; - try { - JanusGraphVertexQuery query = vertex.getVertex().query().labels(label.name()); - if (properties != null && !properties.isEmpty()) { - for (Map.Entry entry : properties.entrySet()) { - query = query.has(entry.getKey().getProperty(), entry.getValue()); - } - } - Iterable edges = query.edges(); - if (edges == null) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg); - result = Either.right(JanusGraphOperationStatus.NOT_FOUND); - } else { - Iterator eIter = edges.iterator(); - if (eIter.hasNext()) { - matchingEdge = eIter.next(); - } else { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg); - result = Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - } - if (result == null) { - result = Either.left(matchingEdge); - } - } catch (Exception e) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", - vertex.getUniqueId(), e); - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - return result; - } - - public Either getEdgeByChildrenVertexProperties(GraphVertex vertex, EdgeLabelEnum label, - Map properties) { - Either result = null; - Edge matchingEdge = null; - String notFoundMsg = "No edges in graph for criteria"; - try { - Iterator edges = vertex.getVertex().edges(Direction.OUT, label.name()); - while (edges.hasNext()) { - matchingEdge = edges.next(); - Vertex childV = matchingEdge.inVertex(); - Map vertexProperties = getVertexProperties(childV); - Optional> findNotMatch = properties.entrySet().stream() - .filter(e -> vertexProperties.get(e.getKey()) == null || !vertexProperties.get(e.getKey()).equals(e.getValue())).findFirst(); - if (!findNotMatch.isPresent()) { - result = Either.left(matchingEdge); - } - } - if (result == null) { - //no match - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg); - result = Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - } catch (Exception e) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", - vertex.getUniqueId(), e); - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - return result; - } - - /** - * Deletes Edge by received label and criteria - * - * @param vertex - * @param label - * @param properties - * @return - */ - public Either deleteBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, - Map properties) { - Either result = null; - try { - result = getBelongingEdgeByCriteria(vertex, label, properties); - if (result.isLeft()) { - Edge edge = result.left().value(); - CommonUtility - .addRecordToLog(logger, LogLevelEnum.TRACE, "Going to delete an edge with the label {} belonging to the vertex {} ", label.name(), - vertex.getUniqueId()); - edge.remove(); - result = Either.left(edge); - } else { - CommonUtility - .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to find an edge with the label {} belonging to the vertex {} ", label.name(), - vertex.getUniqueId()); - } - } catch (Exception e) { - CommonUtility - .addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge by criteria for the component with id {}. {}", - vertex == null ? "NULL" : vertex.getUniqueId(), e); - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - return result; - } - - @SuppressWarnings("unchecked") - /** - * Deletes an edge between vertices fromVertex and toVertex according to received label - * - * @param fromVertex - * @param toVertex - * @param label - * @return - */ - public Either deleteEdge(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) { - return deleteEdge(fromVertex.getVertex(), toVertex.getVertex(), label, fromVertex.getUniqueId(), toVertex.getUniqueId(), false); - } - - public Either deleteAllEdges(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) { - return deleteEdge(fromVertex.getVertex(), toVertex.getVertex(), label, fromVertex.getUniqueId(), toVertex.getUniqueId(), true); - } - - public Either deleteEdge(JanusGraphVertex fromVertex, JanusGraphVertex toVertex, EdgeLabelEnum label, - String uniqueIdFrom, String uniqueIdTo, boolean deleteAll) { - Either result = null; - Vertex problemV = null; - try { - Iterable edges = fromVertex.query().labels(label.name()).edges(); - Iterator eIter = edges.iterator(); - while (eIter.hasNext()) { - Edge edge = eIter.next(); - problemV = edge.inVertex(); - String currVertexUniqueId = null; - try { - currVertexUniqueId = edge.inVertex().value(GraphPropertyEnum.UNIQUE_ID.getProperty()); - } catch (Exception e) { - // AutoHealing procedure - logger.info("Corrupted vertex and edge were found and deleted {}", e); - if (problemV != null) { - Map props = getVertexProperties(problemV); - logger.debug("problematic Vertex properties:"); - logger.debug("props size: {}", props.size()); - for (Map.Entry entry : props.entrySet()) { - logger.debug("{}{}", entry.getKey() + ":" + entry.getValue()); - } - Either, JanusGraphOperationStatus> childrenVertices = getChildrenVertices(problemV, EdgeLabelEnum.VERSION, - JsonParseFlagEnum.NoParse); - if (childrenVertices.isLeft()) { - childrenVertices.left().value().size(); - logger.debug("number of children that problematic Vertex has: {}", props.size()); - } - try { - edge.remove(); - } catch (Exception e1) { - logger.debug("failed to remove problematic edge. {}", e1); - } - try { - problemV.remove(); - } catch (Exception e2) { - logger.debug("failed to remove problematic vertex . {}", e2); - } - } - continue; - } - if (currVertexUniqueId != null && currVertexUniqueId.equals(uniqueIdTo)) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to delete an edge with the label {} between vertices {} and {}. ", - label.name(), uniqueIdFrom, uniqueIdTo); - edge.remove(); - result = Either.left(edge); - if (!deleteAll) { - break; - } - } - } - if (result == null) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to delete an edge with the label {} between vertices {} and {}. ", - label.name(), uniqueIdFrom, uniqueIdTo); - result = Either.right(JanusGraphOperationStatus.NOT_FOUND); - } - } catch (Exception e) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, - "Exception occured during deleting an edge with the label {} between vertices {} and {}. {}", label.name(), uniqueIdFrom, uniqueIdTo, - e); - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - return result; - } - - public JanusGraphOperationStatus deleteEdgeByDirection(GraphVertex fromVertex, Direction direction, EdgeLabelEnum label) { - try { - Iterator edges = fromVertex.getVertex().edges(direction, label.name()); - while (edges.hasNext()) { - Edge edge = edges.next(); - edge.remove(); - } - } catch (Exception e) { - logger.debug("Failed to remove from vertex {} edges {} by direction {} ", fromVertex.getUniqueId(), label, direction, e); - return JanusGraphClient.handleJanusGraphException(e); - } - return JanusGraphOperationStatus.OK; - } - - /** - * Updates vertex properties. Note that graphVertex argument should contain updated data - * - * @param graphVertex - * @return - */ - public Either updateVertex(GraphVertex graphVertex) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId()); - try { - graphVertex.updateMetadataJsonWithCurrentMetadataProperties(); - setVertexProperties(graphVertex.getVertex(), graphVertex); - } catch (Exception e) { - CommonUtility - .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId(), e); - return Either.right(JanusGraphClient.handleJanusGraphException(e)); - } - return Either.left(graphVertex); - } - - /** - * Fetches vertices by uniqueId according to received parse flag - * - * @param verticesToGet - * @return - */ - public Either, JanusGraphOperationStatus> getVerticesByUniqueIdAndParseFlag( - Map> verticesToGet) { - Either, JanusGraphOperationStatus> result = null; - Map vertices = new HashMap<>(); - JanusGraphOperationStatus titatStatus; - Either getVertexRes = null; - for (Map.Entry> entry : verticesToGet.entrySet()) { - if (entry.getValue().getKey() == GraphPropertyEnum.UNIQUE_ID) { - getVertexRes = getVertexById(entry.getKey(), entry.getValue().getValue()); - } else if (entry.getValue().getKey() == GraphPropertyEnum.USERID) { - getVertexRes = getVertexByPropertyAndLabel(entry.getValue().getKey(), entry.getKey(), VertexTypeEnum.USER, - entry.getValue().getValue()); - } - if (getVertexRes == null) { - titatStatus = JanusGraphOperationStatus.ILLEGAL_ARGUMENT; - CommonUtility - .addRecordToLog(logger, LogLevelEnum.DEBUG, "Invalid vertex type label {} has been received. ", entry.getValue().getKey(), - titatStatus); - return Either.right(titatStatus); - } - if (getVertexRes.isRight()) { - titatStatus = getVertexRes.right().value(); - CommonUtility - .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to get vertex by id {} . Status is {}. ", entry.getKey(), titatStatus); - result = Either.right(titatStatus); - break; - } else { - vertices.put(entry.getKey(), getVertexRes.left().value()); - } - } - if (result == null) { - result = Either.left(vertices); - } - return result; - } - - /** - * Creates edge between "from" and "to" vertices with specified label and properties extracted from received edge - * - * @param from - * @param to - * @param label - * @param edgeToCopy - * @return - */ - public JanusGraphOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Edge edgeToCopy) { - return createEdge(from, to, label, getEdgeProperties(edgeToCopy)); - } - - public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, Edge prevEdge, EdgeLabelEnum prevLabel, - EdgeLabelEnum newLabel) { - CommonUtility - .addRecordToLog(logger, LogLevelEnum.TRACE, "Going to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel, - fromVertex != null ? fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : "NULL", - toVertex != null ? toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()) : "NULL"); - JanusGraphOperationStatus result = createEdge(fromVertex, toVertex, newLabel, prevEdge); - if (result == JanusGraphOperationStatus.OK) { - prevEdge.remove(); - } - return result; - } - - /** - * Replaces previous label of edge with new label - * - * @param fromVertex - * @param toVertex - * @param prevLabel - * @param newLabel - * @return - */ - public JanusGraphOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) { - Iterator prevEdgeIter = toVertex.edges(Direction.IN, prevLabel.name()); - if (prevEdgeIter == null || !prevEdgeIter.hasNext()) { - CommonUtility - .addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to replace edge with label {} to {} between vertices {} and {}", prevLabel, - newLabel, fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), - toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty())); - return JanusGraphOperationStatus.NOT_FOUND; - } else { - return replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel); - } - } - - /** - * Updates metadata properties of vertex on graph. Json metadata property of the vertex will be updated with received properties too. - * - * @param vertex - * @param properties - * @return - */ - public JanusGraphOperationStatus updateVertexMetadataPropertiesWithJson(Vertex vertex, Map properties) { - try { - if (!MapUtils.isEmpty(properties)) { - String jsonMetadataStr = (String) vertex.property(GraphPropertyEnum.METADATA.getProperty()).value(); - Map jsonMetadataMap = JsonParserUtils.toMap(jsonMetadataStr); - for (Map.Entry property : properties.entrySet()) { - vertex.property(property.getKey().getProperty(), property.getValue()); - jsonMetadataMap.put(property.getKey().getProperty(), property.getValue()); - } - vertex.property(GraphPropertyEnum.METADATA.getProperty(), JsonParserUtils.toJson(jsonMetadataMap)); - } - } catch (Exception e) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occurred during update vertex metadata properties with json{}. {}", - vertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), e.getMessage()); - return JanusGraphClient.handleJanusGraphException(e); - } - return JanusGraphOperationStatus.OK; - } - - public JanusGraphOperationStatus disassociateAndDeleteLast(GraphVertex vertex, Direction direction, EdgeLabelEnum label) { - try { - Iterator edges = vertex.getVertex().edges(direction, label.name()); - while (edges.hasNext()) { - Edge edge = edges.next(); - Vertex secondVertex; - Direction reverseDirection; - if (direction == Direction.IN) { - secondVertex = edge.outVertex(); - reverseDirection = Direction.OUT; - } else { - secondVertex = edge.inVertex(); - reverseDirection = Direction.IN; - } - edge.remove(); - CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Edge {} with direction {} was removed from {}", label.name(), direction, - vertex.getVertex()); - Iterator restOfEdges = secondVertex.edges(reverseDirection, label.name()); - if (!restOfEdges.hasNext()) { - secondVertex.remove(); - CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "This was last edge . Vertex {} was removed ", vertex.getUniqueId()); - } - } - } catch (Exception e) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, - "Exception occured during deleting an edge with the label {} direction {} from vertex {}. {}", label.name(), direction, - vertex.getUniqueId(), e); - return JanusGraphClient.handleJanusGraphException(e); - } - return JanusGraphOperationStatus.OK; - } - - public Object getProperty(JanusGraphVertex vertex, String key) { - PropertyKey propertyKey = janusGraphClient.getGraph().left().value().getPropertyKey(key); - return vertex.valueOrNull(propertyKey); - } - - public Object getProperty(Edge edge, EdgePropertyEnum key) { - Object value = null; - try { - Property property = edge.property(key.getProperty()); - if (property != null) { - value = property.orElse(null); - if (value != null && key == EdgePropertyEnum.INSTANCES) { - return JsonParserUtils.toList((String) value, String.class); - } - return value; - } - } catch (Exception e) { - } - return value; - } - - /** - * @param vertexA - * @param vertexB - * @param label - * @param direction - * @return - */ - public JanusGraphOperationStatus moveEdge(GraphVertex vertexA, GraphVertex vertexB, EdgeLabelEnum label, Direction direction) { - JanusGraphOperationStatus result = deleteEdgeByDirection(vertexA, direction, label); - if (result != JanusGraphOperationStatus.OK) { - logger.error("Failed to diassociate {} from element {}. error {} ", label, vertexA.getUniqueId(), result); - return result; - } - JanusGraphOperationStatus createRelation; - if (direction == Direction.IN) { - createRelation = createEdge(vertexB, vertexA, label, null); - } else { - createRelation = createEdge(vertexA, vertexB, label, null); - } - if (createRelation != JanusGraphOperationStatus.OK) { - return createRelation; - } - return JanusGraphOperationStatus.OK; - } - - public Either getBelongingEdgeByCriteria(String parentId, EdgeLabelEnum label, - Map properties) { - Either getVertexRes = getVertexById(parentId, JsonParseFlagEnum.NoParse); - if (getVertexRes.isRight()) { - return Either.right(getVertexRes.right().value()); - } - return getBelongingEdgeByCriteria(getVertexRes.left().value(), label, properties); - } -} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java index b69165410b..4b9bc33c29 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java @@ -25,46 +25,45 @@ import com.datastax.driver.core.Cluster.Builder; import com.datastax.driver.core.Session; import com.datastax.driver.mapping.MappingManager; import fj.data.Either; -import mockit.Deencapsulation; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.T; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.utils.CassandraTestHelper; import org.openecomp.sdc.be.utils.DAOConfDependentTest; -public class CassandraClientTest extends DAOConfDependentTest { +class CassandraClientTest extends DAOConfDependentTest { private CassandraClient createTestSubject() { return new CassandraClient(); } - @BeforeClass + @BeforeAll public static void startServer() { CassandraTestHelper.startServer(); } @Test - public void testSetLocalDc() throws Exception { + void testSetLocalDc() throws Exception { CassandraClient testSubject; Builder mock = Mockito.mock(Cluster.Builder.class); Mockito.when(mock.withLoadBalancingPolicy(Mockito.any())).thenReturn(new Builder()); // default test testSubject = createTestSubject(); - Deencapsulation.invoke(testSubject, "setLocalDc", new Object[]{Cluster.Builder.class}); + Assertions.assertNotNull(testSubject); - ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig() - .setLocalDataCenter("mock"); + ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setLocalDataCenter("mock"); testSubject = createTestSubject(); - Deencapsulation.invoke(testSubject, "setLocalDc", mock); + Assertions.assertNotNull(testSubject); } @Test - public void testEnableSsl() throws Exception { + void testEnableSsl() throws Exception { CassandraClient testSubject; Cluster.Builder clusterBuilder = null; @@ -72,39 +71,46 @@ public class CassandraClientTest extends DAOConfDependentTest { Mockito.when(mock.withSSL()).thenReturn(new Builder()); ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setSsl(false); - // default test testSubject = createTestSubject(); - Deencapsulation.invoke(testSubject, "enableSsl", mock); + Assertions.assertNotNull(testSubject); + Assertions.assertNull(System.getProperty("javax.net.ssl.trustStore")); + Assertions.assertNull(System.getProperty("javax.net.ssl.trustStorePassword")); ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setSsl(true); - // default test testSubject = createTestSubject(); - Deencapsulation.invoke(testSubject, "enableSsl", mock); + Assertions.assertNotNull(testSubject); + Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStore")); + Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStorePassword")); + ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setTruststorePath(null); - ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig() - .setTruststorePassword(null); - Deencapsulation.invoke(testSubject, "enableSsl", mock); + ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setTruststorePassword(null); + testSubject = createTestSubject(); + Assertions.assertNotNull(testSubject); + Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStore")); + Assertions.assertNotNull(System.getProperty("javax.net.ssl.trustStorePassword")); } @Test - public void testEnableAuthentication() throws Exception { + void testEnableAuthentication() throws Exception { CassandraClient testSubject; Builder mock = Mockito.mock(Cluster.Builder.class); Mockito.when(mock.withCredentials(Mockito.any(), Mockito.any())).thenReturn(new Builder()); - // default test testSubject = createTestSubject(); - Deencapsulation.invoke(testSubject, "enableAuthentication", Cluster.Builder.class); + Assertions.assertNotNull(testSubject); ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setAuthenticate(true); - Deencapsulation.invoke(testSubject, "enableAuthentication", mock); + testSubject = createTestSubject(); + Assertions.assertNotNull(testSubject); + ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setUsername(null); ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setPassword(null); - Deencapsulation.invoke(testSubject, "enableAuthentication", mock); + testSubject = createTestSubject(); + Assertions.assertNotNull(testSubject); } @Test - public void testConnect() throws Exception { + void testConnect() throws Exception { CassandraClient testSubject; String keyspace = ""; Either, CassandraOperationStatus> result; @@ -112,10 +118,11 @@ public class CassandraClientTest extends DAOConfDependentTest { // default test testSubject = createTestSubject(); result = testSubject.connect(keyspace); + Assertions.assertNotNull(result); } @Test - public void testSave() throws Exception { + void testSave() throws Exception { CassandraClient testSubject; T entity = null; Class clazz = null; @@ -125,10 +132,11 @@ public class CassandraClientTest extends DAOConfDependentTest { // default test testSubject = createTestSubject(); result = testSubject.save(entity, clazz, manager); + Assertions.assertNotNull(result); } @Test - public void testGetById() throws Exception { + void testGetById() throws Exception { CassandraClient testSubject; String id = ""; Class clazz = null; @@ -138,10 +146,11 @@ public class CassandraClientTest extends DAOConfDependentTest { // default test testSubject = createTestSubject(); result = testSubject.getById(id, clazz, manager); + Assertions.assertNotNull(result); } @Test - public void testDelete() throws Exception { + void testDelete() throws Exception { CassandraClient testSubject; String id = ""; Class clazz = null; @@ -151,24 +160,27 @@ public class CassandraClientTest extends DAOConfDependentTest { // default test testSubject = createTestSubject(); result = testSubject.delete(id, clazz, manager); + Assertions.assertNotNull(result); } @Test - public void testIsConnected() throws Exception { + void testIsConnected() throws Exception { CassandraClient testSubject; boolean result; // default test testSubject = createTestSubject(); result = testSubject.isConnected(); + Assertions.assertTrue(result); } @Test - public void testCloseClient() throws Exception { + void testCloseClient() throws Exception { CassandraClient testSubject; // default test testSubject = createTestSubject(); testSubject.closeClient(); + Assertions.assertNotNull(testSubject); } } diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java new file mode 100644 index 0000000000..a745567ab1 --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoMockTest.java @@ -0,0 +1,545 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.dao.janusgraph; + +import fj.data.Either; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphVertex; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.utils.DAOConfDependentTest; + +class JanusGraphDaoMockTest extends DAOConfDependentTest { + + @InjectMocks + private JanusGraphDao testSubject; + + @Mock + private JanusGraphClient janusGraphClient; + + @BeforeEach + void BeforeEach() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + void testCommit() throws Exception { + JanusGraphOperationStatus result; + + // default test + result = testSubject.commit(); + } + + @Test + void testRollback() throws Exception { + JanusGraphOperationStatus result; + + // default test + result = testSubject.rollback(); + } + + @Test + void testGetGraph() throws Exception { + + Either result; + + // default test + + result = testSubject.getGraph(); + } + + @Test + void testCreateVertex() throws Exception { + + GraphVertex graphVertex = new GraphVertex(); + graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); + Either result; + + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either value = Either.left(tg); + // default test + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(tg.addVertex()).thenReturn(value2); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + result = testSubject.createVertex(graphVertex); + } + + @Test + void testCreateVertexErrorGetGraph() throws Exception { + + GraphVertex graphVertex = new GraphVertex(); + graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); + Either result; + + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + // default test + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + result = testSubject.createVertex(graphVertex); + } + + @Test + void testCreateVertexException() throws Exception { + + GraphVertex graphVertex = new GraphVertex(); + graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); + Either result; + + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either value = Either.left(tg); + // default test + Mockito.when(tg.addVertex()).thenThrow(RuntimeException.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + result = testSubject.createVertex(graphVertex); + } + + @Test + void testGetVertexByPropertyAndLabel() throws Exception { + Either result; + + // default test + Mockito.when(janusGraphClient.getGraph()).thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)); + result = testSubject.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, "mock", + VertexTypeEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testGetVertexById_1Exception() throws Exception { + + String id = "mock"; + Either result; + + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either value = Either.left(tg); + // default test + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(tg.addVertex()).thenReturn(value2); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // test 1 + result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse); + // Assert.assertEquals(null, result); + } + + @Test + void testGetVertexById_1GraphClosed() throws Exception { + + String id = "mock"; + Either result; + + Object b; + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + // default test + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // test 1 + result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse); + // Assert.assertEquals(null, result); + } + + @Test + void testSetVertexProperties_1() throws Exception { + Vertex vertex = Mockito.mock(Vertex.class); + Map properties = new HashMap<>(); + properties.put("mock", "mock"); + + // default test + testSubject.setVertexProperties(vertex, properties); + } + + @Test + void testParseVertexProperties() throws Exception { + + GraphVertex graphVertex = new GraphVertex(); + JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class); + graphVertex.setVertex(vertex); + JsonParseFlagEnum parseFlag = null; + + // default test + + testSubject.parseVertexProperties(graphVertex, JsonParseFlagEnum.NoParse); + } + + @Test + void testCreateEdge() throws Exception { + + GraphVertex from = Mockito.mock(GraphVertex.class); + GraphVertex to = Mockito.mock(GraphVertex.class); + + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); + Mockito.when(from.getVertex()).thenReturn(value); + Mockito.when(to.getVertex()).thenReturn(value); + Map properties = new HashMap<>(); + JanusGraphOperationStatus result; + + // default test + + result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties); + from = new GraphVertex(); + to = new GraphVertex(); + result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties); + } + + @Test + void testSetEdgeProperties() throws Exception { + + Element element = Mockito.mock(Element.class); + Map properties = new HashMap<>(); + + // test 1 + + properties.put(EdgePropertyEnum.STATE, "mock"); + testSubject.setEdgeProperties(element, properties); + } + + @Test + void testGetByCriteria() throws Exception { + Map props = new HashMap<>(); + Either, JanusGraphOperationStatus> result; + + JanusGraph tg = Mockito.mock(JanusGraph.class); + Either value = Either.left(tg); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(tg.addVertex()).thenReturn(value2); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // default test + result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props); + } + + @Test + void testGetByCriteria_1() throws Exception { + + Map props = new HashMap<>(); + Either, JanusGraphOperationStatus> result; + + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // default test + result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props, JsonParseFlagEnum.NoParse); + } + + @Test + void testGetCatalogVerticies() throws Exception { + Either, JanusGraphOperationStatus> result; + + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + // default test + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // default test + result = testSubject.getCatalogOrArchiveVerticies(true); + } + + @Test + void testGetChildVertex() throws Exception { + + GraphVertex parentVertex = new GraphVertex(); + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either result; + + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // default test + result = testSubject.getChildVertex(parentVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION, JsonParseFlagEnum.NoParse); + } + + @Test + void testGetChildVertex_1() throws Exception { + + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either result; + + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // default test + result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag); + } + + @Test + void testGetParentVertex_1() throws Exception { + + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either result; + + // default test + + result = testSubject.getParentVertex(parentVertex, edgeLabel, parseFlag); + } + + @Test + void testGetParentVertecies_1() throws Exception { + + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = testSubject.getParentVertices(parentVertex, edgeLabel, parseFlag); + } + + @Test + void testGetChildrenVertecies_1() throws Exception { + + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = testSubject.getChildrenVertices(parentVertex, edgeLabel, parseFlag); + } + + @Test + void testDeleteBelongingEdgeByCriteria() throws Exception { + + GraphVertex vertex = null; + EdgeLabelEnum label = null; + Map properties = null; + Either result; + + // default test + + result = testSubject.deleteBelongingEdgeByCriteria(vertex, label, properties); + } + + @Test + void testDeleteEdge() throws Exception { + + GraphVertex fromVertex = new GraphVertex(); + GraphVertex toVertex = new GraphVertex(); + Either result; + + Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); + JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); + Mockito.when(janusGraphClient.getGraph()).thenReturn(value); + + // default test + result = testSubject.deleteEdge(fromVertex, toVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testDeleteEdgeByDirection() throws Exception { + GraphVertex fromVertex = new GraphVertex(); + JanusGraphOperationStatus result; + + // default test + result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testDeleteEdgeByDirectionMock() throws Exception { + GraphVertex fromVertex = Mockito.mock(GraphVertex.class); + JanusGraphOperationStatus result; + + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); + ; + Mockito.when(fromVertex.getVertex()).thenReturn(value); + Iterator value2 = Mockito.mock(Iterator.class); + ; + Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(value2); + Mockito.when(value2.hasNext()).thenReturn(true, false); + Edge value3 = Mockito.mock(Edge.class); + ; + Mockito.when(value2.next()).thenReturn(value3); + // default test + result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testUpdateVertex() throws Exception { + + GraphVertex graphVertex = new GraphVertex(); + Either result; + + // default test + + result = testSubject.updateVertex(graphVertex); + } + + @Test + void testGetVerticesByUniqueIdAndParseFlag() throws Exception { + + Map> verticesToGet = new HashMap<>(); + Either, JanusGraphOperationStatus> result; + + // default test + result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet); + ImmutablePair value3 = ImmutablePair.of(GraphPropertyEnum.COMPONENT_TYPE, JsonParseFlagEnum.NoParse); + verticesToGet.put("mock", value3); + try { + result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + void testCreateEdge_2() throws Exception { + + Vertex from = null; + Vertex to = null; + EdgeLabelEnum label = null; + Edge edgeToCopy = null; + JanusGraphOperationStatus result; + + // default test + + result = testSubject.createEdge(from, to, label, edgeToCopy); + } + + @Test + void testReplaceEdgeLabel() throws Exception { + + Vertex fromVertex = null; + Vertex toVertex = null; + Edge prevEdge = null; + EdgeLabelEnum prevLabel = null; + EdgeLabelEnum newLabel = null; + JanusGraphOperationStatus result; + + // default test + + result = testSubject.replaceEdgeLabel(fromVertex, toVertex, prevEdge, prevLabel, newLabel); + } + + @Test + void testUpdateVertexMetadataPropertiesWithJson() throws Exception { + + Vertex vertex = Mockito.mock(Vertex.class); + ; + Map properties = new HashMap<>(); + properties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock"); + JanusGraphOperationStatus result; + + // default test + + result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties); + } + + //TODO Last + @Test + void testDisassociateAndDeleteLast() throws Exception { + + GraphVertex vertex = Mockito.mock(GraphVertex.class); + JanusGraphOperationStatus result; + + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); + Iterator mockiter = Mockito.mock(Iterator.class); + Edge nextmock = Mockito.mock(Edge.class); + Mockito.when(vertex.getVertex()).thenReturn(value); + Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter); + Mockito.when(mockiter.hasNext()).thenReturn(true, false); + Mockito.when(mockiter.next()).thenReturn(nextmock); + Vertex secondVertex = Mockito.mock(Vertex.class); + Mockito.when(nextmock.outVertex()).thenReturn(secondVertex); + Mockito.when(nextmock.inVertex()).thenReturn(secondVertex); + Iterator restOfEdges = Mockito.mock(Iterator.class); + Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges); + Mockito.when(restOfEdges.hasNext()).thenReturn(false); + + // default test + result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testDisassociateAndDeleteLastOut() throws Exception { + + GraphVertex vertex = Mockito.mock(GraphVertex.class); + JanusGraphOperationStatus result; + + JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); + Iterator mockiter = Mockito.mock(Iterator.class); + Edge nextmock = Mockito.mock(Edge.class); + Mockito.when(vertex.getVertex()).thenReturn(value); + Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter); + Mockito.when(mockiter.hasNext()).thenReturn(true, false); + Mockito.when(mockiter.next()).thenReturn(nextmock); + Vertex secondVertex = Mockito.mock(Vertex.class); + Mockito.when(nextmock.outVertex()).thenReturn(secondVertex); + Mockito.when(nextmock.inVertex()).thenReturn(secondVertex); + Iterator restOfEdges = Mockito.mock(Iterator.class); + Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges); + Mockito.when(restOfEdges.hasNext()).thenReturn(false); + + // default test + result = testSubject.disassociateAndDeleteLast(vertex, Direction.IN, EdgeLabelEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testDisassociateAndDeleteLastException() throws Exception { + + GraphVertex vertex = Mockito.mock(GraphVertex.class); + JanusGraphOperationStatus result; + + Mockito.when(vertex.getVertex()).thenThrow(RuntimeException.class); + + // default test + result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testMoveEdge() throws Exception { + + GraphVertex vertexA = new GraphVertex(); + GraphVertex vertexB = new GraphVertex(); + JanusGraphOperationStatus result; + + // default test + + result = testSubject.moveEdge(vertexA, vertexB, EdgeLabelEnum.ADDITIONAL_INFORMATION, Direction.BOTH); + } +} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java new file mode 100644 index 0000000000..fae514a2df --- /dev/null +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphDaoTest.java @@ -0,0 +1,329 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.dao.janusgraph; + +import fj.data.Either; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.structure.Property; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.janusgraph.core.JanusGraph; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.utils.DAOConfDependentTest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +class JanusGraphDaoTest extends DAOConfDependentTest { + + private static final Logger logger = LoggerFactory.getLogger(JanusGraphDaoTest.class); + private final JanusGraphDao dao = new JanusGraphDao(new JanusGraphClient(new DAOJanusGraphStrategy())); + + @BeforeEach + void init() { + dao.janusGraphClient.createGraph(); + } + + @AfterEach + void end() { + dao.janusGraphClient.cleanupGraph(); + } + + @Test + void testCreateVertex() throws Exception { + Either result; + + // default test + GraphVertex graphVertex = new GraphVertex(VertexTypeEnum.REQUIREMENTS); + result = dao.createVertex(graphVertex); + + graphVertex = new GraphVertex(); + result = dao.createVertex(graphVertex); + } + + @Test + void testGetVertexByLabel() throws Exception { + Either result; + + dao.createVertex(new GraphVertex(VertexTypeEnum.ADDITIONAL_INFORMATION)); + // default test + result = dao.getVertexByLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testCommit() throws Exception { + JanusGraphOperationStatus result; + + // default test + + result = dao.commit(); + } + + @Test + void testRollback() throws Exception { + + JanusGraphOperationStatus result; + + // default test + + result = dao.rollback(); + } + + @Test + void testGetGraph() throws Exception { + + Either result; + + // default test + + result = dao.getGraph(); + } + + @Test + void testGetVertexByPropertyAndLabel() throws Exception { + + GraphPropertyEnum name = null; + Object value = null; + VertexTypeEnum label = null; + Either result; + + // default test + + result = dao.getVertexByPropertyAndLabel(name, value, label); + + result = dao.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, new Object(), VertexTypeEnum.ADDITIONAL_INFORMATION); + } + + @Test + void testGetVertexByPropertyAndLabel_1() throws Exception { + + GraphPropertyEnum name = null; + Object value = null; + VertexTypeEnum label = null; + JsonParseFlagEnum parseFlag = null; + Either result; + + // default test + + result = dao.getVertexByPropertyAndLabel(name, value, label, parseFlag); + } + + @Test + void testGetVertexById() throws Exception { + + String id = ""; + Either result; + + // default test + + result = dao.getVertexById(id); + } + + @Test + void testGetVertexById_1() throws Exception { + + String id = ""; + JsonParseFlagEnum parseFlag = null; + Either result; + + // test 1 + + id = null; + result = dao.getVertexById(id, parseFlag); + + // test 2 + + id = ""; + result = dao.getVertexById(id, parseFlag); + } + + @Test + void testGetVertexProperties() throws Exception { + + Element element = null; + Map result; + + // test 1 + + element = null; + result = dao.getVertexProperties(element); + } + + @Test + void testGetEdgeProperties() throws Exception { + + Element element = null; + Map result; + + // test 1 + + element = null; + result = dao.getEdgeProperties(element); + } + + @Test + void testGetByCriteria() throws Exception { + + VertexTypeEnum type = null; + Map props = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = dao.getByCriteria(type, props); + } + + @Test + void testGetByCriteria_1() throws Exception { + + VertexTypeEnum type = null; + Map props = null; + JsonParseFlagEnum parseFlag = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = dao.getByCriteria(type, props, parseFlag); + } + + @Test + void testGetByCriteria_2() throws Exception { + + VertexTypeEnum type = null; + Map props = null; + Map hasNotProps = null; + JsonParseFlagEnum parseFlag = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = dao.getByCriteria(type, props, hasNotProps, parseFlag); + } + + @Test + void testGetCatalogVerticies() throws Exception { + + Either, JanusGraphOperationStatus> result; + + // default test + + result = dao.getCatalogOrArchiveVerticies(true); + } + + @Test + void testGetParentVertecies_1() throws Exception { + + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = dao.getParentVertices(parentVertex, edgeLabel, parseFlag); + } + + @Test + void testGetChildrenVertecies_1() throws Exception { + + Vertex parentVertex = null; + EdgeLabelEnum edgeLabel = null; + JsonParseFlagEnum parseFlag = null; + Either, JanusGraphOperationStatus> result; + + // default test + + result = dao.getChildrenVertices(parentVertex, edgeLabel, parseFlag); + } + + @Test + void testUpdateVertexMetadataPropertiesWithJson() throws Exception { + + Vertex vertex = null; + Map properties = null; + JanusGraphOperationStatus result; + + // default test + + result = dao.updateVertexMetadataPropertiesWithJson(vertex, properties); + } + + @Test + void testGetProperty() throws Exception { + Edge edge = Mockito.mock(Edge.class); + ; + Object result; + + Property value = Mockito.mock(Property.class); + Mockito.when(edge.property(Mockito.any())).thenReturn(value); + + // default test + result = dao.getProperty(edge, EdgePropertyEnum.STATE); + } + + @Test + void testGetProperty_1() throws Exception { + Edge edge = Mockito.mock(Edge.class); + ; + Object result; + + // default test + result = dao.getProperty(edge, EdgePropertyEnum.STATE); + } + + @Test + void testGetPropertyexception() throws Exception { + Edge edge = Mockito.mock(Edge.class); + ; + Object result; + + Property value = Mockito.mock(Property.class); + Mockito.when(edge.property(Mockito.any())).thenThrow(RuntimeException.class); + + // default test + result = dao.getProperty(edge, EdgePropertyEnum.STATE); + } + + @Test + void testGetBelongingEdgeByCriteria_1() throws Exception { + + String parentId = ""; + EdgeLabelEnum label = null; + Map properties = null; + Either result; + + // default test + + result = dao.getBelongingEdgeByCriteria(parentId, label, properties); + } +} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java deleted file mode 100644 index f1bac6ce1f..0000000000 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoMockTest.java +++ /dev/null @@ -1,606 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.be.dao.jsongraph; - -import org.janusgraph.core.JanusGraph; -import org.janusgraph.core.JanusGraphVertex; -import fj.data.Either; -import mockit.Deencapsulation; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public class JanusGraphDaoMockTest { - - @InjectMocks - JanusGraphDao testSubject; - - @Mock - JanusGraphClient janusGraphClient; - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - @Test - public void testCommit() throws Exception { - JanusGraphOperationStatus result; - - // default test - result = testSubject.commit(); - } - - @Test - public void testRollback() throws Exception { - JanusGraphOperationStatus result; - - // default test - result = testSubject.rollback(); - } - - @Test - public void testGetGraph() throws Exception { - - Either result; - - // default test - - result = testSubject.getGraph(); - } - - @Test - public void testCreateVertex() throws Exception { - - GraphVertex graphVertex = new GraphVertex(); - graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - Either result; - - JanusGraph tg = Mockito.mock(JanusGraph.class); - Either value = Either.left(tg); - // default test - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(tg.addVertex()).thenReturn(value2); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - result = testSubject.createVertex(graphVertex); - } - - @Test - public void testCreateVertexErrorGetGraph() throws Exception { - - GraphVertex graphVertex = new GraphVertex(); - graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - Either result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - // default test - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - result = testSubject.createVertex(graphVertex); - } - - @Test - public void testCreateVertexException() throws Exception { - - GraphVertex graphVertex = new GraphVertex(); - graphVertex.setLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - Either result; - - JanusGraph tg = Mockito.mock(JanusGraph.class); - Either value = Either.left(tg); - // default test - Mockito.when(tg.addVertex()).thenThrow(RuntimeException.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - result = testSubject.createVertex(graphVertex); - } - - @Test - public void testGetVertexByPropertyAndLabel() throws Exception { - Either result; - - // default test - Mockito.when(janusGraphClient.getGraph()).thenReturn(Either.right(JanusGraphOperationStatus.GENERAL_ERROR)); - result = testSubject.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, "mock", - VertexTypeEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testGetFirstFoundVertex() throws Exception { - Iterable vertices = Mockito.mock(Iterable.class); - Either result; - - Iterator value = Mockito.mock(Iterator.class); - Mockito.when(vertices.iterator()).thenReturn(value); - Mockito.when(value.hasNext()).thenReturn(true); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(value.next()).thenReturn(value2); - - // default test - result = Deencapsulation.invoke(testSubject, "getFirstFoundVertex", JsonParseFlagEnum.NoParse, vertices); - } - - @Test - public void testGetFirstFoundVertexNotFound() throws Exception { - Iterable vertices = Mockito.mock(Iterable.class); - Either result; - - Iterator value = Mockito.mock(Iterator.class); - Mockito.when(vertices.iterator()).thenReturn(value); - Mockito.when(value.hasNext()).thenReturn(false); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(value.next()).thenReturn(value2); - - // default test - result = Deencapsulation.invoke(testSubject, "getFirstFoundVertex", JsonParseFlagEnum.NoParse, vertices); - } - - @Test - public void testGetVertexById_1Exception() throws Exception { - - String id = "mock"; - Either result; - - JanusGraph tg = Mockito.mock(JanusGraph.class); - Either value = Either.left(tg); - // default test - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(tg.addVertex()).thenReturn(value2); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // test 1 - result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse); - // Assert.assertEquals(null, result); - } - - @Test - public void testGetVertexById_1GraphClosed() throws Exception { - - String id = "mock"; - Either result; - - Object b; - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - // default test - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // test 1 - result = testSubject.getVertexById(id, JsonParseFlagEnum.NoParse); - // Assert.assertEquals(null, result); - } - - @Test - public void testSetVertexProperties_1() throws Exception { - Vertex vertex = Mockito.mock(Vertex.class); - Map properties = new HashMap<>(); - properties.put("mock", "mock"); - - // default test - testSubject.setVertexProperties(vertex, properties); - } - - @Test - public void testCreateAndFill() throws Exception { - - JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class); - JsonParseFlagEnum parseFlag = null; - GraphVertex result; - - // default test - - result = Deencapsulation.invoke(testSubject, "createAndFill", vertex, JsonParseFlagEnum.NoParse); - } - - @Test - public void testParseVertexProperties() throws Exception { - - GraphVertex graphVertex = new GraphVertex(); - JanusGraphVertex vertex = Mockito.mock(JanusGraphVertex.class); - graphVertex.setVertex(vertex); - JsonParseFlagEnum parseFlag = null; - - // default test - - testSubject.parseVertexProperties(graphVertex, JsonParseFlagEnum.NoParse); - } - - - @Test - public void testCreateEdge() throws Exception { - - GraphVertex from = Mockito.mock(GraphVertex.class); - GraphVertex to = Mockito.mock(GraphVertex.class); - - JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); - Mockito.when(from.getVertex()).thenReturn(value); - Mockito.when(to.getVertex()).thenReturn(value); - Map properties = new HashMap<>(); - JanusGraphOperationStatus result; - - // default test - - result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties); - from = new GraphVertex(); - to = new GraphVertex(); - result = testSubject.createEdge(from, to, EdgeLabelEnum.ADDITIONAL_INFORMATION, properties); - } - - @Test - public void testSetEdgeProperties() throws Exception { - - Element element = Mockito.mock(Element.class); - Map properties = new HashMap<>(); - - // test 1 - - properties.put(EdgePropertyEnum.STATE, "mock"); - testSubject.setEdgeProperties(element, properties); - } - - @Test - public void testGetByCriteria() throws Exception { - Map props = new HashMap<>(); - Either, JanusGraphOperationStatus> result; - - JanusGraph tg = Mockito.mock(JanusGraph.class); - Either value = Either.left(tg); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(tg.addVertex()).thenReturn(value2); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // default test - result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props); - } - - @Test - public void testGetByCriteria_1() throws Exception { - - Map props = new HashMap<>(); - Either, JanusGraphOperationStatus> result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // default test - result = testSubject.getByCriteria(VertexTypeEnum.ADDITIONAL_INFORMATION, props, JsonParseFlagEnum.NoParse); - } - - @Test - public void testGetCatalogVerticies() throws Exception { - Either, JanusGraphOperationStatus> result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - // default test - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // default test - result = testSubject.getCatalogOrArchiveVerticies(true); - } - - @Test - public void testGetChildVertex() throws Exception { - - GraphVertex parentVertex = new GraphVertex(); - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // default test - result = testSubject.getChildVertex(parentVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION, JsonParseFlagEnum.NoParse); - } - - @Test - public void testGetChildVertex_1() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // default test - result = testSubject.getChildVertex(parentVertex, edgeLabel, parseFlag); - } - - - @Test - public void testGetParentVertex_1() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either result; - - // default test - - result = testSubject.getParentVertex(parentVertex, edgeLabel, parseFlag); - } - - @Test - public void testGetParentVertecies_1() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = testSubject.getParentVertices(parentVertex, edgeLabel, parseFlag); - } - - @Test - public void testGetAdjacentVerticies() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Direction direction = null; - Either, JanusGraphOperationStatus> result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - // default test - result = Deencapsulation.invoke(testSubject, "getAdjacentVertices", - new Object[] { Vertex.class, EdgeLabelEnum.class, JsonParseFlagEnum.class, Direction.class }); - } - - @Test - public void testGetChildrenVertecies_1() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = testSubject.getChildrenVertices(parentVertex, edgeLabel, parseFlag); - } - - - @Test - public void testDeleteBelongingEdgeByCriteria() throws Exception { - - GraphVertex vertex = null; - EdgeLabelEnum label = null; - Map properties = null; - Either result; - - // default test - - result = testSubject.deleteBelongingEdgeByCriteria(vertex, label, properties); - } - - @Test - public void testDeleteEdge() throws Exception { - - GraphVertex fromVertex = new GraphVertex(); - GraphVertex toVertex = new GraphVertex(); - Either result; - - Either value = Either.right(JanusGraphOperationStatus.GENERAL_ERROR); - JanusGraphVertex value2 = Mockito.mock(JanusGraphVertex.class); - Mockito.when(janusGraphClient.getGraph()).thenReturn(value); - - // default test - result = testSubject.deleteEdge(fromVertex, toVertex, EdgeLabelEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testDeleteEdgeByDirection() throws Exception { - GraphVertex fromVertex = new GraphVertex(); - JanusGraphOperationStatus result; - - // default test - result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testDeleteEdgeByDirectionMock() throws Exception { - GraphVertex fromVertex = Mockito.mock(GraphVertex.class); - JanusGraphOperationStatus result; - - JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class);; - Mockito.when(fromVertex.getVertex()).thenReturn(value); - Iterator value2 = Mockito.mock(Iterator.class);; - Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(value2); - Mockito.when(value2.hasNext()).thenReturn(true, false); - Edge value3 = Mockito.mock(Edge.class);; - Mockito.when(value2.next()).thenReturn(value3); - // default test - result = testSubject.deleteEdgeByDirection(fromVertex, Direction.BOTH, EdgeLabelEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testUpdateVertex() throws Exception { - - GraphVertex graphVertex = new GraphVertex(); - Either result; - - // default test - - result = testSubject.updateVertex(graphVertex); - } - - @Test - public void testGetVerticesByUniqueIdAndParseFlag() throws Exception { - - Map> verticesToGet = new HashMap<>(); - Either, JanusGraphOperationStatus> result; - - // default test - result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet); - ImmutablePair value3 = ImmutablePair.of(GraphPropertyEnum.COMPONENT_TYPE, JsonParseFlagEnum.NoParse); - verticesToGet.put("mock", value3); - try { - result = testSubject.getVerticesByUniqueIdAndParseFlag(verticesToGet); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public void testCreateEdge_2() throws Exception { - - Vertex from = null; - Vertex to = null; - EdgeLabelEnum label = null; - Edge edgeToCopy = null; - JanusGraphOperationStatus result; - - // default test - - result = testSubject.createEdge(from, to, label, edgeToCopy); - } - - - @Test - public void testReplaceEdgeLabel() throws Exception { - - Vertex fromVertex = null; - Vertex toVertex = null; - Edge prevEdge = null; - EdgeLabelEnum prevLabel = null; - EdgeLabelEnum newLabel = null; - JanusGraphOperationStatus result; - - // default test - - result = testSubject.replaceEdgeLabel(fromVertex, toVertex, prevEdge, prevLabel, newLabel); - } - - @Test - public void testUpdateVertexMetadataPropertiesWithJson() throws Exception { - - Vertex vertex = Mockito.mock(Vertex.class);; - Map properties = new HashMap<>(); - properties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock"); - JanusGraphOperationStatus result; - - // default test - - result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties); - } - - //TODO Last - @Test - public void testDisassociateAndDeleteLast() throws Exception { - - GraphVertex vertex = Mockito.mock(GraphVertex.class); - JanusGraphOperationStatus result; - - JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); - Iterator mockiter = Mockito.mock(Iterator.class); - Edge nextmock = Mockito.mock(Edge.class); - Mockito.when(vertex.getVertex()).thenReturn(value); - Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter); - Mockito.when(mockiter.hasNext()).thenReturn(true, false); - Mockito.when(mockiter.next()).thenReturn(nextmock); - Vertex secondVertex = Mockito.mock(Vertex.class); - Mockito.when(nextmock.outVertex()).thenReturn(secondVertex); - Mockito.when(nextmock.inVertex()).thenReturn(secondVertex); - Iterator restOfEdges = Mockito.mock(Iterator.class); - Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges); - Mockito.when(restOfEdges.hasNext()).thenReturn(false); - - // default test - result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testDisassociateAndDeleteLastOut() throws Exception { - - GraphVertex vertex = Mockito.mock(GraphVertex.class); - JanusGraphOperationStatus result; - - JanusGraphVertex value = Mockito.mock(JanusGraphVertex.class); - Iterator mockiter = Mockito.mock(Iterator.class); - Edge nextmock = Mockito.mock(Edge.class); - Mockito.when(vertex.getVertex()).thenReturn(value); - Mockito.when(value.edges(Mockito.any(), Mockito.any())).thenReturn(mockiter); - Mockito.when(mockiter.hasNext()).thenReturn(true, false); - Mockito.when(mockiter.next()).thenReturn(nextmock); - Vertex secondVertex = Mockito.mock(Vertex.class); - Mockito.when(nextmock.outVertex()).thenReturn(secondVertex); - Mockito.when(nextmock.inVertex()).thenReturn(secondVertex); - Iterator restOfEdges = Mockito.mock(Iterator.class); - Mockito.when(secondVertex.edges(Mockito.any(), Mockito.any())).thenReturn(restOfEdges); - Mockito.when(restOfEdges.hasNext()).thenReturn(false); - - // default test - result = testSubject.disassociateAndDeleteLast(vertex, Direction.IN, EdgeLabelEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testDisassociateAndDeleteLastException() throws Exception { - - GraphVertex vertex = Mockito.mock(GraphVertex.class); - JanusGraphOperationStatus result; - - Mockito.when(vertex.getVertex()).thenThrow(RuntimeException.class); - - // default test - result = testSubject.disassociateAndDeleteLast(vertex, Direction.OUT, EdgeLabelEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testMoveEdge() throws Exception { - - GraphVertex vertexA = new GraphVertex(); - GraphVertex vertexB = new GraphVertex(); - JanusGraphOperationStatus result; - - // default test - - result = testSubject.moveEdge(vertexA, vertexB, EdgeLabelEnum.ADDITIONAL_INFORMATION, Direction.BOTH); - } -} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java deleted file mode 100644 index 2a3a4e8309..0000000000 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDaoTest.java +++ /dev/null @@ -1,332 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.be.dao.jsongraph; - -import org.janusgraph.core.JanusGraph; -import fj.data.Either; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.utils.DAOConfDependentTest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -public class JanusGraphDaoTest extends DAOConfDependentTest{ - - - private static Logger logger = LoggerFactory.getLogger(JanusGraphDaoTest.class); - private JanusGraphDao dao = new JanusGraphDao(new JanusGraphClient(new DAOJanusGraphStrategy())); - - @Before - public void init(){ - dao.janusGraphClient.createGraph(); - } - - @After - public void end(){ - dao.janusGraphClient.cleanupGraph(); - } - - @Test - public void testCreateVertex() throws Exception { - Either result; - - // default test - GraphVertex graphVertex = new GraphVertex(VertexTypeEnum.REQUIREMENTS); - result = dao.createVertex(graphVertex); - - graphVertex = new GraphVertex(); - result = dao.createVertex(graphVertex); - } - - @Test - public void testGetVertexByLabel() throws Exception { - Either result; - - // default test - result = dao.getVertexByLabel(VertexTypeEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testCommit() throws Exception { - JanusGraphOperationStatus result; - - // default test - - result = dao.commit(); - } - - - @Test - public void testRollback() throws Exception { - - JanusGraphOperationStatus result; - - // default test - - result = dao.rollback(); - } - - @Test - public void testGetGraph() throws Exception { - - Either result; - - // default test - - result = dao.getGraph(); - } - - @Test - public void testGetVertexByPropertyAndLabel() throws Exception { - - GraphPropertyEnum name = null; - Object value = null; - VertexTypeEnum label = null; - Either result; - - // default test - - result = dao.getVertexByPropertyAndLabel(name, value, label); - - result = dao.getVertexByPropertyAndLabel(GraphPropertyEnum.COMPONENT_TYPE, new Object(), VertexTypeEnum.ADDITIONAL_INFORMATION); - } - - @Test - public void testGetVertexByPropertyAndLabel_1() throws Exception { - - GraphPropertyEnum name = null; - Object value = null; - VertexTypeEnum label = null; - JsonParseFlagEnum parseFlag = null; - Either result; - - // default test - - result = dao.getVertexByPropertyAndLabel(name, value, label, parseFlag); - } - - - @Test - public void testGetVertexById() throws Exception { - - String id = ""; - Either result; - - // default test - - result = dao.getVertexById(id); - } - - @Test - public void testGetVertexById_1() throws Exception { - - String id = ""; - JsonParseFlagEnum parseFlag = null; - Either result; - - // test 1 - - id = null; - result = dao.getVertexById(id, parseFlag); - - // test 2 - - id = ""; - result = dao.getVertexById(id, parseFlag); - } - - @Test - public void testGetVertexProperties() throws Exception { - - Element element = null; - Map result; - - // test 1 - - element = null; - result = dao.getVertexProperties(element); - } - - - @Test - public void testGetEdgeProperties() throws Exception { - - Element element = null; - Map result; - - // test 1 - - element = null; - result = dao.getEdgeProperties(element); - } - - @Test - public void testGetByCriteria() throws Exception { - - VertexTypeEnum type = null; - Map props = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = dao.getByCriteria(type, props); - } - - @Test - public void testGetByCriteria_1() throws Exception { - - VertexTypeEnum type = null; - Map props = null; - JsonParseFlagEnum parseFlag = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = dao.getByCriteria(type, props, parseFlag); - } - - - @Test - public void testGetByCriteria_2() throws Exception { - - VertexTypeEnum type = null; - Map props = null; - Map hasNotProps = null; - JsonParseFlagEnum parseFlag = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = dao.getByCriteria(type, props, hasNotProps, parseFlag); - } - - @Test - public void testGetCatalogVerticies() throws Exception { - - Either, JanusGraphOperationStatus> result; - - // default test - - result = dao.getCatalogOrArchiveVerticies(true); - } - - @Test - public void testGetParentVertecies_1() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = dao.getParentVertices(parentVertex, edgeLabel, parseFlag); - } - - @Test - public void testGetChildrenVertecies_1() throws Exception { - - Vertex parentVertex = null; - EdgeLabelEnum edgeLabel = null; - JsonParseFlagEnum parseFlag = null; - Either, JanusGraphOperationStatus> result; - - // default test - - result = dao.getChildrenVertices(parentVertex, edgeLabel, parseFlag); - } - - @Test - public void testUpdateVertexMetadataPropertiesWithJson() throws Exception { - - Vertex vertex = null; - Map properties = null; - JanusGraphOperationStatus result; - - // default test - - result = dao.updateVertexMetadataPropertiesWithJson(vertex, properties); - } - - @Test - public void testGetProperty() throws Exception { - Edge edge = Mockito.mock(Edge.class);; - Object result; - - Property value = Mockito.mock(Property.class); - Mockito.when(edge.property(Mockito.any())).thenReturn(value); - - // default test - result = dao.getProperty(edge, EdgePropertyEnum.STATE); - } - - @Test - public void testGetProperty_1() throws Exception { - Edge edge = Mockito.mock(Edge.class);; - Object result; - - // default test - result = dao.getProperty(edge, EdgePropertyEnum.STATE); - } - - @Test - public void testGetPropertyexception() throws Exception { - Edge edge = Mockito.mock(Edge.class);; - Object result; - - Property value = Mockito.mock(Property.class); - Mockito.when(edge.property(Mockito.any())).thenThrow(RuntimeException.class); - - // default test - result = dao.getProperty(edge, EdgePropertyEnum.STATE); - } - - @Test - public void testGetBelongingEdgeByCriteria_1() throws Exception { - - String parentId = ""; - EdgeLabelEnum label = null; - Map properties = null; - Either result; - - // default test - - result = dao.getBelongingEdgeByCriteria(parentId, label, properties); - } -} diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java index b0cc95f290..874b3a63e1 100644 --- a/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java +++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,12 +20,13 @@ package org.openecomp.sdc.be.utils; -import org.junit.BeforeClass; +import org.junit.jupiter.api.BeforeAll; import org.openecomp.sdc.common.test.BaseConfDependent; public class DAOConfDependentTest extends BaseConfDependent { - @BeforeClass - public static void setupBeforeClass() { + + @BeforeAll + static void setupBeforeClass() { componentName = "catalog-dao"; confPath = "src/test/resources/config"; setUp(); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java index c580062732..b8ef2aec16 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperation.java @@ -32,7 +32,7 @@ import java.util.stream.Collectors; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java index f2e42388c0..92dc67bbca 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/BaseOperation.java @@ -41,7 +41,7 @@ import org.janusgraph.core.JanusGraphVertex; import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java index 4b6c084a89..00b4d8e31a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java index dd21ccf2df..64f5934b31 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperation.java @@ -30,7 +30,7 @@ import java.util.Map; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java index f40b19a083..42edceebc8 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperation.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java index 2f11fa9e8f..bd61f61a49 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java @@ -57,7 +57,7 @@ import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java index 42f1b03028..4c97b45830 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java @@ -43,7 +43,7 @@ import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java index b9378b8eca..caf1c4eaca 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupOperation.java @@ -36,7 +36,7 @@ import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java index d4bd7996f2..900c3402b5 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java @@ -38,7 +38,7 @@ import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.data.model.ToscaImportByModel; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java index c30c39835b..228bff947b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/OperationUtils.java @@ -24,7 +24,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.StorageException; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java index 82d1c2ae8c..1bc067e0f4 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArchiveOperationTest.java @@ -28,7 +28,7 @@ import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java index 5fc2ef2cae..556e362c2f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/CapabilitiesOperationTest.java @@ -24,7 +24,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java index 0a2055ca81..2febef610f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ExternalReferencesOperationTest.java @@ -29,7 +29,7 @@ import org.mockito.Mockito; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java index 35d943d573..bad361562b 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java @@ -32,7 +32,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java index e7512a9204..4925c87ce4 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/InterfaceOperationTest.java @@ -39,7 +39,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java index 9c9194828e..576aa8a680 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationGraphTest.java @@ -50,7 +50,7 @@ import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java index 5a02c5752f..72b047ad4a 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperationTest.java @@ -66,7 +66,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java index f9cecd5a06..37e360c5c2 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationIntegrationTest.java @@ -28,7 +28,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java index 865aa93171..1171a88340 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java @@ -31,7 +31,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.Component; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java index 18684a0c6a..bfa3dd6175 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationCapabilityIntegrationTest.java @@ -27,7 +27,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java index dc5e2fd5ea..82560b0576 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperationTest.java @@ -32,7 +32,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java index 15653c0bbd..29fbd755f5 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationCatalogTest.java @@ -32,7 +32,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java index 12f4628a1a..3da37c098a 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperationTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java index 5fd04b68d9..d60a574064 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadePoliciesTest.java @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java index b88eec2993..753953f33e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java @@ -72,7 +72,7 @@ import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java index 98cec1977e..1494f206f6 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/UpgradeOperationTest.java @@ -27,7 +27,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java index 06e0b428b9..c5c01bba02 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/GraphTestUtils.java @@ -25,7 +25,7 @@ import org.janusgraph.core.JanusGraphVertex; import fj.data.Either; import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java index d8b7e53860..58ee0d52af 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java @@ -32,7 +32,7 @@ import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; @@ -55,7 +55,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.ArrayList; import java.util.Collections; -import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java index e8d01dbb0f..44a9a7df42 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java @@ -53,7 +53,7 @@ import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.data.model.ToscaImportByModel; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/OperationUtilsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/OperationUtilsTest.java index 78b4a0e338..642e838fdf 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/OperationUtilsTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/OperationUtilsTest.java @@ -32,7 +32,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.StorageException; diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java index 654b074d9b..a80e44e921 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ToscaElementLifecycleOperationTest.java @@ -29,7 +29,7 @@ import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml index e92820fd13..0cc1361171 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml @@ -39,12 +39,6 @@ ${hamcrest.version} test - - org.jmockit - jmockit - ${jmockit.version} - test - javax.validation validation-api -- cgit 1.2.3-korg