From 2623c8402a57e2035db69a9d92d2851050916801 Mon Sep 17 00:00:00 2001 From: shrikantawachar Date: Mon, 20 May 2019 12:11:54 +0530 Subject: Upgrade SDC from Titan to Janus Graph Upgrade SDC from Titan to Janus Graph Change-Id: I67fb8b8e60cc6751697bc5ff2f06754c92803786 Issue-ID: SDC-2296 Signed-off-by: shrikantawachar --- .../csar/YamlTemplateParsingHandler.java | 14 +- .../ServiceDistributionArtifactsBuilder.java | 2 +- .../health/HealthCheckBusinessLogic.java | 28 +-- .../impl/AdditionalInformationBusinessLogic.java | 6 +- .../be/components/impl/ArchiveBusinessLogic.java | 14 +- .../be/components/impl/ArtifactsBusinessLogic.java | 18 +- .../sdc/be/components/impl/BaseBusinessLogic.java | 53 ++--- .../components/impl/CapabilitiesBusinessLogic.java | 46 ++--- .../be/components/impl/CassandraHealthCheck.java | 19 +- .../be/components/impl/CommonImportManager.java | 10 +- .../be/components/impl/ComponentBusinessLogic.java | 8 +- .../impl/ComponentInstanceBusinessLogic.java | 68 +++---- .../sdc/be/components/impl/DataTypesService.java | 8 +- .../be/components/impl/ElementBusinessLogic.java | 23 ++- .../components/impl/ExternalRefsBusinessLogic.java | 4 +- .../sdc/be/components/impl/GroupBusinessLogic.java | 56 +++--- .../be/components/impl/GroupBusinessLogicNew.java | 2 +- .../be/components/impl/GroupTypeBusinessLogic.java | 12 +- .../be/components/impl/GroupTypeImportManager.java | 2 +- .../be/components/impl/InputsBusinessLogic.java | 25 +-- .../impl/InterfaceOperationBusinessLogic.java | 34 ++-- .../be/components/impl/PolicyBusinessLogic.java | 2 +- .../components/impl/PolicyTypeBusinessLogic.java | 8 +- .../components/impl/PolicyTypeImportManager.java | 2 +- .../be/components/impl/ProductBusinessLogic.java | 10 +- .../be/components/impl/PropertyBusinessLogic.java | 10 +- .../impl/RelationshipTypeBusinessLogic.java | 8 +- .../impl/RelationshipTypeImportManager.java | 2 +- .../components/impl/RequirementBusinessLogic.java | 26 +-- .../be/components/impl/ResourceBusinessLogic.java | 54 +++--- .../be/components/impl/ResourceImportManager.java | 2 +- .../be/components/impl/ServiceBusinessLogic.java | 74 +++---- .../impl/generic/GenericTypeBusinessLogic.java | 2 +- .../impl/instance/GroupMembersUpdateOperation.java | 2 +- .../impl/policy/PolicyTargetsUpdateHandler.java | 2 +- .../be/components/impl/utils/ExceptionUtils.java | 20 +- .../lifecycle/CertificationChangeTransition.java | 20 +- .../lifecycle/CertificationRequestTransition.java | 18 +- .../be/components/lifecycle/CheckinTransition.java | 20 +- .../components/lifecycle/CheckoutTransition.java | 20 +- .../components/lifecycle/LifeCycleTransition.java | 12 +- .../lifecycle/LifecycleBusinessLogic.java | 41 ++-- .../lifecycle/StartCertificationTransition.java | 18 +- .../lifecycle/UndoCheckoutTransition.java | 18 +- .../merge/GlobalInputsFilteringBusinessLogic.java | 2 +- .../be/components/merge/TopologyComparator.java | 2 +- .../merge/group/ComponentGroupMergeCommand.java | 2 +- .../merge/group/GroupPropertiesMergeCommand.java | 2 +- .../merge/input/ComponentInputsMergeBL.java | 2 +- .../merge/input/GlobalInputsMergeCommand.java | 2 +- .../components/merge/input/InputsMergeCommand.java | 2 +- .../ComponentCapabilitiesPropertiesMergeBL.java | 2 +- .../instance/ComponentInstanceArtifactsMerge.java | 2 +- .../ComponentInstanceForwardingPathMerge.java | 2 +- .../instance/ComponentInstanceInputsMergeBL.java | 2 +- .../ComponentInstanceInputsRedeclareHandler.java | 2 +- .../instance/ComponentInstanceInterfacesMerge.java | 2 +- .../ComponentInstanceMergeDataBusinessLogic.java | 2 +- .../ComponentInstancePropertiesMergeBL.java | 2 +- .../ComponentInstancePropsAndInputsMerge.java | 2 +- .../instance/ComponentInstanceRelationMerge.java | 2 +- .../merge/instance/ExternalRefsMergeBL.java | 2 +- .../merge/policy/PoliciesMergeCommand.java | 2 +- .../PropertyDataValueMergeBusinessLogic.java | 4 +- .../components/merge/utils/MergeInstanceUtils.java | 4 +- .../components/path/ForwardingPathValidator.java | 2 +- .../ComponentInstanceInputPropertyDeclarator.java | 2 +- .../ComponentInstancePropertyDeclarator.java | 2 +- .../property/ComponentPropertyDeclarator.java | 2 +- .../property/DefaultPropertyDeclarator.java | 8 +- .../property/PolicyPropertyDeclarator.java | 2 +- ...omponentInstancePropertyToPolicyDeclarator.java | 2 +- .../ComponentPropertyToPolicyDeclarator.java | 2 +- .../components/upgrade/UpgradeBusinessLogic.java | 14 +- .../validation/ComponentValidations.java | 2 +- .../components/validation/NodeFilterValidator.java | 2 +- .../components/validation/PropertyValidator.java | 8 +- .../validation/ServiceDistributionValidation.java | 2 +- .../ecomp/converters/AssetMetadataConverter.java | 2 +- .../openecomp/sdc/be/filters/BeServletFilter.java | 18 +- .../be/filters/ComponentsAvailabilityFilter.java | 2 +- .../be/tosca/CapabilityRequirementConverter.java | 4 +- .../java/org/openecomp/sdc/be/tosca/CsarUtils.java | 4 +- .../sdc/be/tosca/GroupExportParserImpl.java | 4 +- .../sdc/be/tosca/PolicyExportParserImpl.java | 4 +- .../openecomp/sdc/be/tosca/ToscaExportHandler.java | 12 +- .../org/openecomp/sdc/be/tosca/ToscaUtils.java | 3 - .../be/tosca/utils/ForwardingPathToscaUtil.java | 2 +- .../openecomp/sdc/be/user/UserBusinessLogic.java | 8 +- .../common/transaction/api/ITransactionSdnc.java | 2 +- .../common/transaction/api/TransactionUtils.java | 2 +- .../transaction/impl/JanusGraphCommitHandler.java | 52 +++++ .../impl/JanusGraphRollbackHandler.java | 55 ++++++ .../transaction/impl/TitanCommitHandler.java | 52 ----- .../transaction/impl/TitanRollbackHandler.java | 55 ------ .../transaction/mngr/TransactionManager.java | 7 +- .../transaction/mngr/TransactionSdncImpl.java | 21 +- .../src/main/resources/config/configuration.yaml | 14 +- .../main/resources/config/janusgraph.properties | 11 ++ .../src/main/resources/config/titan.properties | 11 -- .../java/org/openecomp/sdc/be/MockGenerator.java | 4 +- .../components/BaseServiceBusinessLogicTest.java | 11 +- .../components/HealthCheckBusinessLogicTest.java | 16 +- .../be/components/PropertyBusinessLogicTest.java | 24 +-- .../be/components/ResourceImportManagerTest.java | 4 +- .../be/components/ServiceDistributionBLTest.java | 2 +- .../be/components/csar/CsarBusinessLogicTest.java | 2 +- .../ServiceDistributionArtifactsBuilderTest.java | 2 +- .../health/HealthCheckBusinessLogicTest.java | 4 +- .../AdditionalInformationBusinessLogicTest.java | 6 +- .../components/impl/ArchiveBusinessLogicTest.java | 4 +- .../components/impl/ArtifactBusinessLogicTest.java | 12 +- .../impl/ArtifactsBusinessLogicTest.java | 22 +-- .../impl/AttributeBusinessLogicTest.java | 19 +- .../impl/CapabilitiesBusinessLogicTest.java | 20 +- .../impl/CapabilityTypeImportManagerTest.java | 6 +- .../components/impl/CommonImportManagerTest.java | 22 +-- .../impl/ComponentInstanceBusinessLogicTest.java | 23 +-- .../components/impl/DataTypeBusinessLogicTest.java | 2 +- .../be/components/impl/DataTypesServiceTest.java | 12 +- .../sdc/be/components/impl/ElementBLTest.java | 21 +- .../components/impl/ElementBusinessLogicTest.java | 6 +- .../be/components/impl/GroupBusinessLogicTest.java | 16 +- .../components/impl/InputsBusinessLogicTest.java | 35 ++-- .../impl/InterfaceOperationBusinessLogicTest.java | 16 +- .../components/impl/PolicyBusinessLogicTest.java | 16 +- .../impl/PolicyPropertiesBusinessLogicTest.java | 10 +- .../impl/PolicyTypeBusinessLogicTest.java | 4 +- .../components/impl/ProductBusinessLogicTest.java | 6 +- .../impl/RequirementBusinessLogicTest.java | 18 +- .../components/impl/ResourceBusinessLogicTest.java | 18 +- .../impl/ResourceInstanceBusinessLogicTest.java | 2 +- .../components/impl/ServiceBusinessLogicTest.java | 10 +- .../impl/generic/GenericTypeBusinessLogicTest.java | 2 +- .../instance/GroupMembersUpdateOperationTest.java | 2 +- .../instance/PolicyTargetsUpdateOperationTest.java | 2 +- .../policy/PolicyTargetsUpdateHandlerTest.java | 2 +- .../impl/utils/YamlTemplateParsingHandlerTest.java | 6 +- .../CertificationChangeTransitionTest.java | 12 +- .../lifecycle/CertificationRequestTest.java | 7 +- .../CertificationRequestTransitionTest.java | 10 +- .../sdc/be/components/lifecycle/CheckinTest.java | 3 +- .../sdc/be/components/lifecycle/CheckoutTest.java | 3 +- .../be/components/lifecycle/LifecycleTestBase.java | 14 +- .../be/components/lifecycle/UndoCheckoutTest.java | 3 +- .../GlobalInputsFilteringBusinessLogicTest.java | 2 +- .../components/merge/TopologyComparatorTest.java | 2 +- .../group/ComponentGroupMergeCommandTest.java | 2 +- .../group/GroupPropertiesMergeCommandTest.java | 2 +- .../merge/input/BaseComponentInputsMerge.java | 2 +- ...ComponentCapabilitiesPropertiesMergeBLTest.java | 2 +- .../ComponentInstanceArtifactsMergeTest.java | 2 +- .../ComponentInstanceCapabilitiesMergeBLTest.java | 2 +- ...omponentInstanceInputsRedeclareHandlerTest.java | 2 +- .../ComponentInstanceInterfacesMergeTest.java | 2 +- ...omponentInstanceMergeDataBusinessLogicTest.java | 2 +- .../ComponentInstancePropsAndInputsMergeTest.java | 2 +- .../ComponentInstanceRelationMergeTest.java | 2 +- .../merge/instance/ExternalRefsMergeBLTest.java | 2 +- .../ComponentInstanceForwardingPathMergeTest.java | 2 +- .../merge/policy/PoliciesMergeCommandTest.java | 2 +- .../ComponentInstanceInputsMergeBLTest.java | 2 +- .../ComponentInstancePropertiesMergeBLTest.java | 2 +- .../merge/utils/MergeInstanceUtilsTest.java | 10 +- .../be/components/path/BaseForwardingPathTest.java | 29 +-- .../path/ForwardingPathValidatorTest.java | 2 +- .../beans/ForwardingPathToscaOperationFacade.java | 2 +- .../path/beans/InMemoryJanusGraphClient.java | 216 +++++++++++++++++++++ .../path/beans/InMemoryTitanGraphClient.java | 211 -------------------- .../components/path/beans/JanusGraphTestSetup.java | 166 ++++++++++++++++ .../components/path/beans/TitanGraphTestSetup.java | 166 ---------------- .../be/components/path/utils/GraphTestUtils.java | 44 ++--- ...ponentInstanceInputPropertyDeceleratorTest.java | 2 +- ...mponentInstanceInputPropertyDeclaratorTest.java | 2 +- .../ComponentInstancePropertyDeclaratorTest.java | 2 +- .../property/ComponentPropertyDeclaratorTest.java | 2 +- .../ComponentPropertyToPolicyDeclaratorTest.java | 2 +- .../property/PolicyPropertyDeceleratorTest.java | 2 +- .../property/PolicyPropertyDeclaratorTest.java | 2 +- ...nentInstancePropertyToPolicyDeclaratorTest.java | 5 +- .../upgrade/UpgradeBusinessLogicTest.java | 11 +- .../validation/AnnotationValidatorTest.java | 4 +- .../validation/ComponentValidationsTest.java | 2 +- .../ServiceDistributionValidationTest.java | 2 +- .../PropertyValueConstraintValidationUtilTest.java | 28 +-- .../servlet/ExternalRefServletTest.java | 58 +++--- .../sdc/be/servlets/ArchiveEndpointTest.java | 81 ++++---- .../be/servlets/AutomatedUpgradeEndpointTest.java | 13 +- .../sdc/be/servlets/GroupEndpointTest.java | 2 +- .../sdc/be/servlets/GroupTypesEndpointTest.java | 19 +- .../sdc/be/servlets/PolicyServletTest.java | 2 +- .../sdc/be/servlets/TypesUploadEndpointTest.java | 46 +++-- .../tosca/CapabilityRequirementConverterTest.java | 4 +- .../org/openecomp/sdc/be/tosca/CsarUtilsTest.java | 6 +- .../sdc/be/tosca/ToscaExportHandlerTest.java | 11 +- .../sdc/be/user/UserBusinessLogicTest.java | 11 +- .../transaction/mngr/SdncTransactionTest.java | 150 ++++++++------ .../resources/config/catalog-be/configuration.yaml | 14 +- .../src/test/resources/paths/path-context.xml | 8 +- 199 files changed, 1580 insertions(+), 1538 deletions(-) create mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java create mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java delete mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java delete mode 100644 catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java create mode 100644 catalog-be/src/main/resources/config/janusgraph.properties delete mode 100644 catalog-be/src/main/resources/config/titan.properties create mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java delete mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java create mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java delete mode 100644 catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java (limited to 'catalog-be/src') 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 04df614b9d..7b3d4fac25 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 @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.components.impl.NodeFilterUploadCreator; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -67,13 +67,13 @@ public class YamlTemplateParsingHandler { private Gson gson = new Gson(); - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; private GroupTypeBusinessLogic groupTypeBusinessLogic; private AnnotationBusinessLogic annotationBusinessLogic; - public YamlTemplateParsingHandler(TitanDao titanDao, + public YamlTemplateParsingHandler(JanusGraphDao janusGraphDao, GroupTypeBusinessLogic groupTypeBusinessLogic, AnnotationBusinessLogic annotationBusinessLogic) { - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; this.groupTypeBusinessLogic = groupTypeBusinessLogic; this.annotationBusinessLogic = annotationBusinessLogic; } @@ -865,17 +865,17 @@ public class YamlTemplateParsingHandler { } private Map failIfNoNodeTemplates(String fileName) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, fileName); } private Object failIfNotTopologyTemplate(String fileName) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(ActionStatus.NOT_TOPOLOGY_TOSCA_TEMPLATE, fileName); } private void rollbackWithException(ActionStatus actionStatus, String... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, params); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java index 0303b3f5e7..04c4d11679 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IArtifactOperation; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.common.api.ArtifactTypeEnum; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java index c0a89d6954..00efd80200 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java @@ -31,7 +31,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.impl.EsHealthCheckDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector; import org.openecomp.sdc.common.api.HealthCheckInfo; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; @@ -78,7 +78,7 @@ public class HealthCheckBusinessLogic { private final ScheduledExecutorService healthCheckScheduler = newSingleThreadScheduledExecutor((Runnable r) -> new Thread(r, "BE-Health-Check-Task")); private HealthCheckScheduledTask healthCheckScheduledTask = null; @Resource - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; @Resource private EsHealthCheckDao esHealthCheckDao; @Resource @@ -130,8 +130,8 @@ public class HealthCheckBusinessLogic { // BE getBeHealthCheck(healthCheckInfos); - // Titan - getTitanHealthCheck(healthCheckInfos); + // JanusGraph + getJanusGraphHealthCheck(healthCheckInfos); // ES getEsHealthCheck(healthCheckInfos); @@ -195,25 +195,25 @@ public class HealthCheckBusinessLogic { } - public List getTitanHealthCheck(List healthCheckInfos) { - // Titan health check and version + public List getJanusGraphHealthCheck(List healthCheckInfos) { + // JanusGraph health check and version String description; - boolean isTitanUp; + boolean isJanusGraphUp; try { - isTitanUp = titanGenericDao.isGraphOpen(); + isJanusGraphUp = janusGraphGenericDao.isGraphOpen(); } catch (Exception e) { - description = "Titan error: "; - healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, DOWN, null, description)); + description = "JanusGraph error: "; + healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, DOWN, null, description)); log.error(description, e); return healthCheckInfos; } - if (isTitanUp) { + if (isJanusGraphUp) { description = "OK"; - healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, UP, null, description)); + healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, UP, null, description)); } else { - description = "Titan graph is down"; - healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_TITAN, DOWN, null, description)); + description = "JanusGraph graph is down"; + healthCheckInfos.add(new HealthCheckInfo(HC_COMPONENT_JANUSGRAPH, DOWN, null, description)); } return healthCheckInfos; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java index 7f6565c88e..19e696c07a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.WebAppContextWrapper; @@ -471,9 +471,9 @@ public class AdditionalInformationBusinessLogic extends BaseBusinessLogic { try { - Either findIdRes = additionalInformationOperation.getAllAdditionalInformationParameters(nodeType, resourceId, false); + Either findIdRes = additionalInformationOperation.getAllAdditionalInformationParameters(nodeType, resourceId, false); if (findIdRes.isRight()) { - StorageOperationStatus status = DaoStatusConverter.convertTitanStatusToStorageStatus(findIdRes.right().value()); + StorageOperationStatus status = DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findIdRes.right().value()); ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForAdditionalInformation(status); result = Either.right(componentsUtils.getResponseFormatAdditionalProperty(actionStatus)); } else { 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 3cf520d30e..c836e91b9b 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 @@ -26,7 +26,7 @@ import fj.data.Either; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -34,8 +34,8 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.catalog.CatalogComponent; -import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; @@ -49,14 +49,14 @@ public class ArchiveBusinessLogic { private static final Logger log = Logger.getLogger(ArchiveBusinessLogic.class.getName()); - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; private final AccessValidations accessValidations; private final ArchiveOperation archiveOperation; private final ToscaOperationFacade toscaOperationFacade; private final ComponentsUtils componentUtils; - public ArchiveBusinessLogic(TitanDao titanDao, AccessValidations accessValidations, ArchiveOperation archiveOperation, ToscaOperationFacade tof, ComponentsUtils componentsUtils) { - this.titanDao = titanDao; + public ArchiveBusinessLogic(JanusGraphDao janusGraphDao, AccessValidations accessValidations, ArchiveOperation archiveOperation, ToscaOperationFacade tof, ComponentsUtils componentsUtils) { + this.janusGraphDao = janusGraphDao; this.accessValidations = accessValidations; this.archiveOperation = archiveOperation; this.toscaOperationFacade = tof; @@ -143,7 +143,7 @@ public class ArchiveBusinessLogic { throw e; } finally { - titanDao.commit(); + janusGraphDao.commit(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index f23057cad0..dcc6eee01a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -73,7 +73,7 @@ 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.heat.HeatParameterType; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IHeatParametersOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; @@ -652,13 +652,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (resultOp == null || resultOp.isRight()) { log.debug(ROLLBACK); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } } else { log.debug(COMMIT); if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } if (shouldLock) { @@ -804,11 +804,11 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { // unlock resource if (resultOp == null || resultOp.isRight()) { log.debug(ROLLBACK); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(COMMIT); - titanDao.commit(); + janusGraphDao.commit(); } componentType = component.getComponentType(); @@ -4072,7 +4072,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (saveArtifactStatus.equals(CassandraOperationStatus.OK)) { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } log.debug("Artifact Saved In ES {}", artifactData.getId()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK); @@ -4083,7 +4083,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } else { if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } log.info("Failed to save artifact {}.", artifactData.getId()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR); @@ -4228,13 +4228,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (resultOp == null || resultOp.isRight()) { log.debug(ROLLBACK); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } } else { log.debug(COMMIT); if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } if (shouldLock) { 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 c77223ba59..8a4b761a5a 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 @@ -38,9 +38,9 @@ import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; @@ -59,9 +59,9 @@ import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; -import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; @@ -108,10 +108,10 @@ public abstract class BaseBusinessLogic { protected IGraphLockOperation graphLockOperation; @Autowired - protected TitanDao titanDao; + protected JanusGraphDao janusGraphDao; @Autowired - protected TitanGenericDao titanGenericDao; + protected JanusGraphGenericDao janusGraphGenericDao; @Autowired protected IElementOperation elementDao; @@ -283,9 +283,9 @@ public abstract class BaseBusinessLogic { NodeTypeEnum nodeType = componentType.getNodeType(); if (!inTransaction) { if (either == null || either.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -339,11 +339,11 @@ public abstract class BaseBusinessLogic { } Either updateInputPropertyObjectValue(T property) { - Either, TitanOperationStatus> allDataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypesEither = dataTypeCache.getAll(); if (allDataTypesEither.isRight()) { - TitanOperationStatus status = allDataTypesEither.right().value(); + JanusGraphOperationStatus status = allDataTypesEither.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } Map allDataTypes = allDataTypesEither.left().value(); String propertyType = property.getType(); @@ -356,7 +356,8 @@ public abstract class BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (Boolean.FALSE.equals(res)) { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } else { Object object = isValid.left().value(); @@ -429,15 +430,15 @@ public abstract class BaseBusinessLogic { } // For UT - public void setTitanGenericDao(TitanDao titanDao) { - this.titanDao = titanDao; + public void setJanusGraphGenericDao(JanusGraphDao janusGraphDao) { + this.janusGraphDao = janusGraphDao; } protected Either, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) { - Either, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus operationStatus = allDataTypes.right().value(); - if (operationStatus == TitanOperationStatus.NOT_FOUND) { + JanusGraphOperationStatus operationStatus = allDataTypes.right().value(); + if (operationStatus == JanusGraphOperationStatus.NOT_FOUND) { BeEcompErrorManager.getInstance().logInternalDataError("FetchDataTypes", "Data types are not loaded", ErrorSeverity.ERROR); return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)); } else { @@ -536,10 +537,10 @@ public abstract class BaseBusinessLogic { void commitOrRollback(Either result) { if (result == null || result.isRight()) { log.warn("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } @@ -587,7 +588,8 @@ public abstract class BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (Boolean.FALSE.equals(res)) { - throw new StorageException(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)); + throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)); } } else { Object object = isValid.left().value(); @@ -599,7 +601,8 @@ public abstract class BaseBusinessLogic { log.trace("After validateAndUpdateRules. pair = {}", pair); if (Boolean.FALSE.equals(pair.getRight())) { BeEcompErrorManager.getInstance().logBeInvalidValueError(ADD_PROPERTY_VALUE, pair.getLeft(), property.getName(), propertyType); - throw new StorageException(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)); + throw new StorageException(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)); } return newValue; } @@ -625,7 +628,7 @@ public abstract class BaseBusinessLogic { private void failOnIllegalArgument() { throw new ByActionStatusComponentException( componentsUtils.convertFromStorageResponse( - DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT))); + DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT))); } public Either validateAndUpdatePropertyValue(String propertyType, String value, boolean isValidate, String innerType, Map dataTypes) { @@ -712,7 +715,7 @@ public abstract class BaseBusinessLogic { } protected void rollbackWithException(ActionStatus actionStatus, String... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, params); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java index f2fd37704d..425458f518 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java @@ -23,7 +23,7 @@ import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.validation.CapabilitiesValidation; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -33,8 +33,8 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.CapabilitiesOperation; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CapabilitiesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -94,7 +94,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { try { return createCapability(componentId, capabilityDefinitions, storedComponent); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -151,7 +151,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { result = capabilitiesOperation.addCapabilities(componentId, capabilitiesToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result .right().value(), storedComponent.getComponentType()), "")); } @@ -161,11 +161,11 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { StorageOperationStatus storageOperationStatus = capabilitiesOperation .createOrUpdateCapabilityProperties(componentId, propertiesMap); if (storageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(storageOperationStatus)); } } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(capabilitiesToReturn); } @@ -242,7 +242,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { result = capabilitiesOperation.addCapabilities(componentId, capabilitiesToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result .right().value(), storedComponent.getComponentType()), "")); } @@ -252,14 +252,14 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { StorageOperationStatus storageOperationStatus = capabilitiesOperation .createOrUpdateCapabilityProperties(componentId, propertiesMap); if (storageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(storageOperationStatus)); } } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(capabilitiesToReturn); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -292,13 +292,13 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteCapabilityEither = deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDelete); if (deleteCapabilityEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteCapabilityEither.right().value())); } StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation .deleteCapabilityProperties(storedComponent, buildCapPropKey(capabilityDefinitionToDelete)); if (deleteStorageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteStorageOperationStatus)); } capabilitiesToReturn.add(initiateNewCapability(storedComponent, capabilityDefinitionToUpdate)); @@ -334,13 +334,13 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteCapabilityEither = deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDelete); if (deleteCapabilityEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteCapabilityEither.right().value())); } StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation .deleteCapabilityProperties(storedComponent, buildCapPropKey(capabilityDefinitionToDelete)); if (deleteStorageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteStorageOperationStatus)); } } @@ -416,7 +416,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { return deleteCapability(capabilityIdToDelete, storedComponent); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_CAPABILITIES, "delete", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.CAPABILITY_NOT_FOUND)); } finally { if (lockResult.isLeft() && lockResult.left().value()) { @@ -441,14 +441,14 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> result = deleteCapability(storedComponent, storedComponentCapabilities, capabilityDefinitionToDeleteEither.left().value()); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error("Failed to delete capability from component {}. Response is {}", storedComponent.getName(), result.right().value()); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()))); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(capabilityDefinitionToDeleteEither.left().value()); } @@ -528,7 +528,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { if (lockResult.isRight()) { LOGGER.debug(FAILED_TO_LOCK_COMPONENT_RESPONSE_IS, component.getName(), lockResult.right().value().getFormattedMessage()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(lockResult.right().value()); } } @@ -584,7 +584,7 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { StorageOperationStatus deleteStorageOperationStatus = capabilitiesOperation .deleteCapabilityProperties(component, buildCapPropKey(storedCapability)); if (deleteStorageOperationStatus != StorageOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); } } @@ -605,11 +605,11 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { } public Either, ResponseFormat> getAllCapabilityTypes() { - Either, TitanOperationStatus> capabilityTypeCacheAll = + Either, JanusGraphOperationStatus> capabilityTypeCacheAll = capabilityTypeOperation.getAllCapabilityTypes(); if (capabilityTypeCacheAll.isRight()) { - TitanOperationStatus operationStatus = capabilityTypeCacheAll.right().value(); - if (TitanOperationStatus.NOT_FOUND == operationStatus) { + JanusGraphOperationStatus operationStatus = capabilityTypeCacheAll.right().value(); + if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) { BeEcompErrorManager.getInstance().logInternalDataError("FetchCapabilityTypes", "Capability types are not loaded", BeEcompErrorManager.ErrorSeverity.ERROR); return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java index bc5f77ba1b..c77877fac4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CassandraHealthCheck.java @@ -68,20 +68,21 @@ public class CassandraHealthCheck { sdcKeyspaces.add(table.getTableDescription().getKeyspace()); } - String titanCfgFile = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanCfgFile(); + String janusGraphCfgFile = ConfigurationManager.getConfigurationManager() + .getConfiguration().getJanusGraphCfgFile(); Properties prop = new Properties(); - InputStream titanProp = null; + InputStream janusGraphProp = null; try { //load a properties file - titanProp = new FileInputStream(titanCfgFile); - prop.load(titanProp); - //Add titan keyspace - String titanKeyspace = prop.getProperty("storage.cassandra.keyspace"); - if (!GeneralUtility.isEmptyString(titanKeyspace)) { - sdcKeyspaces.add(titanKeyspace); + janusGraphProp = new FileInputStream(janusGraphCfgFile); + prop.load(janusGraphProp); + //Add janusgraph keyspace + String janusGraphKeyspace = prop.getProperty("storage.cassandra.keyspace"); + if (!GeneralUtility.isEmptyString(janusGraphKeyspace)) { + sdcKeyspaces.add(janusGraphKeyspace); } } catch (Exception e) { - log.error("Failed to open titen.properties file , url is : {}", titanCfgFile, e); + log.error("Failed to open titen.properties file , url is : {}", janusGraphCfgFile, e); } log.info("All sdc keyspaces are : {}", sdcKeyspaces); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java index d2f845cc00..1de92e2e15 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java @@ -237,17 +237,17 @@ public class CommonImportManager { typeOperations.addType(newTypeDefinition); } else { if (typeOperations.isSameType(newTypeDefinition, existingDefinition)) { - propertyOperation.getTitanGenericDao().rollback(); + propertyOperation.getJanusGraphGenericDao().rollback(); createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, null)); continue; } else { typeOperations.updateType(existingDefinition, newTypeDefinition); } } - propertyOperation.getTitanGenericDao().commit(); + propertyOperation.getJanusGraphGenericDao().commit(); createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, true)); } catch (Exception e) { - propertyOperation.getTitanGenericDao().rollback(); + propertyOperation.getJanusGraphGenericDao().rollback(); createdElementTypes.add(new ImmutablePair<>(newTypeDefinition, false)); } @@ -287,10 +287,10 @@ public class CommonImportManager { } finally { if (eitherResult.isLeft()) { - propertyOperation.getTitanGenericDao().commit(); + propertyOperation.getJanusGraphGenericDao().commit(); } else { - propertyOperation.getTitanGenericDao().rollback(); + propertyOperation.getJanusGraphGenericDao().rollback(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java index dcd0c7b7f0..18d8688036 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java @@ -561,7 +561,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return Either.left(result); } finally{ - titanDao.commit(); + janusGraphDao.commit(); } } @@ -596,7 +596,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { } responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(nonCheckoutCompResponse.right().value())); } finally { - titanDao.commit(); + janusGraphDao.commit(); } return Either.right(responseFormat); } @@ -771,12 +771,12 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { if ( deleteMarkedElements.isRight()){ - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(deleteMarkedElements.right().value(), componentType)); return Either.right(responseFormat); } log.trace("end deleteMarkedComponents"); - titanDao.commit(); + janusGraphDao.commit(); return Either.left(deleteMarkedElements.left().value()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 71b125737e..eebbb0a2bf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -37,7 +37,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil; import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; @@ -76,10 +76,10 @@ import org.openecomp.sdc.be.model.RequirementDefinition; 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.jsontitan.operations.ForwardingPathOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeFilterOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.IComponentInstanceOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; @@ -1042,13 +1042,13 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (deleteServiceFilterEither.isRight()) { ActionStatus status = componentsUtils.convertFromStorageResponse(deleteServiceFilterEither.right().value(), containerComponentType); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(status, componentInstanceId)); } resultOp = deleteServiceFiltersRelatedTobeDeletedComponentInstance((Service) containerComponent, componentInstance, ComponentTypeEnum.SERVICE, userId); if (resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return resultOp; } } @@ -1672,9 +1672,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { finally { if (result == null || result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -1800,9 +1800,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -1926,11 +1926,11 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } private Either updatePropertyObjectValue(T property, boolean isInput) { - Either, TitanOperationStatus> allDataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypesEither = dataTypeCache.getAll(); if (allDataTypesEither.isRight()) { - TitanOperationStatus status = allDataTypesEither.right().value(); + JanusGraphOperationStatus status = allDataTypesEither.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } Map allDataTypes = allDataTypesEither.left().value(); String innerType = null; @@ -1957,7 +1957,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (!res) { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } else { Object object = isValid.left().value(); @@ -1969,7 +1969,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { ImmutablePair pair = propertyOperation.validateAndUpdateRules(propertyType, ((ComponentInstanceProperty) property).getRules(), innerType, allDataTypes, true); if (pair.getRight() != null && pair.getRight() == false) { BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), property.getName(), propertyType); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } return Either.left(newValue); @@ -2052,9 +2052,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -2147,9 +2147,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -2236,9 +2236,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(componentId, componentTypeEnum.getNodeType()); @@ -2292,9 +2292,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(serviceId, componentTypeEnum.getNodeType()); @@ -2894,11 +2894,11 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(lockStatus))); } - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } try { @@ -2920,9 +2920,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType()); @@ -2982,9 +2982,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } // unlock resource graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType()); @@ -3028,7 +3028,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { // on failure of the create instance unlock the resource and rollback the transaction. if (null == actionResponse || actionResponse.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } unlockComponent(actionResponse, origComponent); } @@ -3053,10 +3053,10 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } finally { if (resultOp == null || resultOp.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); log.debug("Success trasaction commit"); } // unlock resource diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java index 3ddfe4bfc4..a1a6555630 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypesService.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.components.impl; import fj.data.Either; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; @@ -22,10 +22,10 @@ public class DataTypesService { } public Either, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) { - Either, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus operationStatus = allDataTypes.right().value(); - if (operationStatus == TitanOperationStatus.NOT_FOUND) { + JanusGraphOperationStatus operationStatus = allDataTypes.right().value(); + if (operationStatus == JanusGraphOperationStatus.NOT_FOUND) { BeEcompErrorManager.getInstance().logInternalDataError("FetchDataTypes", "Data types are not loaded", BeEcompErrorManager.ErrorSeverity.ERROR); return Either.right(componentsUtils.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)); } else { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java index 746f4e9c27..91d7fa6034 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java @@ -32,10 +32,10 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; 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; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum; import org.openecomp.sdc.be.datamodel.utils.NodeTypeConvertUtils; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; @@ -250,7 +250,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resources.right().value()))); } } finally { - titanDao.commit(); + janusGraphDao.commit(); } } @@ -999,7 +999,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { .bimap(this::groupByComponentType, err -> componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(err))); } finally { - titanDao.commit(); + janusGraphDao.commit(); } } @@ -1229,10 +1229,11 @@ public class ElementBusinessLogic extends BaseBusinessLogic { } CategoryData categoryData = categoryResult.left().value(); - Either>, TitanOperationStatus> childrenNodes = titanGenericDao.getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(), + Either>, JanusGraphOperationStatus> childrenNodes = janusGraphGenericDao + .getChildrenNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceNewCategory), (String) categoryData.getUniqueId(), GraphEdgeLabels.SUB_CATEGORY, NodeTypeEnum.ResourceSubcategory, SubCategoryData.class); if (childrenNodes.isRight()) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenNodes.right().value())); + return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(childrenNodes.right().value())); } return Either.left(childrenNodes.left().value()); } @@ -1248,7 +1249,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return collectComponents(neededType, categoryUid, categoryType, clazz, resourceType); } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } @@ -1260,7 +1261,8 @@ public class ElementBusinessLogic extends BaseBusinessLogic { Class categoryClazz = categoryType == NodeTypeEnum.ServiceNewCategory ? CategoryData.class : SubCategoryData.class; Map props = new HashMap<>(); props.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), ValidationUtils.normalizeCategoryName4Uniqueness(categoryName)); - Either, TitanOperationStatus> getCategory = titanGenericDao.getByCriteria(categoryType, props, categoryClazz); + Either, JanusGraphOperationStatus> getCategory = janusGraphGenericDao + .getByCriteria(categoryType, props, categoryClazz); if (getCategory.isRight()) { return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND); } @@ -1275,7 +1277,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return Either.left(components); } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } @@ -1283,7 +1285,8 @@ public class ElementBusinessLogic extends BaseBusinessLogic { private Either, StorageOperationStatus> collectComponents(NodeTypeEnum neededType, String categoryUid, NodeTypeEnum categoryType, Class clazz, ResourceTypeEnum resourceType) { List components = new ArrayList<>(); - Either>, TitanOperationStatus> parentNodes = titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(categoryType), categoryUid, GraphEdgeLabels.CATEGORY, neededType, clazz); + Either>, JanusGraphOperationStatus> parentNodes = janusGraphGenericDao + .getParentNodes(UniqueIdBuilder.getKeyByNodeType(categoryType), categoryUid, GraphEdgeLabels.CATEGORY, neededType, clazz); if (parentNodes.isLeft()) { for (ImmutablePair component : parentNodes.left().value()) { ComponentMetadataDataDefinition componentData = component.getLeft().getMetadataDataDefinition(); @@ -1359,7 +1362,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return result; } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java index 0b53da0018..d3037a9e53 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ExternalRefsBusinessLogic.java @@ -8,8 +8,8 @@ import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.dto.ExternalRefDTO; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java index 9bab155cdf..7c5a596319 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java @@ -41,7 +41,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.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; @@ -54,8 +54,8 @@ import org.openecomp.sdc.be.info.GroupDefinitionInfo; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.PropertyDefinition.GroupInstancePropertyValueUpdateBehavior; import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -71,8 +71,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import static java.util.stream.Collectors.toList; -import static org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter.extractCapabilitiesFromGroups; -import static org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter.extractCapabilityPropertiesFromGroups; +import static org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter.extractCapabilitiesFromGroups; +import static org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter.extractCapabilityPropertiesFromGroups; @org.springframework.stereotype.Component("groupBusinessLogic") public class GroupBusinessLogic extends BaseBusinessLogic { @@ -247,9 +247,9 @@ public class GroupBusinessLogic extends BaseBusinessLogic { } finally { if (result != null && result.isLeft()) { - titanDao.commit(); + janusGraphDao.commit(); } else { - titanDao.rollback(); + janusGraphDao.rollback(); } if (shouldLock) { graphLockOperation.unlockComponent(componentId, componentType.getNodeType()); @@ -488,10 +488,10 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (result == null || result.isRight()) { log.debug("Going to execute rollback on create group."); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("Going to execute commit on create group."); - titanDao.commit(); + janusGraphDao.commit(); } } @@ -718,10 +718,10 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (result == null || result.isRight()) { log.debug("Going to execute rollback on create group."); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("Going to execute commit on create group."); - titanDao.commit(); + janusGraphDao.commit(); } } @@ -1109,12 +1109,12 @@ public class GroupBusinessLogic extends BaseBusinessLogic { } private List onFailedGroupDBOperation(ResponseFormat responseFormat) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByResponseFormatComponentException(responseFormat); } private GroupDefinition onFailedUpdateGroupDBOperation(ResponseFormat responseFormat) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByResponseFormatComponentException(responseFormat); } @@ -1132,7 +1132,7 @@ public class GroupBusinessLogic extends BaseBusinessLogic { log.debug("#updatePolicyTargetReferencingDeletedGroup - removing all component {} policy targets referencing group {}", component.getUniqueId(), groupId); ActionStatus actionStatus = policyTargetsUpdateHandler.removePoliciesTargets(component, groupId, PolicyTargetType.GROUPS); if (ActionStatus.OK != actionStatus) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, groupId); } } @@ -1143,11 +1143,11 @@ public class GroupBusinessLogic extends BaseBusinessLogic { Map groups = new HashMap<>(); Either, ResponseFormat> result = null; Either, StorageOperationStatus> createGroupsResult = null; - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to add property to group. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } @@ -1213,11 +1213,11 @@ public class GroupBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> createGroupsResult = null; List groups = new ArrayList<>(); - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to add property to group. Status is " + status, ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } @@ -1331,18 +1331,18 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (CollectionUtils.isNotEmpty(properties)) { if (CollectionUtils.isEmpty(groupTypeProperties)) { BeEcompErrorManager.getInstance().logInvalidInputError(ADDING_GROUP, "group type does not have properties", ErrorSeverity.INFO); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.MATCH_NOT_FOUND)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(JanusGraphOperationStatus.MATCH_NOT_FOUND)))); } Map groupTypePropertiesMap = groupTypeProperties.stream().collect(Collectors.toMap(PropertyDefinition::getName, p -> p)); - Either addPropertyResult; + Either addPropertyResult; int i = 1; for (GroupProperty prop : properties) { addPropertyResult = handleProperty(prop, groupTypePropertiesMap.get(prop.getName()), i, allDAtaTypes, groupType); if (addPropertyResult.isRight()) { BeEcompErrorManager.getInstance().logInvalidInputError(ADDING_GROUP, "failed to validate property", ErrorSeverity.INFO); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertyResult.right().value())))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(addPropertyResult.right().value())))); } updatedGroupTypeProperties.add(addPropertyResult.left().value()); @@ -1372,18 +1372,18 @@ public class GroupBusinessLogic extends BaseBusinessLogic { return found; } - private Either handleProperty(GroupProperty groupProperty, PropertyDefinition prop, Integer index, Map allDataTypes, String groupType) { + private Either handleProperty(GroupProperty groupProperty, PropertyDefinition prop, Integer index, Map allDataTypes, String groupType) { if (prop == null) { - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } String propertyType = prop.getType(); String value = groupProperty.getValue(); - Either checkInnerType = propertyOperation.checkInnerType(prop); + Either checkInnerType = propertyOperation.checkInnerType(prop); if (checkInnerType.isRight()) { - TitanOperationStatus status = checkInnerType.right().value(); + JanusGraphOperationStatus status = checkInnerType.right().value(); return Either.right(status); } @@ -1397,7 +1397,7 @@ public class GroupBusinessLogic extends BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (!res) { - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } } else { Object object = isValid.left().value(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java index b234bb6bd6..5a5e941c24 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicNew.java @@ -34,7 +34,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GroupOperation; 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 5bc0e5e3c3..80d6d65a06 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 @@ -26,7 +26,7 @@ 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -43,13 +43,13 @@ import static java.util.Collections.emptySet; public class GroupTypeBusinessLogic { private final GroupTypeOperation groupTypeOperation; - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; private final UserValidations userValidations; private final ComponentsUtils componentsUtils; - public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, TitanDao titanDao, UserValidations userValidations, ComponentsUtils componentsUtils) { + public GroupTypeBusinessLogic(GroupTypeOperation groupTypeOperation, JanusGraphDao janusGraphDao, UserValidations userValidations, ComponentsUtils componentsUtils) { this.groupTypeOperation = groupTypeOperation; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; this.userValidations = userValidations; this.componentsUtils = componentsUtils; } @@ -61,7 +61,7 @@ public class GroupTypeBusinessLogic { Set excludeGroupTypes = getExcludedGroupTypes(internalComponentType); return groupTypeOperation.getAllGroupTypes(excludeGroupTypes); } finally { - titanDao.commit(); + janusGraphDao.commit(); } } @@ -81,7 +81,7 @@ public class GroupTypeBusinessLogic { } private GroupTypeDefinition failOnGetGroupType(StorageOperationStatus status, String groupType) { - titanDao.rollback(); + janusGraphDao.rollback(); if (status == StorageOperationStatus.NOT_FOUND) { throw new ByActionStatusComponentException(ActionStatus.GROUP_TYPE_IS_INVALID, groupType); } else { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java index 4a7b080fbc..0be6ed9c3a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; import org.openecomp.sdc.be.model.utils.TypeCompareUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 0936472bb7..8aec0cdfe2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -43,7 +43,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.property.PropertyDeclarationOrchestrator; import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -241,7 +241,8 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (isValid.isRight()) { Boolean res = isValid.right().value(); if (Boolean.FALSE.equals(res)) { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus( + JanusGraphOperationStatus.ILLEGAL_ARGUMENT)))); } } else { Object object = isValid.left().value(); @@ -342,10 +343,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (!inTransaction) { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -442,10 +443,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (!inTransaction) { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -529,10 +530,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (!inTransaction) { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } // unlock resource @@ -771,10 +772,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } finally { if (deleteEither == null || deleteEither.isRight()) { log.debug("Component id: {} delete input id: {} failed", componentId, inputId); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("Component id: {} delete input id: {} success", componentId, inputId); - titanDao.commit(); + janusGraphDao.commit(); } unlockComponent(deleteEither, component); } @@ -882,10 +883,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if (result == null || result.isRight()) { log.debug(GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug(GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP); - titanDao.commit(); + janusGraphDao.commit(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java index 5cdaa6a590..7815b81755 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java @@ -139,7 +139,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { NodeTypeEnum.getByNameIgnoreCase(storedComponent.getComponentType().getValue()), true); if(removeArifactFromComponent.isRight()){ - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()), storedOperation.getImplementation().getArtifactDisplayName()); @@ -148,7 +148,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId); if (cassandraStatus != CassandraOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse( componentsUtils.convertToStorageOperationStatus(cassandraStatus)), @@ -166,7 +166,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { interfaceOperation.updateInterfaces(storedComponent.getUniqueId(), Collections.singletonList(interfaceDefinition)); if (deleteOperationEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( deleteOperationEither.right().value(), storedComponent.getComponentType()))); } @@ -175,19 +175,19 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { Either deleteInterfaceEither = interfaceOperation.deleteInterface( storedComponent.getUniqueId(), interfaceDefinition.getUniqueId()); if (deleteInterfaceEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( deleteInterfaceEither.right().value(), storedComponent.getComponentType()))); } } - titanDao.commit(); + janusGraphDao.commit(); interfaceDefinition.getOperations().putAll(operationsCollection); interfaceDefinition.getOperations().keySet().removeIf(key -> !(operationsToDelete.contains(key))); return Either.left(Collections.singletonList(interfaceDefinition)); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "delete", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_DELETED)); } finally { if (lockResult.isLeft() && lockResult.left().value()) { @@ -212,7 +212,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { if (lock) { Either lockResult = lockComponent(component.getUniqueId(), component, action); if (lockResult.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(lockResult.right().value()); } } @@ -253,12 +253,12 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { } } - titanDao.commit(); + janusGraphDao.commit(); interfaceDefinition.getOperations().keySet().removeIf(key -> !(operationsToGet.contains(key))); return Either.left(Collections.singletonList(interfaceDefinition)); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "get", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right( componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, componentId)); } finally { @@ -335,7 +335,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { getOperationFromInterfaceDefinition(interfaceDef, operation.getUniqueId()); if (!optionalOperation.isPresent()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils .getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND, storedComponent.getUniqueId())); @@ -354,7 +354,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { NodeTypeEnum.getByNameIgnoreCase(storedComponent.getComponentType().getValue()), true); if(removeArifactFromComponent.isRight()){ - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse(removeArifactFromComponent.right().value()), storedOperation.getImplementation().getArtifactDisplayName()); @@ -363,7 +363,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(artifactUniqueId); if (cassandraStatus != CassandraOperationStatus.OK) { - titanDao.rollback(); + janusGraphDao.rollback(); ResponseFormat responseFormatByArtifactId = componentsUtils.getResponseFormatByArtifactId( componentsUtils.convertFromStorageResponse( @@ -383,18 +383,18 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> addCreateOperationEither = interfaceOperation.updateInterfaces(storedComponent.getUniqueId(), interfacesCollection); if (addCreateOperationEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( addCreateOperationEither.right().value(), storedComponent.getComponentType()))); } - titanDao.commit(); + janusGraphDao.commit(); interfacesCollection.forEach(interfaceDefinition -> interfaceDefinition.getOperations().entrySet().removeIf( entry -> !operationsCollection.values().stream().map(OperationDataDefinition::getName) .collect(Collectors.toList()).contains(entry.getValue().getName()))); return Either.left(interfacesCollection); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -431,7 +431,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { interfaceOperation.addInterfaces(component.getUniqueId(), Collections.singletonList(interfaceDefinition)); if (interfaceCreateEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( interfaceCreateEither.right().value(), component.getComponentType()))); } @@ -580,7 +580,7 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_INTERFACE_OPERATION, "get", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.INTERFACE_OPERATION_NOT_FOUND)); } finally { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java index 752ec4098a..54b7d2ea02 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java @@ -398,7 +398,7 @@ public class PolicyBusinessLogic extends BaseBusinessLogic { .left() .bind(cmpt -> getPolicyById(cmpt, policyId)).left().map(PolicyDataDefinition::getProperties); } finally { - titanDao.commit(); + janusGraphDao.commit(); } } 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 cb4b6ff58c..a59156cd87 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 @@ -4,7 +4,7 @@ import fj.data.Either; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -25,13 +25,13 @@ public class PolicyTypeBusinessLogic { private static final Logger log = Logger.getLogger(PolicyTypeBusinessLogic.class); private PolicyTypeOperation policyTypeOperation; - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; private ComponentsUtils componentsUtils; private UserValidations userValidations; - public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, TitanDao titanDao, ComponentsUtils componentsUtils, UserValidations userValidations) { + public PolicyTypeBusinessLogic(PolicyTypeOperation policyTypeOperation, JanusGraphDao janusGraphDao, ComponentsUtils componentsUtils, UserValidations userValidations) { this.policyTypeOperation = policyTypeOperation; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; this.componentsUtils = componentsUtils; this.userValidations = userValidations; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java index edd3b936a2..d0dc9fe7c0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java @@ -29,7 +29,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PolicyTypeDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IGroupOperation; import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.IPolicyTypeOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java index 30a9f799fe..ff532b237d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java @@ -232,7 +232,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { validateUserExists(userId, "validate Product Name Exists", false); Either dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(productName, null, ComponentTypeEnum.PRODUCT); // DE242223 - titanDao.commit(); + janusGraphDao.commit(); if (dataModelResponse.isLeft()) { Map result = new HashMap<>(); @@ -378,7 +378,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { for (Map.Entry>> entry : nonDuplicatedCategories.entrySet()) { catExist = false; CategoryDefinition categoryDefinition = null; - // over all categories from Titan + // over all categories from JanusGraph List categoriesList = allProductCategories.left().value(); if (categoriesList != null) { for (CategoryDefinition catInDb : categoriesList) { @@ -415,7 +415,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { } if (!groupExist) { // error grouping isn't defined - // in Titan + // in JanusGraph ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.GROUPING.getValue(), group); componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT); return Either.right(responseFormat); @@ -426,7 +426,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { } } if (!subcatExist) { - // error sub category isn't defined in Titan + // error sub category isn't defined in JanusGraph ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.SUBCATEGORY.getValue(), subcat.getKey()); componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT); return Either.right(responseFormat); @@ -437,7 +437,7 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { } } if (!catExist) { - // error category isn't defined in Titan + // error category isn't defined in JanusGraph ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.INVALID_GROUP_ASSOCIATION, CategoryTypeEnum.CATEGORY.getValue(), entry.getKey()); componentsUtils.auditComponentAdmin(responseFormat, user, product, actionEnum, ComponentTypeEnum.PRODUCT); return Either.right(responseFormat); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java index 275d1726ed..f3a40ad9f7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java @@ -34,7 +34,7 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; @@ -489,7 +489,7 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { } String innerType; - Either checkInnerType = getInnerType(type, propertyDefinition::getSchema); + Either checkInnerType = getInnerType(type, propertyDefinition::getSchema); if (checkInnerType.isRight()) { return StorageOperationStatus.INVALID_TYPE; } @@ -551,19 +551,19 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { return jsonElement.toString(); } - private Either getInnerType(ToscaPropertyType type, Supplier schemeGen) { + private Either getInnerType(ToscaPropertyType type, Supplier schemeGen) { String innerType = null; if (type == ToscaPropertyType.LIST || type == ToscaPropertyType.MAP) { SchemaDefinition def = schemeGen.get(); if (def == null) { log.debug("Schema doesn't exists for property of type {}", type); - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } PropertyDataDefinition propDef = def.getProperty(); if (propDef == null) { log.debug("Property in Schema Definition inside property of type {} doesn't exist", type); - return Either.right(TitanOperationStatus.ILLEGAL_ARGUMENT); + return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); } innerType = propDef.getType(); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java index 4a909785b2..695d82f5d9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java @@ -21,7 +21,7 @@ import java.util.Map; import fj.data.Either; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.RelationshipTypeDefinition; import org.openecomp.sdc.be.model.operations.impl.RelationshipTypeOperation; @@ -39,11 +39,11 @@ public class RelationshipTypeBusinessLogic { protected ComponentsUtils componentsUtils; public Either, ResponseFormat> getAllRelationshipTypes() { - Either, TitanOperationStatus> allRelationshipTypes = + Either, JanusGraphOperationStatus> allRelationshipTypes = relationshipTypeOperation.getAllRelationshipTypes(); if (allRelationshipTypes.isRight()) { - TitanOperationStatus operationStatus = allRelationshipTypes.right().value(); - if (TitanOperationStatus.NOT_FOUND == operationStatus) { + JanusGraphOperationStatus operationStatus = allRelationshipTypes.right().value(); + if (JanusGraphOperationStatus.NOT_FOUND == operationStatus) { BeEcompErrorManager.getInstance().logInternalDataError("FetchRelationshipTypes", "Relationship types " + "are " + "not loaded", diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java index 18671f8caf..19dd0f41a3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java @@ -68,7 +68,7 @@ public class RelationshipTypeImportManager { return commonImportManager.createElementTypesByDao(relationshipTypesToCreate, this::validateRelationshipType, relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE, relationshipType.getType()), relationshipTypeName -> relationshipTypeOperation.getRelationshipTypeByName(relationshipTypeName) - .right().map(DaoStatusConverter::convertTitanStatusToStorageStatus), + .right().map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus), relationshipType -> relationshipTypeOperation.addRelationshipType(relationshipType, inTransaction), (newRelationshipType, oldRelationshipType) -> relationshipTypeOperation .updateRelationshipType(newRelationshipType, oldRelationshipType, inTransaction)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java index c07a9fc09f..c2d9c95cf7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.RequirementOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.RequirementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -120,15 +120,15 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { result = requirementOperation.addRequirement(componentId, requirementsToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()), "")); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(requirementsToReturn); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -222,15 +222,15 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { result = requirementOperation.addRequirement(componentId, requirementsToReturn); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()), "")); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(requirementsToReturn); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "addOrUpdate", e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -263,7 +263,7 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteRequirementEither = deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete); if (deleteRequirementEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteRequirementEither.right().value())); } requirementsToReturn.add(initiateNewRequirement(storedComponent, requirementDefinitionToUpdate)); @@ -300,7 +300,7 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> deleteRequirementEither = deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete); if (deleteRequirementEither.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(deleteRequirementEither.right().value())); } } @@ -392,17 +392,17 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { Either, StorageOperationStatus> result = deleteRequirement(storedComponent, storedComponentRequirements, requirementDefinitionToDelete); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); LOGGER.error("Failed to delete requirement from component {}. Response is {}", storedComponent.getName(), result.right().value()); return Either.right(componentsUtils.getResponseFormat(componentsUtils .convertFromStorageResponse(result.right().value(), storedComponent.getComponentType()))); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(requirementDefinitionToDelete); } catch (Exception e) { LOGGER.error(EXCEPTION_OCCURRED_DURING_REQUIREMENTS, "delete", e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.REQUIREMENT_NOT_FOUND)); } finally { if (lockResult.isLeft() && lockResult.left().value()) { @@ -462,7 +462,7 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { if (lockResult.isRight()) { LOGGER.debug(FAILED_TO_LOCK_COMPONENT_RESPONSE_IS, component.getName(), lockResult.right().value().getFormattedMessage()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(lockResult.right().value()); } } 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 0968e157e4..1fa9051a9a 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 @@ -75,7 +75,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.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datamodel.utils.ArtifactUtils; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; @@ -127,7 +127,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; @@ -321,7 +321,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Either dataModelResponse = toscaOperationFacade .validateComponentNameUniqueness(resourceName, resourceTypeEnum, ComponentTypeEnum.RESOURCE); // DE242223 - titanDao.commit(); + janusGraphDao.commit(); if (dataModelResponse.isLeft()) { Map result = new HashMap<>(); @@ -487,7 +487,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { throw e; } finally { - titanDao.commit(); + janusGraphDao.commit(); log.debug("unlock resource {}", lockedResourceId); graphLockOperation.unlockComponent(lockedResourceId, NodeTypeEnum.Resource); } @@ -1420,7 +1420,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { throw e; } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } if (shouldLock) { graphLockOperation.unlockComponentByName(resource.getSystemName(), resource.getUniqueId(), @@ -1431,7 +1431,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { private void rollback(boolean inTransaction, Resource resource, List createdArtifacts, List nodeTypesNewCreatedArtifacts) { if(!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } if (isNotEmpty(createdArtifacts) && isNotEmpty(nodeTypesNewCreatedArtifacts)) { createdArtifacts.addAll(nodeTypesNewCreatedArtifacts); @@ -2181,13 +2181,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Map> instInputs = new HashMap<>(); log.debug("#createResourceInstancesRelations - Before get all datatypes. "); - Either, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = dataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse( - DaoStatusConverter.convertTitanStatusToStorageStatus(status)), yamlName)); + DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)), yamlName)); } Resource finalResource = resource; @@ -2369,7 +2369,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } - private void processComponentInstance(String yamlName, Resource resource, List componentInstancesList, Either, TitanOperationStatus> allDataTypes, Map> instProperties, Map>> instCapabilties, Map>> instRequirements, Map> instDeploymentArtifacts, Map> instArtifacts, Map> instAttributes, Map originCompMap, Map> instInputs, UploadComponentInstanceInfo uploadComponentInstanceInfo) { + private void processComponentInstance(String yamlName, Resource resource, List componentInstancesList, Either, JanusGraphOperationStatus> allDataTypes, Map> instProperties, Map>> instCapabilties, Map>> instRequirements, Map> instDeploymentArtifacts, Map> instArtifacts, Map> instAttributes, Map originCompMap, Map> instInputs, UploadComponentInstanceInfo uploadComponentInstanceInfo) { Optional currentCompInstanceOpt = componentInstancesList.stream() .filter(i->i.getName().equals(uploadComponentInstanceInfo.getName())) .findFirst(); @@ -2435,7 +2435,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return originResource; } - private void processComponentInstanceCapabilities(Either, TitanOperationStatus> allDataTypes, Map>> instCapabilties, UploadComponentInstanceInfo uploadComponentInstanceInfo, ComponentInstance currentCompInstance, Resource originResource) { + private void processComponentInstanceCapabilities(Either, JanusGraphOperationStatus> allDataTypes, Map>> instCapabilties, UploadComponentInstanceInfo uploadComponentInstanceInfo, ComponentInstance currentCompInstance, Resource originResource) { Map> originCapabilities; if (isNotEmpty(uploadComponentInstanceInfo.getCapabilities())) { originCapabilities = new HashMap<>(); @@ -2449,7 +2449,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { instCapabilties.put(currentCompInstance, originCapabilities); } - private void updateCapabilityPropertiesValues(Either, TitanOperationStatus> allDataTypes, Map> originCapabilities, Map> newPropertiesMap) { + private void updateCapabilityPropertiesValues(Either, JanusGraphOperationStatus> allDataTypes, Map> originCapabilities, Map> newPropertiesMap) { originCapabilities.values().stream() .flatMap(Collection::stream) .filter(c -> newPropertiesMap.containsKey(c.getName())) @@ -3240,10 +3240,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (result == null || result.isRight()) { BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify"); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } } else if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } } } @@ -3429,9 +3429,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (resourcePair == null) { BeEcompErrorManager.getInstance().logBeSystemError("Change LifecycleState - Certify"); - titanDao.rollback(); + janusGraphDao.rollback(); } else if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } if (needLock) { log.debug("unlock resource {}", lockedResourceId); @@ -3919,9 +3919,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (result == null || !result.equals(StorageOperationStatus.OK)) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(resourceId, NodeTypeEnum.Resource); } @@ -3947,11 +3947,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (result == null || !result.equals(StorageOperationStatus.OK)) { - titanDao.rollback(); + janusGraphDao.rollback(); ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(result); responseFormat = componentsUtils.getResponseFormatByResource(actionStatus, resourceName); } else { - titanDao.commit(); + janusGraphDao.commit(); } } if (resource != null) { @@ -3971,9 +3971,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (result == null || !result.equals(StorageOperationStatus.OK)) { - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(resource.getUniqueId(), NodeTypeEnum.Resource); } @@ -4097,7 +4097,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } finally { if (!inTransaction) { - titanDao.commit(); + janusGraphDao.commit(); } if (needToUnlock) { graphLockOperation.unlockComponent(resourceIdToUpdate, NodeTypeEnum.Resource); @@ -4643,7 +4643,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Either, ActionStatus> categories = elementDao .getAllCategories(NodeTypeEnum.ResourceNewCategory, inTransaction); if (categories.isRight()) { - log.debug("failed to retrieve resource categories from Titan"); + log.debug("failed to retrieve resource categories from JanusGraph"); responseFormat = componentsUtils.getResponseFormat(categories.right().value()); componentsUtils.auditResource(responseFormat, user, resource, actionEnum); throw new ByActionStatusComponentException(categories.right().value()); @@ -4830,7 +4830,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (deleteArtifactByInterface.isRight()) { log.debug("Couldn't remove artifact definition with id {}", uniqueId); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } return Either.right(deleteArtifactByInterface.right().value()); } @@ -4852,7 +4852,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { && !findPropertiesOfNode.right().value().equals(StorageOperationStatus.OK)) { log.debug("Failed to remove all properties of resource"); if (!inTransaction) { - titanDao.rollback(); + janusGraphDao.rollback(); } return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(findPropertiesOfNode.right().value()))); @@ -4865,7 +4865,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (inTransaction) { return Either.left(true); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(true); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java index cd9be0fe72..dbb421b6a0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; 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.CapabilityTypeOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 6c41985c9a..2c0af5fec5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -117,9 +117,9 @@ 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.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeFilterOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -236,14 +236,14 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } Either result = toscaOperationFacade.updateDistributionStatus(service, user, newState); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); BeEcompErrorManager.getInstance().logBeSystemError("ChangeServiceDistributionState"); log.debug("service {} is change destribuation status failed", service.getUniqueId()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR, service.getVersion(), service.getName()); createAudit(user, auditAction, comment, service, responseFormat); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); Service updatedService = result.left().value(); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK); log.debug(AUDIT_BEFORE_SENDING_RESPONSE); @@ -322,10 +322,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { operationList.add(operationEither.left().value()); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(operationList); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { @@ -1013,7 +1013,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { Either dataModelResponse = toscaOperationFacade.validateComponentNameUniqueness(serviceName, null, ComponentTypeEnum.SERVICE); // DE242223 - titanDao.commit(); + janusGraphDao.commit(); if (dataModelResponse.isLeft()) { Map result = new HashMap<>(); @@ -1073,12 +1073,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { try { Either updateResponse = toscaOperationFacade.updateToscaElement(serviceToUpdate); if (updateResponse.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); BeEcompErrorManager.getInstance().logBeSystemError("Update Service Metadata"); log.debug("failed to update sevice {}", serviceToUpdate.getUniqueId()); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(updateResponse.left().value()); } finally { graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service); @@ -1099,7 +1099,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (lock) { Either lockResult = lockComponent(service.getUniqueId(), service, "Delete Forwarding Path on Service"); if (lockResult.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils .convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "")); } @@ -1108,15 +1108,15 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { result = forwardingPathOperation.deleteForwardingPath(service ,pathIdsToDelete); if (result.isRight()) { log.debug(FAILED_TO_LOCK_SERVICE_RESPONSE_IS, service.getName(), result.right().value()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE))); } - titanDao.commit(); + janusGraphDao.commit(); log.debug(THE_SERVICE_WITH_SYSTEM_NAME_LOCKED, service.getSystemName()); } catch (Exception e){ log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service); @@ -1214,7 +1214,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { result = forwardingPathOperation.addForwardingPath(serviceId, forwardingPathDataDefinition); } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); @@ -1225,12 +1225,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update forwarding path property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); } finally { if (lockResult != null && lockResult.isLeft() && lockResult.left().value()) { graphLockOperation.unlockComponent(storedService.getUniqueId(), NodeTypeEnum.Service); @@ -1608,7 +1608,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { log.debug("validating service category {} against valid categories list", list); Either, ActionStatus> categorys = elementDao.getAllServiceCategories(); if (categorys.isRight()) { - log.debug("failed to retrieve service categories from Titan"); + log.debug("failed to retrieve service categories from JanusGraph"); ResponseFormat responseFormat = componentsUtils.getResponseFormat(categorys.right().value()); return Either.right(responseFormat); } @@ -1666,10 +1666,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (result == null || !result.equals(StorageOperationStatus.OK)) { log.warn("operation failed. do rollback"); BeEcompErrorManager.getInstance().logBeSystemError("Delete Service"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service); } @@ -1708,10 +1708,10 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (result == null || !result.equals(StorageOperationStatus.OK)) { log.warn("operation failed. do rollback"); BeEcompErrorManager.getInstance().logBeSystemError("Delete Service"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service); } @@ -2006,12 +2006,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { try { Either result = toscaOperationFacade.updateDistributionStatus(service, user, state); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); BeEcompErrorManager.getInstance().logBeSystemError("updateDistributionStatusForActivation"); log.debug("service {} change distribution status failed", serviceId); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - titanDao.commit(); + janusGraphDao.commit(); return Either.left(result.left().value()); } finally { graphLockOperation.unlockComponent(serviceId, NodeTypeEnum.Service); @@ -2688,7 +2688,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (lock) { Either lockResult = lockComponent(service.getUniqueId(), service, "Delete Service Filter from service"); if (lockResult.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils .convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE), "")); } @@ -2697,15 +2697,15 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { result = serviceFilterOperation.deleteNodeFilter(service , resourceId); if (result.isRight()) { log.debug("Failed to delete node filter in service {}. Response is {}. ", service.getName(), result.right().value()); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(storageStatus.right().value(), ComponentTypeEnum.SERVICE))); } - titanDao.commit(); + janusGraphDao.commit(); log.debug("Node filter successfully changed in service {} . ", service.getSystemName()); } catch (Exception e){ log.error("Exception occurred during delete forwarding path : {}", e.getMessage(), e); - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } finally { graphLockOperation.unlockComponent(service.getUniqueId(), NodeTypeEnum.Service); @@ -2760,17 +2760,17 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { try { result = serviceFilterOperation.createNodeFilter(serviceId, componentInstanceId); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); } else { serviceFilterResult = result.left().value(); } - titanDao.commit(); + janusGraphDao.commit(); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update service filter property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); @@ -2832,17 +2832,17 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { Either result = serviceFilterOperation.updateProperties(serviceId, componentInstanceId, serviceFilter ,properties); if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); } else { serviceFilterResult = result.left().value(); } - titanDao.commit(); + janusGraphDao.commit(); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update service filter property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); @@ -2926,17 +2926,17 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } if (result.isRight()) { - titanDao.rollback(); + janusGraphDao.rollback(); return Either.right(componentsUtils.getResponseFormat( componentsUtils.convertFromStorageResponse(result.right().value(), ComponentTypeEnum.SERVICE), "")); } else { serviceFilterResult = result.left().value(); } - titanDao.commit(); + janusGraphDao.commit(); } catch (Exception e) { - titanDao.rollback(); + janusGraphDao.rollback(); log.error("Exception occurred during add or update node filter property values: {}", e.getMessage(), e); return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java index 93d79a361e..9346c41cac 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java @@ -10,7 +10,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java index cc6e9e9cd3..a85a9c73bf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperation.java @@ -6,7 +6,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java index 10a35d0128..cb2fc5b5af 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandler.java @@ -5,7 +5,7 @@ import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; 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 2d6f354139..e51caabd00 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 @@ -24,8 +24,8 @@ package org.openecomp.sdc.be.components.impl.utils; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; @@ -34,29 +34,29 @@ import org.springframework.stereotype.Component; @Component public class ExceptionUtils { - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; - public ExceptionUtils(TitanDao titanDao) { - this.titanDao = titanDao; + public ExceptionUtils(JanusGraphDao janusGraphDao) { + this.janusGraphDao = janusGraphDao; } public T rollBackAndThrow(ActionStatus actionStatus, String ... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByActionStatusComponentException(actionStatus, params); } public T rollBackAndThrow(ResponseFormat responseFormat) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new ByResponseFormatComponentException(responseFormat); } public T rollBackAndThrow(StorageOperationStatus status, String ... params) { - titanDao.rollback(); + janusGraphDao.rollback(); throw new StorageException(status, params); } - public T rollBackAndThrow(TitanOperationStatus status, String ... params) { - titanDao.rollback(); + public T rollBackAndThrow(JanusGraphOperationStatus status, String ... params) { + janusGraphDao.rollback(); throw new StorageException(status, params); } 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 e9289de839..5826ef1254 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 @@ -25,16 +25,16 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.ToscaUtils; @@ -62,8 +62,8 @@ public class CertificationChangeTransition extends LifeCycleTransition { private ArtifactsBusinessLogic artifactsManager; private NodeTemplateOperation nodeTemplateOperation; - public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); this.name = name; @@ -202,12 +202,12 @@ public class CertificationChangeTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if ( !inTransaction ) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if ( !inTransaction ) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java index 7456a58994..a0e9bc8c15 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransition.java @@ -25,17 +25,17 @@ import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -52,8 +52,8 @@ public class CertificationRequestTransition extends LifeCycleTransition { private ServiceBusinessLogic serviceBusinessLogic; public CertificationRequestTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ServiceBusinessLogic serviceBusinessLogic, - ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -193,12 +193,12 @@ public class CertificationRequestTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } 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 89ed22f5c4..f6cc7dcb53 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 @@ -24,7 +24,7 @@ import fj.data.Either; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -32,11 +32,11 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -49,8 +49,8 @@ public class CheckinTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckinTransition.class); - public CheckinTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public CheckinTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -100,12 +100,12 @@ public class CheckinTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } 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 33b625002f..d97c171868 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 @@ -24,18 +24,18 @@ import fj.data.Either; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.ToscaUtils; @@ -50,8 +50,8 @@ public class CheckoutTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckoutTransition.class); - CheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + CheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -131,12 +131,12 @@ public class CheckoutTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } 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 0057f615bf..180b7f0286 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 @@ -25,7 +25,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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; @@ -34,8 +34,8 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -52,7 +52,7 @@ public abstract class LifeCycleTransition { @Autowired protected ToscaElementLifecycleOperation lifeCycleOperation; @Autowired - protected TitanDao titanDao; + protected JanusGraphDao janusGraphDao; protected ComponentsUtils componentUtils; protected Map> authorizedRoles; @@ -60,7 +60,7 @@ public abstract class LifeCycleTransition { ToscaOperationFacade toscaOperationFacade; - protected LifeCycleTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation2, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { + protected LifeCycleTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation2, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { this.configurationManager = ConfigurationManager.getConfigurationManager(); this.lifeCycleOperation = lifecycleOperation2; @@ -68,7 +68,7 @@ public abstract class LifeCycleTransition { this.authorizedRoles = new HashMap<>(); this.resourceAuthorizedRoles = new HashMap<>(); this.toscaOperationFacade = toscaOperationFacade; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; } public abstract LifeCycleTransitionEnum getName(); 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 981f0bdff2..befca2480a 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 @@ -29,18 +29,18 @@ import org.openecomp.sdc.be.components.impl.*; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -71,7 +71,7 @@ public class LifecycleBusinessLogic { private ArtifactsBusinessLogic artifactsBusinessLogic; @Autowired - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Autowired private CapabilityOperation capabilityOperation; @@ -129,30 +129,37 @@ public class LifecycleBusinessLogic { private void initStateOperations() { stateTransitions = new HashMap<>(); - LifeCycleTransition checkoutOp = new CheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition checkoutOp = new CheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(checkoutOp.getName().name(), checkoutOp); - UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); undoCheckoutOp.setArtifactsBusinessLogic(artifactsBusinessLogic); stateTransitions.put(undoCheckoutOp.getName().name(), undoCheckoutOp); - LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(checkinOp.getName().name(), checkinOp); LifeCycleTransition certificationRequest = new CertificationRequestTransition(componentUtils, lifecycleOperation, serviceBusinessLogic, toscaOperationFacade, - titanDao); + janusGraphDao); stateTransitions.put(certificationRequest.getName().name(), certificationRequest); - LifeCycleTransition startCertification = new StartCertificationTransition(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition startCertification = new StartCertificationTransition(componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(startCertification.getName().name(), startCertification); - LifeCycleTransition failCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.FAIL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition failCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.FAIL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(failCertification.getName().name(), failCertification); - LifeCycleTransition cancelCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CANCEL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + LifeCycleTransition cancelCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CANCEL_CERTIFICATION, componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); stateTransitions.put(cancelCertification.getName().name(), cancelCertification); - CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade, + janusGraphDao); successCertification.setArtifactsManager(artifactsBusinessLogic); successCertification.setNodeTemplateOperation(nodeTemplateOperation); stateTransitions.put(successCertification.getName().name(), successCertification); @@ -534,9 +541,9 @@ public class LifecycleBusinessLogic { log.info("unlock component {}", resource.getUniqueId()); if (!inTransaction) { if (result.isLeft()) { - titanDao.commit(); + janusGraphDao.commit(); } else { - titanDao.rollback(); + janusGraphDao.rollback(); } if (needLock) { NodeTypeEnum nodeType = resource.getComponentType().getNodeType(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java index fd3e24f2fb..582b3fd81c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/StartCertificationTransition.java @@ -24,17 +24,17 @@ import fj.data.Either; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -47,8 +47,8 @@ public class StartCertificationTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(StartCertificationTransition.class); - public StartCertificationTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public StartCertificationTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] rsrcServiceStartCertificationRoles = { Role.ADMIN, Role.TESTER }; @@ -97,12 +97,12 @@ public class StartCertificationTransition extends LifeCycleTransition { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); if (!inTransaction) { log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } } else { if (!inTransaction) { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } } 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 c6429c70bb..ff4746dcc3 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,17 +25,17 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -48,8 +48,8 @@ public class UndoCheckoutTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckoutTransition.class); private ArtifactsBusinessLogic artifactsManager; - public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, TitanDao titanDao) { - super(componentUtils, lifecycleOperation, toscaOperationFacade, titanDao); + public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { + super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); // authorized roles Role[] resourceServiceCheckoutRoles = { Role.ADMIN, Role.DESIGNER }; @@ -126,10 +126,10 @@ public class UndoCheckoutTransition extends LifeCycleTransition { if (result == null || result.isRight()) { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState - Undo Checkout failed on graph"); log.debug("operation failed. do rollback"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { log.debug("operation success. do commit"); - titanDao.commit(); + janusGraphDao.commit(); } } return result; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java index 00e49dcbc0..9e01fb9c30 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogic.java @@ -7,7 +7,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java index 1220ec4d97..eddff124b5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/TopologyComparator.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java index 1638aea737..90b0ed4e8e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommand.java @@ -7,7 +7,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java index a84360b69b..68ee15e877 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommand.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.springframework.core.annotation.Order; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java index 802dc2271f..fd45f9c59d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/ComponentInputsMergeBL.java @@ -6,7 +6,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.springframework.core.annotation.Order; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java index 66e8dc4ee0..84cb111d51 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/GlobalInputsMergeCommand.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.springframework.core.annotation.Order; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java index 3cf4c0df65..8580844f7c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/input/InputsMergeCommand.java @@ -5,7 +5,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.log.wrappers.Logger; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java index 7863243765..28a6623ee7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBL.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java index f6de767ed4..6ed252d2d2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMerge.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.components.merge.instance; import fj.data.Either; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java index 13e85085d6..5e7d3628d2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceForwardingPathMerge.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java index 037ab86368..b04ee22f7e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsMergeBL.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java index c09fb91d1f..4feef4bb5d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandler.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.utils.ComponentUtilities; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java index 60e60b0408..bc8288896a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInterface; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java index 31b3207d6c..e6260286f7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java index 04c43b4c65..7eb5518d44 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropertiesMergeBL.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java index dc037abe80..0bcbaf0556 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMerge.java @@ -4,7 +4,7 @@ import fj.data.Either; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java index 995eae701c..de7179865d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMerge.java @@ -11,7 +11,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java index 68a8333e31..bc6e0309ef 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBL.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation; import org.openecomp.sdc.exception.ResponseFormat; import java.util.List; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java index e57317f165..2f5698af4e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommand.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.core.annotation.Order; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java index df7b877364..82bc0f4b75 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogic.java @@ -7,7 +7,7 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -44,7 +44,7 @@ public class PropertyDataValueMergeBusinessLogic { * @param newProp the new property to merge value into */ public void mergePropertyValue(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, List getInputNamesToMerge) { - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { LOGGER.debug("failed to fetch data types, skip merging of previous property values. status: {}", dataTypesEither.right().value()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java index 55cf75b769..2dde63f1f2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/utils/MergeInstanceUtils.java @@ -8,8 +8,8 @@ import org.openecomp.sdc.be.components.merge.instance.RelationMergeInfo; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java index a099aad15c..837872917e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/path/ForwardingPathValidator.java @@ -7,7 +7,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java index d7b366e0a8..fdcfd35ca4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclarator.java @@ -20,7 +20,7 @@ import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java index 14ea9300fe..2026e1136d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclarator.java @@ -16,7 +16,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java index ae76dadbf0..b1910ad217 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclarator.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java index bdb79c71bb..9f43284104 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java @@ -21,7 +21,7 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; import org.json.simple.JSONObject; import org.openecomp.sdc.be.components.utils.PropertiesUtils; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetPolicyValueDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner; @@ -466,10 +466,12 @@ public abstract class DefaultPropertyDeclarator prepareValueBeforeDelete(InputDefinition inputForDelete, PropertyDataDefinition inputValue, List pathOfComponentInstances) { Either deleteEither = prepareValueBeforeDelete(inputForDelete, inputValue); - Either findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(), + Either findDefaultValue = propertyOperation + .findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(), (String) inputValue.getDefaultValue()); if (findDefaultValue.isRight()) { - deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value())))); + deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils + .convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(findDefaultValue.right().value())))); return deleteEither; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java index 17059104ff..9cf6ff9fa4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclarator.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java index 2726f67342..0c6f8a24b4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclarator.java @@ -15,7 +15,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java index 6bd09c1622..362f80ff1f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentPropertyToPolicyDeclarator.java @@ -13,7 +13,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; 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 ef3ffb8953..ffb4805285 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 @@ -6,13 +6,13 @@ 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; @@ -31,7 +31,7 @@ public class UpgradeBusinessLogic { private final ToscaOperationFacade toscaOperationFacade; private final ComponentsUtils componentsUtils; private final UpgradeOperation upgradeOperation; - private final TitanDao titanDao; + private final JanusGraphDao janusGraphDao; private LifecycleChangeInfoWithAction changeInfo = new LifecycleChangeInfoWithAction("automated upgrade"); private static final List UUID_PROPS_NAMES = Arrays.asList("depending_service_uuid", "providing_service_uuid"); @@ -41,14 +41,14 @@ public class UpgradeBusinessLogic { private static final Logger LOGGER = Logger.getLogger(UpgradeBusinessLogic.class); public UpgradeBusinessLogic(LifecycleBusinessLogic lifecycleBusinessLogic, ComponentInstanceBusinessLogic componentInstanceBusinessLogic, UserValidations userValidations, ToscaOperationFacade toscaOperationFacade, ComponentsUtils componentsUtils, - UpgradeOperation upgradeOperation, TitanDao titanDao) { + UpgradeOperation upgradeOperation, JanusGraphDao janusGraphDao) { this.lifecycleBusinessLogic = lifecycleBusinessLogic; this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; this.userValidations = userValidations; this.toscaOperationFacade = toscaOperationFacade; this.componentsUtils = componentsUtils; this.upgradeOperation = upgradeOperation; - this.titanDao = titanDao; + this.janusGraphDao = janusGraphDao; } @@ -113,7 +113,7 @@ public class UpgradeBusinessLogic { .map(rf -> componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(rf))); } finally { // all operation were read only. no commit needed - titanDao.rollback(); + janusGraphDao.rollback(); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java index 9dbf012653..bdd7f656b3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ComponentValidations.java @@ -32,7 +32,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java index 8d2808851b..c16927f040 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/NodeFilterValidator.java @@ -20,7 +20,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.ui.model.UIConstraint; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java index 94751593fa..b42aa4cfa7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PropertyValidator.java @@ -6,7 +6,7 @@ import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; @@ -92,11 +92,11 @@ public class PropertyValidator { break; } - Either, TitanOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); + Either, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); if (allDataTypes.isRight()) { - TitanOperationStatus status = allDataTypes.right().value(); + JanusGraphOperationStatus status = allDataTypes.right().value(); BeEcompErrorManager.getInstance().logInternalFlowError("AddPropertyToGroup", "Failed to validate property. Status is " + status, BeEcompErrorManager.ErrorSeverity.ERROR); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)))); } type = property.getType(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java index fa35b64cf3..8611321b87 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidation.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; import org.openecomp.sdc.common.log.wrappers.Logger; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java index 78bb5e67e1..c71c7960ab 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/AssetMetadataConverter.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.be.externalapi.servlet.representation.*; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; 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 3a823ded76..c9430107df 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 @@ -25,7 +25,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.HealingTitanDao; +import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; @@ -118,7 +118,7 @@ public class BeServletFilter implements ContainerRequestFilter, ContainerRespons audit.startLog(requestContext); } - writeToTitan(responseContext); + writeToJanusGraph(responseContext); //write to Audit log in case it's valuable action // (e.g. ignoring healthCheck and any other unlogged urls as in yaml @@ -144,18 +144,18 @@ public class BeServletFilter implements ContainerRequestFilter, ContainerRespons } } - private void writeToTitan(ContainerResponseContext responseContext) { + private void writeToJanusGraph(ContainerResponseContext responseContext) { log.debug("Close transaction from filter"); - HealingTitanDao titanDao = getTitanDao(); - if (titanDao != null) { + HealingJanusGraphDao janusGraphDao = getJanusGraphDao(); + if (janusGraphDao != null) { int status = responseContext.getStatus(); if (status == Response.Status.OK.getStatusCode() || status == Response.Status.CREATED.getStatusCode() || status == Response.Status.NO_CONTENT.getStatusCode()) { - titanDao.commit(); + janusGraphDao.commit(); log.debug("Doing commit from filter"); } else { - titanDao.rollback(); + janusGraphDao.rollback(); log.debug("Doing rollback from filter"); } } @@ -202,12 +202,12 @@ public class BeServletFilter implements ContainerRequestFilter, ContainerRespons return webApplicationContext.getBean(ComponentsUtils.class); } - private HealingTitanDao getTitanDao() { + private HealingJanusGraphDao getJanusGraphDao() { ServletContext context = this.sr.getSession().getServletContext(); WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - return webApplicationContext.getBean(HealingTitanDao.class); + return webApplicationContext.getBean(HealingJanusGraphDao.class); } // Extracted for purpose of clear method name, for logback %M parameter diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java index 31ba52749a..158cc2d842 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ComponentsAvailabilityFilter.java @@ -92,7 +92,7 @@ public class ComponentsAvailabilityFilter implements ContainerRequestFilter { List healthCheckInfos = new ArrayList<>(); HealthCheckBusinessLogic healthCheckBusinessLogic = getHealthCheckBL(servletContext); - healthCheckBusinessLogic.getTitanHealthCheck(healthCheckInfos); // Titan + healthCheckBusinessLogic.getJanusGraphHealthCheck(healthCheckInfos); // JanusGraph return healthCheckInfos; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java index 245eb59301..8e06c02767 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverter.java @@ -31,8 +31,8 @@ import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.utils.ComponentUtilities; import org.openecomp.sdc.be.tosca.ToscaUtils.SubstitutionEntry; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java index 7b40781f3f..2f1357ea13 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java @@ -40,8 +40,8 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.resources.data.ESArtifactData; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java index d7adb54c08..ff69eaa90b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/GroupExportParserImpl.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.tosca; import fj.data.Either; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; @@ -44,7 +44,7 @@ public class GroupExportParserImpl implements GroupExportParser { } private Map getDataTypes() { - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.error("Failed to retrieve all data types {}", dataTypesEither.right().value()); throw new SdcResourceNotFoundException(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java index 0ebdf0e362..84b4193940 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/PolicyExportParserImpl.java @@ -3,7 +3,7 @@ package org.openecomp.sdc.be.tosca; import fj.data.Either; import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.*; @@ -43,7 +43,7 @@ public class PolicyExportParserImpl implements PolicyExportParser { } private Map getDataTypes() { - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.error("Failed to retrieve all data types {}", dataTypesEither.right().value()); throw new SdcResourceNotFoundException(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index e6e69bf8de..603da09a1d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -32,7 +32,7 @@ import org.apache.commons.lang3.tuple.Triple; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.*; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -41,8 +41,8 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.tosca.converters.ToscaValueBaseConverter; @@ -249,7 +249,7 @@ public class ToscaExportHandler { toscaNode.setInterface_types(proxyInterfaceTypes); } - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value()); return Either.right(ToscaError.GENERAL_ERROR); @@ -548,7 +548,7 @@ public class ToscaExportHandler { .collect(Collectors.toList()); toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes)); - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.debug("Failed to fetch all data types :", dataTypesEither.right().value()); return Either.right(ToscaError.GENERAL_ERROR); @@ -1028,7 +1028,7 @@ public class ToscaExportHandler { String derivedFrom = ((Resource) origComponent).getToscaResourceName(); toscaNodeType.setDerived_from(derivedFrom); - Either, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + Either, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll(); if (dataTypesEither.isRight()) { log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java index 59dd8d0f00..32cb604e76 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaUtils.java @@ -20,13 +20,10 @@ package org.openecomp.sdc.be.tosca; -import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import java.lang.reflect.Field; import java.util.*; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java index a332e6401a..62a5e8ccfe 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtil.java @@ -8,7 +8,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter; import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate; import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java index b7e4c53844..a56607d4ce 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java @@ -25,7 +25,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -57,7 +57,7 @@ public class UserBusinessLogic implements IUserBusinessLogic { @Resource private ComponentsUtils componentsUtils; @Autowired - private TitanGenericDao titanDao; + private JanusGraphGenericDao janusGraphDao; @Override public Either getUser(String userId, boolean inTransaction) { @@ -603,9 +603,9 @@ public class UserBusinessLogic implements IUserBusinessLogic { // commit will be perform outside!!! if (result == null || result.isRight()) { log.debug("getUserPendingTasksList failed to perform fetching"); - titanDao.rollback(); + janusGraphDao.rollback(); } else { - titanDao.commit(); + janusGraphDao.commit(); } } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java index ea041359fd..b964321c8a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/ITransactionSdnc.java @@ -34,6 +34,6 @@ public interface ITransactionSdnc { Either invokeGeneralDBAction(boolean isLastAction, DBTypeEnum dbType, IDBAction dbAction, IDBAction dbRollbackAction); - Either invokeTitanAction(boolean isLastAction, IDBAction dbAction); + Either invokeJanusGraphAction(boolean isLastAction, IDBAction dbAction); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java index fc7c90509f..60f89ce012 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/api/TransactionUtils.java @@ -30,7 +30,7 @@ public final class TransactionUtils { } public enum DBTypeEnum { - ELASTIC_SEARCH, TITAN, MYSTERY, SWIFT + ELASTIC_SEARCH, JANUSGRAPH, MYSTERY, SWIFT } public enum TransactionCodeEnum { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java new file mode 100644 index 0000000000..dad79b5f76 --- /dev/null +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphCommitHandler.java @@ -0,0 +1,52 @@ +/*- + * ============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.common.transaction.impl; + +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.common.transaction.api.ICommitHandler; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; + +public class JanusGraphCommitHandler implements ICommitHandler { + + private JanusGraphGenericDao janusGraphGenericDao; + + public JanusGraphCommitHandler(JanusGraphGenericDao janusGraphGenericDao) { + this.janusGraphGenericDao = janusGraphGenericDao; + } + + @Override + public DBActionCodeEnum doCommit() { + DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; + JanusGraphOperationStatus janusGraphStatus = janusGraphGenericDao.commit(); + if (janusGraphStatus != JanusGraphOperationStatus.OK) { + result = DBActionCodeEnum.FAIL_GENERAL; + } + return result; + } + + @Override + public DBTypeEnum getDBType() { + return DBTypeEnum.JANUSGRAPH; + } + +} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java new file mode 100644 index 0000000000..ed2633fa11 --- /dev/null +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/JanusGraphRollbackHandler.java @@ -0,0 +1,55 @@ +/*- + * ============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.common.transaction.impl; + +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.common.transaction.api.RollbackHandler; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; +import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; + +public class JanusGraphRollbackHandler extends RollbackHandler { + + private JanusGraphGenericDao janusGraphGenericDao; + + public JanusGraphRollbackHandler(Integer transactionId, String userId, String actionType, JanusGraphGenericDao janusGraphGenericDao) { + super(transactionId, userId, actionType); + this.janusGraphGenericDao = janusGraphGenericDao; + } + + public DBTypeEnum getDBType() { + return DBTypeEnum.JANUSGRAPH; + } + + protected boolean isRollbackForPersistenceData() { + return false; + } + + public DBActionCodeEnum doNonPersistenceDataRollback() { + DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; + JanusGraphOperationStatus janusGraphStatus = janusGraphGenericDao.rollback(); + if (janusGraphStatus != JanusGraphOperationStatus.OK) { + result = DBActionCodeEnum.FAIL_GENERAL; + } + return result; + } + +} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java deleted file mode 100644 index c86241ebf1..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanCommitHandler.java +++ /dev/null @@ -1,52 +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.common.transaction.impl; - -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.common.transaction.api.ICommitHandler; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; - -public class TitanCommitHandler implements ICommitHandler { - - private TitanGenericDao titanGenericDao; - - public TitanCommitHandler(TitanGenericDao titanGenericDao) { - this.titanGenericDao = titanGenericDao; - } - - @Override - public DBActionCodeEnum doCommit() { - DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; - TitanOperationStatus titanStatus = titanGenericDao.commit(); - if (titanStatus != TitanOperationStatus.OK) { - result = DBActionCodeEnum.FAIL_GENERAL; - } - return result; - } - - @Override - public DBTypeEnum getDBType() { - return DBTypeEnum.TITAN; - } - -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java deleted file mode 100644 index 89d2b9da8e..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/impl/TitanRollbackHandler.java +++ /dev/null @@ -1,55 +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.common.transaction.impl; - -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.common.transaction.api.RollbackHandler; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; -import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; - -public class TitanRollbackHandler extends RollbackHandler { - - private TitanGenericDao titanGenericDao; - - public TitanRollbackHandler(Integer transactionId, String userId, String actionType, TitanGenericDao titanGenericDao) { - super(transactionId, userId, actionType); - this.titanGenericDao = titanGenericDao; - } - - public DBTypeEnum getDBType() { - return DBTypeEnum.TITAN; - } - - protected boolean isRollbackForPersistenceData() { - return false; - } - - public DBActionCodeEnum doNonPersistenceDataRollback() { - DBActionCodeEnum result = DBActionCodeEnum.SUCCESS; - TitanOperationStatus titanStatus = titanGenericDao.rollback(); - if (titanStatus != TitanOperationStatus.OK) { - result = DBActionCodeEnum.FAIL_GENERAL; - } - return result; - } - -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java index 9d95c26ec9..78264484fb 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionManager.java @@ -23,7 +23,7 @@ package org.openecomp.sdc.common.transaction.mngr; import com.google.common.collect.EvictingQueue; import com.google.common.collect.Queues; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.transaction.api.ITransactionSdnc; import org.openecomp.sdc.common.transaction.api.TransactionUtils; @@ -45,7 +45,7 @@ public class TransactionManager { @Resource private ESCatalogDAO esCatalogDao; @Resource - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; /** * userId and actionType parameters are used only for logging purposes. @@ -55,7 +55,8 @@ public class TransactionManager { init(); } log.debug("TransactionManager creating new SdncTransaction"); - ITransactionSdnc tx = new TransactionSdncImpl(generateTransactionID(), userId, actionType, esCatalogDao, titanGenericDao); + ITransactionSdnc tx = new TransactionSdncImpl(generateTransactionID(), userId, actionType, esCatalogDao, + janusGraphGenericDao); transactions.add(tx); return tx; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java index 1c07e50e0a..93a2c9db82 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/common/transaction/mngr/TransactionSdncImpl.java @@ -23,15 +23,15 @@ package org.openecomp.sdc.common.transaction.mngr; import fj.data.Either; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.transaction.api.*; import org.openecomp.sdc.common.transaction.api.TransactionUtils.*; import org.openecomp.sdc.common.transaction.impl.ESAction; import org.openecomp.sdc.common.transaction.impl.ESRollbackHandler; -import org.openecomp.sdc.common.transaction.impl.TitanCommitHandler; -import org.openecomp.sdc.common.transaction.impl.TitanRollbackHandler; +import org.openecomp.sdc.common.transaction.impl.JanusGraphCommitHandler; +import org.openecomp.sdc.common.transaction.impl.JanusGraphRollbackHandler; import org.openecomp.sdc.common.util.MethodActivationStatusEnum; import java.util.ArrayList; @@ -45,14 +45,14 @@ public class TransactionSdncImpl implements ITransactionSdnc { private RollbackManager rollbackManager; private CommitManager commitManager; private ESCatalogDAO esCatalogDao; - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; private Integer transactionId; private TransactionStatusEnum status; private String userId, actionType; - TransactionSdncImpl(Integer transactionId, String userId, ActionTypeEnum actionTypeEnum, ESCatalogDAO esCatalogDao, TitanGenericDao titanGenericDao) { + TransactionSdncImpl(Integer transactionId, String userId, ActionTypeEnum actionTypeEnum, ESCatalogDAO esCatalogDao, JanusGraphGenericDao janusGraphGenericDao) { this.esCatalogDao = esCatalogDao; - this.titanGenericDao = titanGenericDao; + this.janusGraphGenericDao = janusGraphGenericDao; this.transactionId = transactionId; this.userId = userId; actionType = actionTypeEnum.name(); @@ -64,13 +64,14 @@ public class TransactionSdncImpl implements ITransactionSdnc { private List initCommitHandlers() { List commitHandlers = new ArrayList<>(); - commitHandlers.add(new TitanCommitHandler(titanGenericDao)); + commitHandlers.add(new JanusGraphCommitHandler(janusGraphGenericDao)); return commitHandlers; } private List initRollbackHandlers() { List rolebackHandlers = new ArrayList<>(); - rolebackHandlers.add(new TitanRollbackHandler(transactionId, userId, actionType, titanGenericDao)); + rolebackHandlers.add(new JanusGraphRollbackHandler(transactionId, userId, actionType, + janusGraphGenericDao)); rolebackHandlers.add(new ESRollbackHandler(transactionId, userId, actionType)); return rolebackHandlers; } @@ -115,10 +116,10 @@ public class TransactionSdncImpl implements ITransactionSdnc { return result; } - public Either invokeTitanAction(boolean isLastAction, IDBAction dbAction) { + public Either invokeJanusGraphAction(boolean isLastAction, IDBAction dbAction) { Either result; if (status == TransactionStatusEnum.OPEN) { - result = invokeAction(isLastAction, dbAction, DBTypeEnum.TITAN); + result = invokeAction(isLastAction, dbAction, DBTypeEnum.JANUSGRAPH); } else { result = handleActionOnClosedTransaction(); } diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml index d23f87eb96..0e6e248ef0 100644 --- a/catalog-be/src/main/resources/config/configuration.yaml +++ b/catalog-be/src/main/resources/config/configuration.yaml @@ -42,15 +42,15 @@ supportAllottedResourcesAndProxy: true deleteLockTimeoutInSeconds: 60 maxDeleteComponents: 10 -titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties -titanInMemoryGraph: false -titanLockTimeout: 1800 +janusGraphCfgFile: /home/vagrant/catalog-be/config/catalog-be/janusgraph.properties +janusGraphInMemoryGraph: false +janusGraphLockTimeout: 1800 -# The interval to try and reconnect to titan DB when it is down during ASDC startup: -titanReconnectIntervalInSeconds: 3 +# The interval to try and reconnect to janusGraph DB when it is down during ASDC startup: +janusGraphReconnectIntervalInSeconds: 3 -# The read timeout towards Titan DB when health check is invoked: -titanHealthCheckReadTimeout: 1 +# The read timeout towards Janus Graph DB when health check is invoked: +janusGraphHealthCheckReadTimeout: 1 # The interval to try and reconnect to Elasticsearch when it is down during ASDC startup: esReconnectIntervalInSeconds: 3 diff --git a/catalog-be/src/main/resources/config/janusgraph.properties b/catalog-be/src/main/resources/config/janusgraph.properties new file mode 100644 index 0000000000..5411a44224 --- /dev/null +++ b/catalog-be/src/main/resources/config/janusgraph.properties @@ -0,0 +1,11 @@ +storage.backend=cassandra +storage.hostname=localhost +storage.port=9160 + +cache.db-cache = false +cache.db-cache-clean-wait = 20 +cache.db-cache-time = 180000 +cache.db-cache-size = 0.5 + +cache.tx-cache-size = 500000 +storage.cassandra.keyspace=sdctitan diff --git a/catalog-be/src/main/resources/config/titan.properties b/catalog-be/src/main/resources/config/titan.properties deleted file mode 100644 index 5411a44224..0000000000 --- a/catalog-be/src/main/resources/config/titan.properties +++ /dev/null @@ -1,11 +0,0 @@ -storage.backend=cassandra -storage.hostname=localhost -storage.port=9160 - -cache.db-cache = false -cache.db-cache-clean-wait = 20 -cache.db-cache-time = 180000 -cache.db-cache-size = 0.5 - -cache.tx-cache-size = 500000 -storage.cassandra.keyspace=sdctitan 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 ea66ec707b..84d25a2a44 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 @@ -2,7 +2,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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import static org.mockito.Mockito.mock; @@ -14,6 +14,6 @@ public class MockGenerator { } public static ExceptionUtils mockExceptionUtils() { - return new ExceptionUtils(mock(TitanDao.class)); + return new ExceptionUtils(mock(JanusGraphDao.class)); } } 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 20f7f1874a..4ee63f7ba5 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 @@ -9,12 +9,11 @@ import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; -import org.openecomp.sdc.be.components.impl.ServiceBusinessLogicTest; import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -23,8 +22,8 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CacheMangerOperation; @@ -62,7 +61,7 @@ public abstract class BaseServiceBusinessLogicTest { AuditCassandraDao auditingDao = Mockito.mock(AuditCassandraDao.class); ArtifactsBusinessLogic artifactBl = Mockito.mock(ArtifactsBusinessLogic.class); GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class); - TitanDao mockTitanDao = Mockito.mock(TitanDao.class); + JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); CacheMangerOperation cacheManager = Mockito.mock(CacheMangerOperation.class); GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class); @@ -138,7 +137,7 @@ public abstract class BaseServiceBusinessLogicTest { bl.setUserAdmin(mockUserAdmin); bl.setArtifactBl(artifactBl); bl.setGraphLockOperation(graphLockOperation); - bl.setTitanGenericDao(mockTitanDao); + bl.setJanusGraphGenericDao(mockJanusGraphDao); bl.setToscaOperationFacade(toscaOperationFacade); bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic); bl.setComponentsUtils(componentsUtils); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java index 822e76464c..000de2cd4b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/HealthCheckBusinessLogicTest.java @@ -47,29 +47,29 @@ public class HealthCheckBusinessLogicTest { statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertFalse("check false", statusChanged); - HealthCheckInfo checkInfoTitanUp = new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.UP, null, null); - HealthCheckInfo checkInfoTitanDown = new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.DOWN, null, null); + HealthCheckInfo checkInfoJanusGraphUp = new HealthCheckInfo(Constants.HC_COMPONENT_JANUSGRAPH, HealthCheckStatus.UP, null, null); + HealthCheckInfo checkInfoJanusGraphDown = new HealthCheckInfo(Constants.HC_COMPONENT_JANUSGRAPH, HealthCheckStatus.DOWN, null, null); - checkInfosLeft.add(checkInfoTitanUp); + checkInfosLeft.add(checkInfoJanusGraphUp); - checkInfosRight.add(checkInfoTitanUp); + checkInfosRight.add(checkInfoJanusGraphUp); statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertFalse("check false", statusChanged); - checkInfosRight.remove(checkInfoTitanUp); + checkInfosRight.remove(checkInfoJanusGraphUp); statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertTrue("check true", statusChanged); - checkInfosRight.add(checkInfoTitanDown); + checkInfosRight.add(checkInfoJanusGraphDown); statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertTrue("check true", statusChanged); - checkInfosRight.remove(checkInfoTitanDown); + checkInfosRight.remove(checkInfoJanusGraphDown); statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertTrue("check true", statusChanged); - checkInfosRight.add(checkInfoTitanUp); + checkInfosRight.add(checkInfoJanusGraphUp); statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertFalse("check false", statusChanged); 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 4f2bb78079..971f7b8f20 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 @@ -31,11 +31,11 @@ import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.IPropertyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -81,7 +81,7 @@ public class PropertyBusinessLogicTest { @Mock IGraphLockOperation graphLockOperation; @Mock - TitanDao titanDao; + JanusGraphDao janusGraphDao; @InjectMocks private PropertyBusinessLogic bl = new PropertyBusinessLogic(); @@ -291,16 +291,16 @@ public class PropertyBusinessLogicTest { resource.setUniqueId(resourceId); Field baseBusinessLogic3; - baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("titanDao"); + baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("janusGraphDao"); baseBusinessLogic3.setAccessible(true); - baseBusinessLogic3.set(bl, titanDao); + baseBusinessLogic3.set(bl, janusGraphDao); Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource)); StorageOperationStatus lockResult = StorageOperationStatus.OK; when(graphLockOperation.lockComponent(any(), any())).thenReturn(lockResult); - //doNothing().when(titanDao).commit(); + //doNothing().when(janusGraphDao).commit(); Either result; @@ -327,16 +327,16 @@ public class PropertyBusinessLogicTest { resource.setUniqueId(resourceId); Field baseBusinessLogic3; - baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("titanDao"); + baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("janusGraphDao"); baseBusinessLogic3.setAccessible(true); - baseBusinessLogic3.set(bl, titanDao); + baseBusinessLogic3.set(bl, janusGraphDao); Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource)); StorageOperationStatus lockResult = StorageOperationStatus.OK; when(graphLockOperation.lockComponent(any(), any())).thenReturn(lockResult); - //doNothing().when(titanDao).commit(); + //doNothing().when(janusGraphDao).commit(); Either result; @@ -363,16 +363,16 @@ public class PropertyBusinessLogicTest { resource.setUniqueId(resourceId); Field baseBusinessLogic3; - baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("titanDao"); + baseBusinessLogic3 = bl.getClass().getSuperclass().getDeclaredField("janusGraphDao"); baseBusinessLogic3.setAccessible(true); - baseBusinessLogic3.set(bl, titanDao); + baseBusinessLogic3.set(bl, janusGraphDao); Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource)); StorageOperationStatus lockResult = StorageOperationStatus.OK; when(graphLockOperation.lockComponent(any(), any())).thenReturn(lockResult); - //doNothing().when(titanDao).commit(); + //doNothing().when(janusGraphDao).commit(); Either result; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java index 2e9112607f..00e3f03074 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java @@ -35,7 +35,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.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.tosca.constraints.GreaterOrEqualConstraint; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.UserBusinessLogic; @@ -81,7 +81,7 @@ public class ResourceImportManagerTest { configurationManager = new ConfigurationManager(configurationSource); Configuration configuration = new Configuration(); - configuration.setTitanInMemoryGraph(true); + configuration.setJanusGraphInMemoryGraph(true); configurationManager.setConfiguration(configuration); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java index 9dab8f4b96..28f97ad858 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ServiceDistributionBLTest.java @@ -23,7 +23,7 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java index fdaedbb942..c4b76a2a37 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogicTest.java @@ -59,7 +59,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CsarOperation; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java index 63018ee232..7484ff0e09 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java @@ -15,7 +15,7 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.common.api.ArtifactTypeEnum; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java index 83966be4d5..5fa074705d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicTest.java @@ -104,14 +104,14 @@ public class HealthCheckBusinessLogicTest extends BeConfDependentTest{ } @Test - public void testGetTitanHealthCheck() throws Exception { + public void testGetJanusGraphHealthCheck() throws Exception { HealthCheckBusinessLogic testSubject; List healthCheckInfos = new LinkedList<>(); List result; // default test testSubject = createTestSubject(); - result = testSubject.getTitanHealthCheck(healthCheckInfos); + result = testSubject.getJanusGraphHealthCheck(healthCheckInfos); } @Test 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 a2f8b09566..1cdd089539 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 @@ -40,7 +40,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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; @@ -48,7 +48,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IAdditionalInformationOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -77,7 +77,7 @@ public class AdditionalInformationBusinessLogicTest { @Mock private ComponentsUtils componentsUtils; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private IAdditionalInformationOperation additionalInformationOperation; @Mock diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java index 8029e788d9..c4a3e59dab 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArchiveBusinessLogicTest.java @@ -13,8 +13,8 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.exception.ResponseFormat; 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 066813448f..65718630da 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 @@ -41,16 +41,16 @@ 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.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.model.operations.api.*; import org.openecomp.sdc.be.model.operations.impl.ArtifactOperation; @@ -115,7 +115,7 @@ public class ArtifactBusinessLogicTest { @Mock private IGraphLockOperation graphLockOperation; @Mock - TitanDao titanDao; + JanusGraphDao janusGraphDao; @Mock private IInterfaceLifecycleOperation interfaceLifecycleOperation; @Mock @@ -560,7 +560,7 @@ public class ArtifactBusinessLogicTest { when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat()); artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME, USER, INSTANCE_ID, true, false); - verify(titanDao, times(1)).commit(); + verify(janusGraphDao, times(1)).commit(); } @Test 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 9b4482c5ec..27e9f3f871 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 @@ -50,9 +50,9 @@ 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.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; @@ -78,10 +78,10 @@ import org.openecomp.sdc.be.model.ResourceMetadataDefinition; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; -import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; @@ -154,9 +154,9 @@ public class ArtifactsBusinessLogicTest { public ComponentsUtils componentsUtils; @Mock public ToscaOperationFacade toscaOperationFacade; - TitanDao mockTitanDao = Mockito.mock(TitanDao.class); + JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); @Mock - TitanDao titanDao; + JanusGraphDao janusGraphDao; @Mock private UserBusinessLogic userBusinessLogic; @Mock @@ -238,7 +238,7 @@ public class ArtifactsBusinessLogicTest { when(toscaOperationFacade.validateCsarUuidUniqueness(Mockito.anyString())).thenReturn(StorageOperationStatus.OK); Map emptyDataTypes = new HashMap<>(); when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes)); - when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); Either resourceStorageOperationStatusEither = Either .right(StorageOperationStatus.BAD_REQUEST); @@ -511,7 +511,7 @@ public class ArtifactsBusinessLogicTest { when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat()); artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME, USER, INSTANCE_ID, true, false); - verify(titanDao, times(1)).commit(); + verify(janusGraphDao, times(1)).commit(); } private ArtifactDefinition buildArtifactPayload() { @@ -530,7 +530,7 @@ public class ArtifactsBusinessLogicTest { when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat()); artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME, USER, INSTANCE_ID, true, false); - verify(titanDao, times(1)).commit(); + verify(janusGraphDao, times(1)).commit(); return artifactDefinition; } 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 88918de1a3..55f4367c21 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 @@ -11,22 +11,19 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.components.validation.UserValidations; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; 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.PropertyOperation; -import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.exception.ResponseFormat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.when; import fj.data.Either; @@ -40,7 +37,7 @@ public class AttributeBusinessLogicTest { UserValidations userValidations = Mockito.mock(UserValidations.class); ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class); - TitanDao titanDao = Mockito.mock(TitanDao.class); + JanusGraphDao janusGraphDao = Mockito.mock(JanusGraphDao.class); ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); ApplicationDataTypeCache applicationDataTypeCache = Mockito.mock(ApplicationDataTypeCache.class); PropertyOperation propertyOperation = Mockito.mock(PropertyOperation.class); @@ -67,9 +64,9 @@ public class AttributeBusinessLogicTest { baseBusinessLogic2.setAccessible(true); baseBusinessLogic2.set(attributeBusinessLogic, componentsUtils); - baseBusinessLogic3 = attributeBusinessLogic.getClass().getSuperclass().getDeclaredField("titanDao"); + baseBusinessLogic3 = attributeBusinessLogic.getClass().getSuperclass().getDeclaredField("janusGraphDao"); baseBusinessLogic3.setAccessible(true); - baseBusinessLogic3.set(attributeBusinessLogic, titanDao); + baseBusinessLogic3.set(attributeBusinessLogic, janusGraphDao); baseBusinessLogic = attributeBusinessLogic.getClass().getSuperclass().getDeclaredField("toscaOperationFacade"); baseBusinessLogic.setAccessible(true); @@ -185,7 +182,7 @@ public class AttributeBusinessLogicTest { Map data=new HashMap<>(); data.put("ONE",new DataTypeDefinition()); - Either, TitanOperationStatus> allDataTypes = Either.left(data); + Either, JanusGraphOperationStatus> allDataTypes = Either.left(data); when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes); when(propertyOperation.isPropertyDefaultValueValid(anyObject(),anyObject())).thenReturn(true); @@ -301,7 +298,7 @@ public class AttributeBusinessLogicTest { Map data=new HashMap<>(); data.put("ONE",new DataTypeDefinition()); - Either, TitanOperationStatus> allDataTypes = Either.left(data); + Either, JanusGraphOperationStatus> allDataTypes = Either.left(data); when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes); when(propertyOperation.isPropertyDefaultValueValid(anyObject(),anyObject())).thenReturn(true); 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 55b87f41cf..b75d52cb42 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 @@ -28,8 +28,8 @@ import org.openecomp.sdc.be.components.validation.CapabilitiesValidation; 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.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +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.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -45,8 +45,8 @@ import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; 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.jsontitan.operations.CapabilitiesOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CapabilitiesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; import org.openecomp.sdc.be.user.Role; @@ -76,7 +76,7 @@ public class CapabilitiesBusinessLogicTest { private final String componentId = "resourceId1"; private final String capabilityId = "uniqueId1"; - private final TitanDao mockTitanDao = Mockito.mock(TitanDao.class); + private final JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); private final UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class); private final ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); private final UserValidations userValidations = Mockito.mock(UserValidations.class); @@ -127,13 +127,13 @@ public class CapabilitiesBusinessLogicTest { "0", "10")))); when(capabilitiesOperation.deleteCapabilities( anyObject(), anyString())) .thenReturn(StorageOperationStatus.OK); - when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); capabilitiesBusinessLogicMock = new CapabilitiesBusinessLogic(); capabilitiesBusinessLogicMock.setComponentsUtils(componentsUtils); capabilitiesBusinessLogicMock.setUserAdmin(mockUserAdmin); capabilitiesBusinessLogicMock.setGraphLockOperation(graphLockOperation); - capabilitiesBusinessLogicMock.setTitanGenericDao(mockTitanDao); + capabilitiesBusinessLogicMock.setJanusGraphGenericDao(mockJanusGraphDao); capabilitiesBusinessLogicMock.setToscaOperationFacade(toscaOperationFacade); capabilitiesBusinessLogicMock.setUserValidations(userValidations); capabilitiesBusinessLogicMock.setCapabilitiesOperation(capabilitiesOperation); @@ -178,7 +178,7 @@ public class CapabilitiesBusinessLogicTest { } @Test - public void shouldFailCreateCapabilitiesWhenOperationFailedInTitan(){ + public void shouldFailCreateCapabilitiesWhenOperationFailedInJanusGraph(){ List capabilityDefinitions = createMockCapabilityListToReturn( createCapability("capName2", "capDesc", "capType", "source1", "0", "10")); @@ -274,7 +274,7 @@ public class CapabilitiesBusinessLogicTest { } @Test - public void shouldFailUpdateCapabilitiesWhenOperationFailedInTitan(){ + public void shouldFailUpdateCapabilitiesWhenOperationFailedInJanusGraph(){ List capabilityDefinitions = createMockCapabilityListToReturn( createCapability("capName2", "capDesc", "capType", "source1", "0", "10")); @@ -312,7 +312,7 @@ public class CapabilitiesBusinessLogicTest { } @Test - public void shouldFailDeleteCapabilitiesWhenOperationFailedInTitan(){ + public void shouldFailDeleteCapabilitiesWhenOperationFailedInJanusGraph(){ Resource resource = createComponent(true); resource.setComponentType(ComponentTypeEnum.RESOURCE); validateUserRoles(Role.ADMIN, Role.DESIGNER); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java index 00c172e8e6..66d7225360 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java @@ -30,7 +30,7 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -54,7 +54,7 @@ import static org.mockito.Mockito.when; public class CapabilityTypeImportManagerTest { private static final CapabilityTypeOperation capabilityTypeOperation = mock(CapabilityTypeOperation.class); private static final ComponentsUtils componentsUtils = mock(ComponentsUtils.class); - private static final TitanGenericDao titanGenericDao = mock(TitanGenericDao.class); + private static final JanusGraphGenericDao JANUS_GRAPH_GENERIC_DAO = mock(JanusGraphGenericDao.class); private static final PropertyOperation propertyOperation = mock(PropertyOperation.class); private CommonImportManager commonImportManager = new CommonImportManager(componentsUtils, propertyOperation); private CapabilityTypeImportManager manager = new CapabilityTypeImportManager(capabilityTypeOperation, commonImportManager); @@ -69,7 +69,7 @@ public class CapabilityTypeImportManagerTest { }); - when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao); + when(propertyOperation.getJanusGraphGenericDao()).thenReturn(JANUS_GRAPH_GENERIC_DAO); when(capabilityTypeOperation.getCapabilityType(Mockito.anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java index 15eeb31f48..3402a5b637 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java @@ -10,7 +10,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -34,7 +34,7 @@ public class CommonImportManagerTest { @Mock PropertyOperation propertyOperation; @Mock - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; @Mock private Function> validator; @@ -51,7 +51,7 @@ public class CommonImportManagerTest { public void startUp() { commonImportManager = new CommonImportManager(componentsUtils, propertyOperation); - when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao); + when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao); } @Test @@ -71,7 +71,7 @@ public class CommonImportManagerTest { verify(elementAdder, never()).apply(Mockito.any()); verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any()); - verify(titanGenericDao).rollback(); + verify(janusGraphGenericDao).rollback(); } @Test @@ -91,7 +91,7 @@ public class CommonImportManagerTest { verify(elementAdder, never()).apply(Mockito.any()); verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any()); - verify(titanGenericDao).rollback(); + verify(janusGraphGenericDao).rollback(); } @Test @@ -114,7 +114,7 @@ public class CommonImportManagerTest { verify(elementAdder, never()).apply(Mockito.any()); verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any()); - verify(titanGenericDao).rollback(); + verify(janusGraphGenericDao).rollback(); } @Test @@ -139,7 +139,7 @@ public class CommonImportManagerTest { verify(elementAdder).apply(type1); verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any()); - verify(titanGenericDao).rollback(); + verify(janusGraphGenericDao).rollback(); } @@ -160,7 +160,7 @@ public class CommonImportManagerTest { verify(elementAdder).apply(type1); verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any()); - verify(titanGenericDao).commit(); + verify(janusGraphGenericDao).commit(); assertEquals(type1, result.left().value().get(0).getLeft()); assertEquals(true, result.left().value().get(0).getRight()); @@ -189,7 +189,7 @@ public class CommonImportManagerTest { verify(elementAdder, never()).apply(Mockito.any()); verify(elementUpgrader).apply(type1_1, type1); - verify(titanGenericDao).rollback(); + verify(janusGraphGenericDao).rollback(); } @Test @@ -209,7 +209,7 @@ public class CommonImportManagerTest { verify(elementAdder, never()).apply(Mockito.any()); verify(elementUpgrader).apply(type1_1, type1); - verify(titanGenericDao).commit(); + verify(janusGraphGenericDao).commit(); assertEquals(type1_1, result.left().value().get(0).getLeft()); assertEquals(true, result.left().value().get(0).getRight()); @@ -232,7 +232,7 @@ public class CommonImportManagerTest { verify(elementAdder, never()).apply(Mockito.any()); verify(elementUpgrader).apply(type1_1, type1); - verify(titanGenericDao).commit(); + verify(janusGraphGenericDao).commit(); assertEquals(type1_1, result.left().value().get(0).getLeft()); assertEquals(false, result.left().value().get(0).getRight()); 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 50bb276c97..ad5ddafe0e 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 @@ -46,9 +46,9 @@ import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.*; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; @@ -74,16 +74,14 @@ import org.openecomp.sdc.be.model.RequirementDefinition; 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.jsontitan.operations.ForwardingPathOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.function.BiPredicate; - import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertSame; @@ -94,7 +92,6 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.when; /** * The test suite designed for test functionality of ComponentInstanceBusinessLogic class @@ -143,7 +140,7 @@ public class ComponentInstanceBusinessLogicTest { @Mock private UserValidations userValidations; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private ArtifactsBusinessLogic artifactBusinessLogic; @Mock @@ -716,8 +713,8 @@ public class ComponentInstanceBusinessLogicTest { // default test testSubject = createTestSubject(); - TitanDao mock = Mockito.mock(TitanDao.class); - testSubject.setTitanGenericDao(mock); + JanusGraphDao mock = Mockito.mock(JanusGraphDao.class); + testSubject.setJanusGraphGenericDao(mock); result = testSubject.deleteComponentInstance(containerComponentParam, containerComponentId, componentInstanceId, userId); } @@ -1203,7 +1200,7 @@ public class ComponentInstanceBusinessLogicTest { when(toscaOperationFacade.getToscaElement(containerComponentId)).thenReturn(leftServiceOp); when(toscaOperationFacade.getToscaElement(eq(containerComponentId), any(ComponentParametersView.class))) .thenReturn(leftServiceOp); - when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); when(graphLockOperation.unlockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service))) .thenReturn(StorageOperationStatus.OK); when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service))) @@ -1231,7 +1228,7 @@ public class ComponentInstanceBusinessLogicTest { when(toscaOperationFacade.getToscaElement(containerComponentId)).thenReturn(leftServiceOp); when(toscaOperationFacade.getToscaElement(eq(containerComponentId), any(ComponentParametersView.class))) .thenReturn(leftServiceOp); - when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); when(graphLockOperation.unlockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service))) .thenReturn(StorageOperationStatus.OK); when(graphLockOperation.lockComponent(Mockito.anyString(), eq(NodeTypeEnum.Service))) @@ -1460,7 +1457,7 @@ public class ComponentInstanceBusinessLogicTest { .thenReturn(result2); when(toscaOperationFacade.getToscaElement(eq(service.getUniqueId()), any(ComponentParametersView.class))) .thenReturn(cont); - when(titanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); result = componentInstanceBusinessLogic .batchDeleteComponentInstance(containerComponentParam, containerComponentId, diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java index 9219de1aac..d6b59205aa 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogicTest.java @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.user.IUserBusinessLogic; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java index 5cf3ef3a95..f53d2f9094 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/DataTypesServiceTest.java @@ -4,14 +4,12 @@ import fj.data.Either; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; + import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import org.mockito.Mockito; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; @@ -26,8 +24,8 @@ public class DataTypesServiceTest { DataTypesService dataTypesService = new DataTypesService(componentsUtils); Map mapreturn = new HashMap<>(); - TitanOperationStatus titanOperationStatus = TitanOperationStatus.NOT_FOUND; - Either, TitanOperationStatus> allDataTypes; + JanusGraphOperationStatus janusGraphOperationStatus = JanusGraphOperationStatus.NOT_FOUND; + Either, JanusGraphOperationStatus> allDataTypes; @Before public void setup() { @@ -44,7 +42,7 @@ public class DataTypesServiceTest { @Test public void getAllDataTypes_failure() { - allDataTypes = Either.right(titanOperationStatus); + allDataTypes = Either.right(janusGraphOperationStatus); when(applicationDataTypeCache.getAll()).thenReturn(allDataTypes); Assert.assertEquals(true,dataTypesService.getAllDataTypes(applicationDataTypeCache).isRight()); } 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 d445c9c88c..75355b984b 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 @@ -13,12 +13,12 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; @@ -32,7 +32,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.ElementOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -73,13 +73,13 @@ public class ElementBLTest { private Resource notDeletedResource = new Resource(); @Mock - private TitanGenericDao titanGenericDao; + private JanusGraphGenericDao janusGraphGenericDao; @Mock private ToscaOperationFacade toscaOperationFacade; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private UserValidations userValidations; @@ -109,7 +109,7 @@ public class ElementBLTest { initServicesList(); initResourceslist(); - when(titanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); } private void initCategoriesList() { @@ -158,9 +158,10 @@ public class ElementBLTest { public void testFetchElementsByCategoryName_filterDeleted() { ArgumentCaptor criteriaCapture = ArgumentCaptor.forClass(Map.class); - when(titanGenericDao.getByCriteria(eq(NodeTypeEnum.ServiceNewCategory), criteriaCapture.capture(), eq(CategoryData.class))) + when(janusGraphGenericDao + .getByCriteria(eq(NodeTypeEnum.ServiceNewCategory), criteriaCapture.capture(), eq(CategoryData.class))) .thenReturn(Either.left(categories)); - when(titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ServiceNewCategory), + when(janusGraphGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ServiceNewCategory), CATEGORY_UNIQUE_ID, GraphEdgeLabels.CATEGORY, NodeTypeEnum.Service, ServiceMetadataData.class)) .thenReturn(Either.left(services)); when(toscaOperationFacade.getToscaElement(SERVICE_NOT_DELETED_ID, JsonParseFlagEnum.ParseMetadata)) @@ -185,7 +186,7 @@ public class ElementBLTest { @Test public void testFetchResourcesBySubcategoryUid_filterDeleted() { - when(titanGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceSubcategory), + when(janusGraphGenericDao.getParentNodes(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ResourceSubcategory), CATEGORY_UNIQUE_ID, GraphEdgeLabels.CATEGORY, NodeTypeEnum.Resource, ResourceMetadataData.class)) .thenReturn(Either.left(resources)); 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 6d30003810..6f97621d74 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 @@ -39,7 +39,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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -50,7 +50,7 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.user.Role; @@ -78,7 +78,7 @@ public class ElementBusinessLogicTest { private UserBusinessLogic userAdminManager; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private UserValidations userValidations; 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 2ddfcb497a..6024462292 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 @@ -42,8 +42,8 @@ import org.openecomp.sdc.be.components.validation.AccessValidations; 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.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -56,9 +56,9 @@ import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupInstanceProperty; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; @@ -109,7 +109,7 @@ public class GroupBusinessLogicTest { @Mock private PropertyOperation propertyOperation; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock PolicyTargetsUpdateHandler policyTargetsUpdateHandler; @@ -125,7 +125,7 @@ public class GroupBusinessLogicTest { List groupDefinitions = new ArrayList<>(); GroupDefinition groupDefinition = new GroupDefinition(); groupDefinitions.add(groupDefinition); - when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)); result = test.createGroups(component, groupDefinitions, true); Assert.assertTrue(result.isRight()); } @@ -277,7 +277,7 @@ public class GroupBusinessLogicTest { when(accessValidations.validateUserCanWorkOnComponent("compid", ComponentTypeEnum.SERVICE, "USR01", "DeleteGroup")).thenReturn(component); when(groupsOperation.deleteGroups(anyObject(),anyList())).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND)); - when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); GroupDefinition Gdefinition = test.deleteGroup("compid", ComponentTypeEnum.SERVICE, "GRP.01", "USR01"); } 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 ffeb80ec00..9d7ca19eb5 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 @@ -28,30 +28,21 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import fj.data.Either; -import java.util.Arrays; -import java.util.Optional; -import org.apache.commons.lang3.tuple.ImmutablePair; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.components.property.PropertyDeclarationOrchestrator; import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +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.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -71,14 +62,22 @@ 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; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; 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.GraphLockOperation; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.exception.ResponseFormat; +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; + public class InputsBusinessLogicTest { private static final String COMPONENT_INSTANCE_ID = "instanceId"; @@ -120,7 +119,7 @@ public class InputsBusinessLogicTest { private PropertyOperation propertyOperation; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private DataTypeBusinessLogic dataTypeBusinessLogic; @@ -251,7 +250,7 @@ public class InputsBusinessLogicTest { when(propertyDeclarationOrchestrator.declarePropertiesToInputs(any(), any())).thenReturn(Either.left( declaredPropertiesToInputs)); when(toscaOperationFacadeMock.addInputsToComponent(any(), any())).thenReturn(Either.left(declaredPropertiesToInputs)); - when(titanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); when(graphLockOperation.lockComponent(any(), any())).thenReturn(StorageOperationStatus.OK); when(graphLockOperation.unlockComponent(any(), any())).thenReturn(StorageOperationStatus.OK); when(componentInstanceBusinessLogic.setInputConstraint(any())).thenReturn(Collections.emptyList()); @@ -456,7 +455,7 @@ public class InputsBusinessLogicTest { // for createListInputsInGraph: when(toscaOperationFacadeMock.addInputsToComponent(anyMap(), eq(COMPONENT_ID))).thenReturn(Either.left(Arrays.asList(listInput))); // for rollback/commit: - when(titanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); // for unlock resource when(graphLockOperation.unlockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK); @@ -510,7 +509,7 @@ public class InputsBusinessLogicTest { when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service)).thenReturn(StorageOperationStatus.OK); when(toscaOperationFacadeMock.addDataTypesToComponent(dataTypesMapCaptor.capture(), eq(COMPONENT_ID))).thenReturn(Either.left(new ArrayList<>())); when(propertyDeclarationOrchestrator.getPropOwnerId(componentInstInputsMap)).thenReturn(COMPONENT_INSTANCE_ID); - when(applicationDataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + when(applicationDataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)); when(componentsUtilsMock.getResponseFormat(ActionStatus.DATA_TYPE_CANNOT_BE_EMPTY)).thenReturn(new ResponseFormat()); Either, ResponseFormat> result = 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 d5b1f06b82..42eca256a2 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 @@ -44,8 +44,8 @@ import org.openecomp.sdc.be.components.validation.InterfaceOperationValidation; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -57,9 +57,9 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; -import org.openecomp.sdc.be.model.jsontitan.operations.InterfaceOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; 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.InterfaceLifecycleOperation; @@ -89,7 +89,7 @@ public class InterfaceOperationBusinessLogicTest { @Mock private IGraphLockOperation graphLockOperation; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private InterfaceLifecycleOperation interfaceLifecycleOperation; @Mock @@ -122,7 +122,7 @@ public class InterfaceOperationBusinessLogicTest { when(interfaceOperationValidation .validateDeleteOperationContainsNoMappedOutput(any(), any(), any())) .thenReturn(Either.left(true)); - when(titanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); } private List createInputsForResource() { @@ -432,7 +432,7 @@ public class InterfaceOperationBusinessLogicTest { @Test public void getInterfaceOperationTestFailOnException() { - when(titanDao.commit()).thenThrow(new RuntimeException()); + when(janusGraphDao.commit()).thenThrow(new RuntimeException()); Assert.assertTrue(interfaceOperationBusinessLogic.getInterfaceOperation(resourceId, interfaceId, Collections.singletonList(operationId), user, true).isRight()); } 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 e55578c989..d5abdabec3 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 @@ -51,8 +51,8 @@ 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.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.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; @@ -72,8 +72,8 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; 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.PolicyTypeOperation; @@ -98,7 +98,7 @@ public class PolicyBusinessLogicTest { @Mock private UserValidations userValidations; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private ApplicationDataTypeCache dataTypeCache; @Mock @@ -144,7 +144,7 @@ public class PolicyBusinessLogicTest { public void initBl() { businessLogic.setComponentsUtils(componentsUtils); businessLogic.setToscaOperationFacade(toscaOperationFacade); - businessLogic.setTitanGenericDao(titanDao); + businessLogic.setJanusGraphGenericDao(janusGraphDao); businessLogic.setUserValidations(userValidations); businessLogic.setGraphLockOperation(graphLockOperation); businessLogic.setPolicyTypeOperation(policyTypeOperation); @@ -452,11 +452,11 @@ public class PolicyBusinessLogicTest { } private void stubCommit() { - when(titanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); } private void stubRollback() { - when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); } private void stubUnlockAndCommit() { 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 04f0a58ebf..3b9a43af28 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 @@ -45,7 +45,7 @@ import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; import org.openecomp.sdc.be.components.utils.ResourceBuilder; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -55,7 +55,7 @@ import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; @@ -73,7 +73,7 @@ public class PolicyPropertiesBusinessLogicTest { private UserValidations userValidations; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private ToscaOperationFacade toscaOperationFacade; @@ -90,7 +90,7 @@ public class PolicyPropertiesBusinessLogicTest { @Before public void setUp() throws Exception { testInstance.setUserValidations(userValidations); - testInstance.setTitanGenericDao(titanDao); + testInstance.setJanusGraphGenericDao(janusGraphDao); testInstance.setToscaOperationFacade(toscaOperationFacade); testInstance.setComponentsUtils(componentsUtils); @@ -121,7 +121,7 @@ public class PolicyPropertiesBusinessLogicTest { @After public void tearDown() { - verify(titanDao).commit(); + verify(janusGraphDao).commit(); } @Test 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 db74b2d2ed..d9be41136d 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 @@ -34,7 +34,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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.User; @@ -63,7 +63,7 @@ public class PolicyTypeBusinessLogicTest { @InjectMocks private PolicyTypeBusinessLogic testInstance; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private PolicyTypeOperation policyTypeOperation; @Mock 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 e8d7300733..dd523b8b36 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 @@ -36,7 +36,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.components.validation.ValidationUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -48,7 +48,7 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -87,7 +87,7 @@ public class ProductBusinessLogicTest { private ToscaOperationFacade toscaOperationFacade; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private ValidationUtils validationUtils; 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 3cac5f5b15..da726505af 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 @@ -28,8 +28,8 @@ import org.openecomp.sdc.be.components.validation.RequirementValidation; 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.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -42,8 +42,8 @@ import org.openecomp.sdc.be.model.RequirementDefinition; 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.jsontitan.operations.RequirementOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.RequirementOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; import org.openecomp.sdc.be.user.Role; @@ -73,7 +73,7 @@ public class RequirementBusinessLogicTest { private final String componentId = "resourceId1"; private final String requirementId = "uniqueId1"; - private final TitanDao mockTitanDao = Mockito.mock(TitanDao.class); + private final JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); private final UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class); private final ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); private final UserValidations userValidations = Mockito.mock(UserValidations.class); @@ -124,14 +124,14 @@ public class RequirementBusinessLogicTest { "0", "10")))); when(requirementOperation.deleteRequirements( anyObject(), anyString())) .thenReturn(StorageOperationStatus.OK); - when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); requirementsBusinessLogicMock = new RequirementBusinessLogic(); requirementsBusinessLogicMock.setComponentsUtils(componentsUtils); requirementsBusinessLogicMock.setUserAdmin(mockUserAdmin); requirementsBusinessLogicMock.setGraphLockOperation(graphLockOperation); - requirementsBusinessLogicMock.setTitanGenericDao(mockTitanDao); + requirementsBusinessLogicMock.setJanusGraphGenericDao(mockJanusGraphDao); requirementsBusinessLogicMock.setToscaOperationFacade(toscaOperationFacade); requirementsBusinessLogicMock.setUserValidations(userValidations); requirementsBusinessLogicMock.setRequirementOperation(requirementOperation); @@ -265,7 +265,7 @@ public class RequirementBusinessLogicTest { } @Test - public void shouldFailUpdateRequirementWhenOperationFailedInTitan(){ + public void shouldFailUpdateRequirementWhenOperationFailedInJanusGraph(){ List requirementDefinitions = createMockRequirementListToReturn( createRequirement("reqName", "capType", "node", "source1", "6", "11")); @@ -287,7 +287,7 @@ public class RequirementBusinessLogicTest { @Test - public void shouldFailDeleteRequirementWhenOperationFailedInTitan(){ + public void shouldFailDeleteRequirementWhenOperationFailedInJanusGraph(){ Resource resource = createComponent(true); resource.setComponentType(ComponentTypeEnum.RESOURCE); validateUserRoles(Role.ADMIN, Role.DESIGNER); 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 9b5387c7b9..5844047784 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 @@ -45,8 +45,8 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; 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.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -62,10 +62,10 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; @@ -143,7 +143,7 @@ public class ResourceBusinessLogicTest { final ServletContext servletContext = Mockito.mock(ServletContext.class); IElementOperation mockElementDao; - TitanDao mockTitanDao = Mockito.mock(TitanDao.class); + JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); UserBusinessLogic mockUserAdmin = Mockito.mock(UserBusinessLogic.class); ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); NodeTypeOperation nodeTypeOperation = Mockito.mock(NodeTypeOperation.class); @@ -242,7 +242,7 @@ public class ResourceBusinessLogicTest { when(toscaOperationFacade.createToscaComponent(any(Resource.class))).thenReturn(eitherCreate); Map emptyDataTypes = new HashMap<>(); when(applicationDataTypeCache.getAll()).thenReturn(Either.left(emptyDataTypes)); - when(mockTitanDao.commit()).thenReturn(TitanOperationStatus.OK); + when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); // BL object artifactManager.setNodeTemplateOperation(nodeTemplateOperation); @@ -255,7 +255,7 @@ public class ResourceBusinessLogicTest { bl.setGraphLockOperation(graphLockOperation); bl.setArtifactsManager(artifactManager); bl.setPropertyOperation(propertyOperation); - bl.setTitanGenericDao(mockTitanDao); + bl.setJanusGraphGenericDao(mockJanusGraphDao); bl.setApplicationDataTypeCache(applicationDataTypeCache); bl.setCacheManagerOperation(cacheManager); bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java index e54ac699db..67f7e2d5b2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceInstanceBusinessLogicTest.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java index 5c539477d5..c8e3fd9a22 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogicTest.java @@ -37,14 +37,14 @@ 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.cassandra.AuditCassandraDao; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CacheMangerOperation; @@ -75,9 +75,7 @@ import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; public class ServiceBusinessLogicTest { @@ -93,7 +91,7 @@ public class ServiceBusinessLogicTest { private AuditCassandraDao auditingDao = Mockito.mock(AuditCassandraDao.class); private ArtifactsBusinessLogic artifactBl = Mockito.mock(ArtifactsBusinessLogic.class); private GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class); - private TitanDao mockTitanDao = Mockito.mock(TitanDao.class); + private JanusGraphDao mockJanusGraphDao = Mockito.mock(JanusGraphDao.class); private ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); private CacheMangerOperation cacheManager = Mockito.mock(CacheMangerOperation.class); private GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class); @@ -168,7 +166,7 @@ public class ServiceBusinessLogicTest { bl.setUserAdmin(mockUserAdmin); bl.setArtifactBl(artifactBl); bl.setGraphLockOperation(graphLockOperation); - bl.setTitanGenericDao(mockTitanDao); + bl.setJanusGraphGenericDao(mockJanusGraphDao); bl.setToscaOperationFacade(toscaOperationFacade); bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic); bl.setComponentsUtils(componentsUtils); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java index 6f23faa25b..a37feb950e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogicTest.java @@ -11,7 +11,7 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.exception.ResponseFormat; import java.util.Arrays; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java index 7cad89c2ec..e12bfb445f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/GroupMembersUpdateOperationTest.java @@ -20,7 +20,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.ArrayList; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java index dbacd82e74..3819175c30 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java @@ -17,7 +17,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.List; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java index 82bf7612df..2723746ae4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java @@ -36,7 +36,7 @@ import org.openecomp.sdc.be.datatypes.elements.PolicyTargetType; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.List; 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 151303fa26..347c95217d 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 @@ -44,7 +44,7 @@ import org.openecomp.sdc.be.components.csar.YamlTemplateParsingHandler; import org.openecomp.sdc.be.components.impl.AnnotationBusinessLogic; import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic; import org.openecomp.sdc.be.components.validation.AnnotationValidator; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.operations.impl.AnnotationTypeOperations; @@ -59,7 +59,7 @@ public class YamlTemplateParsingHandlerTest { @Mock private AnnotationValidator annotationValidator; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Mock private User user; @@ -103,7 +103,7 @@ public class YamlTemplateParsingHandlerTest { AnnotationBusinessLogic annotationBusinessLogic = new AnnotationBusinessLogic(annotationTypeOperations, annotationValidator); - handler = new YamlTemplateParsingHandler(titanDao, groupTypeBusinessLogic, annotationBusinessLogic); + handler = new YamlTemplateParsingHandler(janusGraphDao, groupTypeBusinessLogic, annotationBusinessLogic); stubGetGroupType(); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java index d85226d64d..f8401e8aa5 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransitionTest.java @@ -49,15 +49,18 @@ public class CertificationChangeTransitionTest extends LifecycleTestBase { super.setup(); // checkout transition object - certifyTransitionObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + certifyTransitionObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); certifyTransitionObj.setConfigurationManager(configurationManager); certifyTransitionObj.setLifeCycleOperation(toscaElementLifecycleOperation); - certificationCancelObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + certificationCancelObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); certificationCancelObj.setConfigurationManager(configurationManager); certificationCancelObj.setLifeCycleOperation(toscaElementLifecycleOperation); - certificationFailObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + certificationFailObj = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); certificationFailObj.setConfigurationManager(configurationManager); certificationFailObj.setLifeCycleOperation(toscaElementLifecycleOperation); @@ -74,7 +77,8 @@ public class CertificationChangeTransitionTest extends LifecycleTestBase { User user = new User("cs0008", "Carlos", "Santana", "cs@sdc.com", "DESIGNER", null); for (LifeCycleTransitionEnum value : LifeCycleTransitionEnum.values()) { - new CertificationChangeTransition(value, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + new CertificationChangeTransition(value, componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java index 3a686e5a33..70833f40b6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTest.java @@ -33,8 +33,8 @@ import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CapabilityOperation; import org.openecomp.sdc.be.tosca.ToscaExportHandler; @@ -66,7 +66,8 @@ public class CertificationRequestTest extends LifecycleTestBase { @Before public void setup() { super.setup(); - rfcObj = new CertificationRequestTransition(componentsUtils, toscaElementLifecycleOperation, serviceBusinessLogic, toscaOperationFacade, titanDao); + rfcObj = new CertificationRequestTransition(componentsUtils, toscaElementLifecycleOperation, serviceBusinessLogic, toscaOperationFacade, + janusGraphDao); rfcObj.setConfigurationManager(configurationManager); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java index 0f18de2ce5..48b79eafd3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CertificationRequestTransitionTest.java @@ -26,14 +26,14 @@ import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.exception.ResponseFormat; @@ -48,7 +48,7 @@ public class CertificationRequestTransitionTest extends LifecycleTestBase { private CertificationRequestTransition createTestSubject() { return new CertificationRequestTransition( new ComponentsUtils(new AuditingManager(new AuditingDao(), new AuditCassandraDao(), new TestConfigurationProvider())), - new ToscaElementLifecycleOperation(), new ServiceBusinessLogic(), new ToscaOperationFacade(), new TitanDao(new TitanGraphClient())); + new ToscaElementLifecycleOperation(), new ServiceBusinessLogic(), new ToscaOperationFacade(), new JanusGraphDao(new JanusGraphClient())); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java index d6bf92fb98..7e1310dff0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckinTest.java @@ -44,7 +44,8 @@ public class CheckinTest extends LifecycleTestBase { super.setup(); // checkout transition object - checkinObj = new CheckinTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + checkinObj = new CheckinTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); checkinObj.setLifeCycleOperation(toscaElementLifecycleOperation); checkinObj.setConfigurationManager(configurationManager); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java index 4097f7aa79..8f5362a12d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTest.java @@ -48,7 +48,8 @@ public class CheckoutTest extends LifecycleTestBase { super.setup(); // checkout transition object - checkoutObj = new CheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + checkoutObj = new CheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); checkoutObj.setLifeCycleOperation(toscaElementLifecycleOperation); checkoutObj.setConfigurationManager(configurationManager); bl.setToscaOperationFacade(toscaOperationFacade); 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 9cdeaec721..e2432ce584 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 @@ -31,18 +31,18 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; -import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaElementLifecycleOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.user.Role; @@ -76,7 +76,7 @@ public class LifecycleTestBase { protected Service serviceResponse; protected static ConfigurationManager configurationManager = null; protected ResponseFormatManager responseManager = null; - protected TitanDao titanDao = Mockito.mock(TitanDao.class); + protected JanusGraphDao janusGraphDao = Mockito.mock(JanusGraphDao.class); protected ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); protected static ComponentsUtils componentsUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java index 3d3bb24432..ac43c535c1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTest.java @@ -43,7 +43,8 @@ public class UndoCheckoutTest extends LifecycleTestBase { super.setup(); // checkout transition object - undoCheckoutObj = new UndoCheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, titanDao); + undoCheckoutObj = new UndoCheckoutTransition(componentsUtils, toscaElementLifecycleOperation, toscaOperationFacade, + janusGraphDao); undoCheckoutObj.setLifeCycleOperation(toscaElementLifecycleOperation); undoCheckoutObj.setConfigurationManager(configurationManager); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java index 89b82b91d2..5f1ddd2563 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java @@ -14,7 +14,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.List; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java index ed554d20f5..2eb45df6f1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/TopologyComparatorTest.java @@ -13,7 +13,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import static org.junit.Assert.*; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java index 26b0034704..e8b2535f88 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java @@ -19,7 +19,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import java.util.List; import java.util.Map; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java index b815251ea1..ef20068397 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java @@ -18,7 +18,7 @@ import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import java.util.List; import java.util.stream.Stream; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java index e1d4d39e52..bbeae6db75 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/input/BaseComponentInputsMerge.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.components.utils.ResourceBuilder; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import java.util.List; import java.util.Map; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java index 817aa5dde3..3506959db4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentCapabilitiesPropertiesMergeBLTest.java @@ -17,7 +17,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import java.util.Arrays; import java.util.List; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java index d4d79b94ce..19181c97a1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceArtifactsMergeTest.java @@ -10,7 +10,7 @@ import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java index af6b72ef5d..65783fd13d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java @@ -21,7 +21,7 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java index f94906b90e..8385ea8f90 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInputsRedeclareHandlerTest.java @@ -21,7 +21,7 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import java.util.Collections; import java.util.List; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java index 69caa8e389..5e4fb9ee1a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMergeTest.java @@ -24,7 +24,7 @@ import org.openecomp.sdc.be.model.ComponentInstanceInterface; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.UserRoleEnum; import org.openecomp.sdc.test.utils.InterfaceOperationTestUtils; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java index c9c9f666dd..38506e1184 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogicTest.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java index c6e5bed950..5d69a82939 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.components.utils.ResourceBuilder; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java index 1b6aa00c69..eef868d86a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceRelationMergeTest.java @@ -18,7 +18,7 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java index 65f88358a5..6f1725d062 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java @@ -9,7 +9,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ExternalReferencesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ExternalReferencesOperation; import javax.annotation.Resource; import java.util.*; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java index 85e4cb2e5b..2cefadab59 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/path/ComponentInstanceForwardingPathMergeTest.java @@ -13,7 +13,7 @@ import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.common.api.UserRoleEnum; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java index 5d5ccb0551..228b82149e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java @@ -20,7 +20,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.HashMap; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java index 32edf3e631..54fbdbc113 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstanceInputsMergeBLTest.java @@ -14,7 +14,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.Collections; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java index 98cd89c9a9..ee43f11231 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/ComponentInstancePropertiesMergeBLTest.java @@ -12,7 +12,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.Collections; 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 ef87dba483..b1585ff254 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 @@ -11,11 +11,11 @@ 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -39,11 +39,11 @@ public class MergeInstanceUtilsTest { private ToscaOperationFacade toscaOperationFacade; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @Before public void startUp() { - ExceptionUtils exceptionUtils = new ExceptionUtils(titanDao); + ExceptionUtils exceptionUtils = new ExceptionUtils(janusGraphDao); mergeInstanceUtils = new MergeInstanceUtils(toscaOperationFacade, exceptionUtils); } @@ -121,7 +121,7 @@ public class MergeInstanceUtilsTest { when(toscaOperationFacade.getToscaElement("inst1Uid")).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); assertThatExceptionOfType(StorageException.class) .isThrownBy(() -> mergeInstanceUtils.mapOldToNewCapabilitiesOwnerIds(container, oldVf, "inst1", emptyList())); - verify(titanDao).rollback(); + verify(janusGraphDao).rollback(); } @Test 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 0af5915c21..095463b9ca 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 @@ -6,14 +6,14 @@ import org.junit.Before; import org.openecomp.sdc.be.components.BeConfDependentTest; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; -import org.openecomp.sdc.be.components.path.beans.TitanGraphTestSetup; +import org.openecomp.sdc.be.components.path.beans.JanusGraphTestSetup; import org.openecomp.sdc.be.components.path.utils.GraphTestUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; @@ -25,7 +25,7 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.tosca.CapabilityRequirementConverter; @@ -48,7 +48,7 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme private ForwardingPathDataDefinition forwardingPathDataDefinition; @Autowired - protected TitanGraphClient titanGraphClient; + protected JanusGraphClient janusGraphClient; @Autowired protected CapabilityRequirementConverter capabiltyRequirementConvertor; @@ -66,11 +66,11 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme protected ComponentInstanceBusinessLogic componentInstanceBusinessLogic; @javax.annotation.Resource - protected TitanDao titanDao; + protected JanusGraphDao janusGraphDao; @Before - public void initTitan() { - TitanGraphTestSetup.createGraph(titanGraphClient.getGraph().left().value()); + public void initJanusGraph() { + JanusGraphTestSetup.createGraph(janusGraphClient.getGraph().left().value()); categoryDefinition = new CategoryDefinition(); categoryDefinition.setName(CATEGORY_NAME); } @@ -105,12 +105,13 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, "org.openecomp.resource.abstract.nodes.service"); - GraphTestUtils.createServiceVertex(titanDao, props); + GraphTestUtils.createServiceVertex(janusGraphDao, props); - GraphVertex resourceVertex = GraphTestUtils.createResourceVertex(titanDao, props, ResourceTypeEnum.PNF); + GraphVertex resourceVertex = GraphTestUtils.createResourceVertex(janusGraphDao, props, ResourceTypeEnum.PNF); resourceVertex.setJsonMetadataField(JsonPresentationFields.VERSION, "0.1"); - Either vertexTitanOperationStatusEither = titanDao.updateVertex(resourceVertex); - assertTrue(vertexTitanOperationStatusEither.isLeft()); + Either vertexJanusGraphOperationStatusEither = janusGraphDao + .updateVertex(resourceVertex); + assertTrue(vertexJanusGraphOperationStatusEither.isLeft()); } private Service createTestService() { @@ -153,7 +154,7 @@ public abstract class BaseForwardingPathTest extends BeConfDependentTest impleme cat.setMetadataProperties(metadataProperties); cat.updateMetadataJsonWithCurrentMetadataProperties(); - Either catRes = titanDao.createVertex(cat); + Either catRes = janusGraphDao.createVertex(cat); assertTrue(catRes.isLeft()); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java index fd9e25f475..eca9986209 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathValidatorTest.java @@ -14,7 +14,7 @@ import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java index 09e1a72b44..3656caf904 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/ForwardingPathToscaOperationFacade.java @@ -4,7 +4,7 @@ import fj.data.Either; import org.openecomp.sdc.be.impl.ForwardingPathUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @org.springframework.stereotype.Component("tosca-operation-facade") diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java new file mode 100644 index 0000000000..10bd1ab6ca --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryJanusGraphClient.java @@ -0,0 +1,216 @@ +package org.openecomp.sdc.be.components.path.beans; + + +import org.janusgraph.core.*; +import org.janusgraph.core.schema.ConsistencyModifier; +import org.janusgraph.core.schema.JanusGraphIndex; +import org.janusgraph.core.schema.JanusGraphManagement; +import org.janusgraph.core.util.JanusGraphCleanup; +import org.janusgraph.diskstorage.BackendException; +import org.janusgraph.diskstorage.ResourceUnavailableException; +import org.janusgraph.diskstorage.locking.PermanentLockingException; +import org.janusgraph.graphdb.database.idassigner.IDPoolExhaustedException; +import fj.data.Either; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.openecomp.sdc.be.dao.JanusGraphClientStrategy; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.HashMap; + +@Component("janusgraph-client") +public class InMemoryJanusGraphClient extends JanusGraphClient { + + + private static final Logger logger = LoggerFactory.getLogger(InMemoryJanusGraphClient.class); + + private static final String OK = "GOOD"; + + public InMemoryJanusGraphClient() { + } + + + private JanusGraph graph; + JanusGraphClientStrategy janusGraphClientStrategy; + + public InMemoryJanusGraphClient(JanusGraphClientStrategy janusGraphClientStrategy) { + super(); + this.janusGraphClientStrategy = janusGraphClientStrategy; + logger.info("** JanusGraphClient created"); + } + + @PostConstruct + public JanusGraphOperationStatus createGraph() { + + logger.info("** createGraph started **"); + graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); + createJanusGraphSchema(); + + logger.info("** in memory graph created"); + return JanusGraphOperationStatus.OK; + + } + + + public void cleanupGraph() { + if (graph != null) { + // graph.shutdown(); + graph.close(); + try { + JanusGraphFactory.drop(graph); + } catch (BackendException e) { + e.printStackTrace(); + } + } + } + + public JanusGraphOperationStatus createGraph(String janusGraphCfgFile) { + logger.info("** open graph with {} started", janusGraphCfgFile); + try { + logger.info("openGraph : try to load file {}", janusGraphCfgFile); + graph = JanusGraphFactory.open(janusGraphCfgFile); + if (graph.isClosed()) { + logger.error("janusgraph graph was not initialized"); + return JanusGraphOperationStatus.NOT_CREATED; + } + + } catch (Exception e) { + this.graph = null; + logger.info("createGraph : failed to open JanusGraph graph with configuration file: {}", janusGraphCfgFile, e); + return JanusGraphOperationStatus.NOT_CONNECTED; + } + + logger.info("** JanusGraph graph created "); + + return JanusGraphOperationStatus.OK; + } + + + public Either getGraph() { + if (graph != null) { + return Either.left(graph); + } else { + return Either.right(JanusGraphOperationStatus.NOT_CREATED); + } + } + + public JanusGraphOperationStatus commit() { + if (graph != null) { + try { + graph.tx().commit(); + return JanusGraphOperationStatus.OK; + } catch (Exception e) { + return handleJanusGraphException(e); + } + } else { + return JanusGraphOperationStatus.NOT_CREATED; + } + } + + public JanusGraphOperationStatus rollback() { + if (graph != null) { + try { + // graph.rollback(); + graph.tx().rollback(); + return JanusGraphOperationStatus.OK; + } catch (Exception e) { + return handleJanusGraphException(e); + } + } else { + return JanusGraphOperationStatus.NOT_CREATED; + } + } + + public static JanusGraphOperationStatus handleJanusGraphException(Exception e) { + if (e instanceof JanusGraphConfigurationException) { + return JanusGraphOperationStatus.JANUSGRAPH_CONFIGURATION; + } + if (e instanceof SchemaViolationException) { + return JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION; + } + if (e instanceof PermanentLockingException) { + return JanusGraphOperationStatus.JANUSGRAPH_SCHEMA_VIOLATION; + } + if (e instanceof IDPoolExhaustedException) { + return JanusGraphOperationStatus.GENERAL_ERROR; + } + if (e instanceof InvalidElementException) { + return JanusGraphOperationStatus.INVALID_ELEMENT; + } + if (e instanceof InvalidIDException) { + return JanusGraphOperationStatus.INVALID_ID; + } + if (e instanceof QueryException) { + return JanusGraphOperationStatus.INVALID_QUERY; + } + if (e instanceof ResourceUnavailableException) { + return JanusGraphOperationStatus.RESOURCE_UNAVAILABLE; + } + if (e instanceof IllegalArgumentException) { + // TODO check the error message?? + return JanusGraphOperationStatus.ILLEGAL_ARGUMENT; + } + + return JanusGraphOperationStatus.GENERAL_ERROR; + } + + public boolean getHealth() { + return true; + } + + private boolean isGraphOpen() { + return true; + } + + + private static final String JANUSGRAPH_HEALTH_CHECK_STR = "janusGraphHealthCheck"; + + + private void createJanusGraphSchema() { + + JanusGraphManagement graphMgt = graph.openManagement(); + JanusGraphIndex index = null; + for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) { + PropertyKey propKey = null; + if (!graphMgt.containsPropertyKey(prop.getProperty())) { + Class clazz = prop.getClazz(); + if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) { + propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make(); + } + } else { + propKey = graphMgt.getPropertyKey(prop.getProperty()); + } + if (prop.isIndexed()) { + if (!graphMgt.containsGraphIndex(prop.getProperty())) { + if (prop.isUnique()) { + index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex(); + + graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures + // only + // one + // name + // per + // vertex + graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures + // name + // uniqueness + // in + // the + // graph + + } else { + graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex(); + } + } + } + } + graphMgt.commit(); + } + +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java deleted file mode 100644 index 96899b49c2..0000000000 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/InMemoryTitanGraphClient.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.openecomp.sdc.be.components.path.beans; - - -import com.thinkaurelius.titan.core.*; -import com.thinkaurelius.titan.core.schema.ConsistencyModifier; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; -import com.thinkaurelius.titan.core.util.TitanCleanup; -import com.thinkaurelius.titan.diskstorage.ResourceUnavailableException; -import com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException; -import com.thinkaurelius.titan.graphdb.database.idassigner.IDPoolExhaustedException; -import fj.data.Either; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.openecomp.sdc.be.dao.TitanClientStrategy; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.ArrayList; -import java.util.HashMap; - -@Component("titan-client") -public class InMemoryTitanGraphClient extends TitanGraphClient { - - - private static final Logger logger = LoggerFactory.getLogger(InMemoryTitanGraphClient.class); - - private static final String OK = "GOOD"; - - public InMemoryTitanGraphClient() { - } - - - private TitanGraph graph; - TitanClientStrategy titanClientStrategy; - - public InMemoryTitanGraphClient(TitanClientStrategy titanClientStrategy) { - super(); - this.titanClientStrategy = titanClientStrategy; - logger.info("** TitanGraphClient created"); - } - - @PostConstruct - public TitanOperationStatus createGraph() { - - logger.info("** createGraph started **"); - graph = TitanFactory.build().set("storage.backend", "inmemory").open(); - createTitanSchema(); - - logger.info("** in memory graph created"); - return TitanOperationStatus.OK; - - } - - - public void cleanupGraph() { - if (graph != null) { - // graph.shutdown(); - graph.close(); - TitanCleanup.clear(graph); - } - } - - public TitanOperationStatus createGraph(String titanCfgFile) { - logger.info("** open graph with {} started", titanCfgFile); - try { - logger.info("openGraph : try to load file {}", titanCfgFile); - graph = TitanFactory.open(titanCfgFile); - if (graph.isClosed()) { - logger.error("titan graph was not initialized"); - return TitanOperationStatus.NOT_CREATED; - } - - } catch (Exception e) { - this.graph = null; - logger.info("createGraph : failed to open Titan graph with configuration file: {}", titanCfgFile, e); - return TitanOperationStatus.NOT_CONNECTED; - } - - logger.info("** Titan graph created "); - - return TitanOperationStatus.OK; - } - - - public Either getGraph() { - if (graph != null) { - return Either.left(graph); - } else { - return Either.right(TitanOperationStatus.NOT_CREATED); - } - } - - public TitanOperationStatus commit() { - if (graph != null) { - try { - graph.tx().commit(); - return TitanOperationStatus.OK; - } catch (Exception e) { - return handleTitanException(e); - } - } else { - return TitanOperationStatus.NOT_CREATED; - } - } - - public TitanOperationStatus rollback() { - if (graph != null) { - try { - // graph.rollback(); - graph.tx().rollback(); - return TitanOperationStatus.OK; - } catch (Exception e) { - return handleTitanException(e); - } - } else { - return TitanOperationStatus.NOT_CREATED; - } - } - - public static TitanOperationStatus handleTitanException(Exception e) { - if (e instanceof TitanConfigurationException) { - return TitanOperationStatus.TITAN_CONFIGURATION; - } - if (e instanceof SchemaViolationException) { - return TitanOperationStatus.TITAN_SCHEMA_VIOLATION; - } - if (e instanceof PermanentLockingException) { - return TitanOperationStatus.TITAN_SCHEMA_VIOLATION; - } - if (e instanceof IDPoolExhaustedException) { - return TitanOperationStatus.GENERAL_ERROR; - } - if (e instanceof InvalidElementException) { - return TitanOperationStatus.INVALID_ELEMENT; - } - if (e instanceof InvalidIDException) { - return TitanOperationStatus.INVALID_ID; - } - if (e instanceof QueryException) { - return TitanOperationStatus.INVALID_QUERY; - } - if (e instanceof ResourceUnavailableException) { - return TitanOperationStatus.RESOURCE_UNAVAILABLE; - } - if (e instanceof IllegalArgumentException) { - // TODO check the error message?? - return TitanOperationStatus.ILLEGAL_ARGUMENT; - } - - return TitanOperationStatus.GENERAL_ERROR; - } - - public boolean getHealth() { - return true; - } - - private boolean isGraphOpen() { - return true; - } - - - private static final String TITAN_HEALTH_CHECK_STR = "titanHealthCheck"; - - - private void createTitanSchema() { - - TitanManagement graphMgt = graph.openManagement(); - TitanGraphIndex index = null; - for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) { - PropertyKey propKey = null; - if (!graphMgt.containsPropertyKey(prop.getProperty())) { - Class clazz = prop.getClazz(); - if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) { - propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make(); - } - } else { - propKey = graphMgt.getPropertyKey(prop.getProperty()); - } - if (prop.isIndexed()) { - if (!graphMgt.containsGraphIndex(prop.getProperty())) { - if (prop.isUnique()) { - index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex(); - - graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures - // only - // one - // name - // per - // vertex - graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures - // name - // uniqueness - // in - // the - // graph - - } else { - graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex(); - } - } - } - } - graphMgt.commit(); - } - -} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java new file mode 100644 index 0000000000..0a11c45a6c --- /dev/null +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/JanusGraphTestSetup.java @@ -0,0 +1,166 @@ +package org.openecomp.sdc.be.components.path.beans; + +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphQuery; +import org.janusgraph.core.schema.ConsistencyModifier; +import org.janusgraph.core.schema.JanusGraphIndex; +import org.janusgraph.core.schema.JanusGraphManagement; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum; +import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils; +import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.dao.utils.UserStatusEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.resources.data.UserData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +public class JanusGraphTestSetup { + + + private static final Logger logger = LoggerFactory.getLogger(JanusGraphTestSetup.class); + + private static JanusGraph graph; + + public static boolean createGraph( JanusGraph graph) { + JanusGraphTestSetup.graph = graph; + createIndexesAndDefaults(); + + logger.info("** JanusGraph graph created "); + + return true; + } + + private static boolean isVertexExist(Map properties) { + JanusGraphQuery query = graph.query(); + + if (properties != null && !properties.isEmpty()) { + for (Map.Entry entry : properties.entrySet()) { + query = query.has(entry.getKey(), entry.getValue()); + } + } + Iterable vertecies = query.vertices(); + java.util.Iterator iterator = vertecies.iterator(); + if (iterator.hasNext()) { + return true; + } + return false; + } + + private static void createDefaultAdminUser() { + createUser(getDefaultUserAdmin()); + graph.tx().commit(); + + } + + private static void createUser(UserData user) { + Map checkedProperties = new HashMap<>(); + checkedProperties.put(GraphPropertiesDictionary.USERID.getProperty(), user.getUserId()); + checkedProperties.put(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.User.getName()); + Map properties = null; + if (!isVertexExist(checkedProperties)) { + Vertex vertex = graph.addVertex(); + vertex.property(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.User.getName()); + properties = user.toGraphMap(); + for (Map.Entry entry : properties.entrySet()) { + vertex.property(entry.getKey(), entry.getValue()); + } + } + } + + private static UserData getDefaultUserAdmin() { + UserData userData = new UserData(); + userData.setAction(ActionEnum.Create); + userData.setElementType(GraphElementTypeEnum.Node); + userData.setUserId("jh0003"); + userData.setEmail("admin@sdc.com"); + userData.setFirstName("Jimmy"); + userData.setLastName("Hendrix"); + userData.setRole("ADMIN"); + userData.setStatus(UserStatusEnum.ACTIVE.name()); + userData.setLastLoginTime(0L); + return userData; + } + + + private static void createVertexIndixes() { + logger.info("** createVertexIndixes started"); + + JanusGraphManagement graphMgt = graph.openManagement(); + JanusGraphIndex index = null; + for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) { + PropertyKey propKey = null; + if (!graphMgt.containsPropertyKey(prop.getProperty())) { + Class clazz = prop.getClazz(); + if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) { + propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make(); + } + } else { + propKey = graphMgt.getPropertyKey(prop.getProperty()); + } + if (prop.isIndexed()) { + if (!graphMgt.containsGraphIndex(prop.getProperty())) { + if (prop.isUnique()) { + index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex(); + + graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures + // only + // one + // name + // per + // vertex + graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures + // name + // uniqueness + // in + // the + // graph + + } else { + graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex(); + } + } + } + } + graphMgt.commit(); + logger.info("** createVertexIndixes ended"); + + } + + private static void createEdgeIndixes() { + logger.info("** createEdgeIndixes started"); + JanusGraphManagement graphMgt = graph.openManagement(); + for (GraphEdgePropertiesDictionary prop : GraphEdgePropertiesDictionary.values()) { + if (!graphMgt.containsGraphIndex(prop.getProperty())) { + PropertyKey propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make(); + graphMgt.buildIndex(prop.getProperty(), Edge.class).addKey(propKey).buildCompositeIndex(); + + } + } + graphMgt.commit(); + logger.info("** createEdgeIndixes ended"); + } + + private static void createIndexesAndDefaults() { + createVertexIndixes(); + createEdgeIndixes(); + createDefaultAdminUser(); + createRootCatalogVertex(); + } + private static void createRootCatalogVertex(){ + Vertex vertex = graph.addVertex(); + vertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty(), IdBuilderUtils.generateUniqueId()); + vertex.property(GraphPropertyEnum.LABEL.getProperty(), VertexTypeEnum.CATALOG_ROOT.getName()); + graph.tx().commit(); + } +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java deleted file mode 100644 index 7a7eff879a..0000000000 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/beans/TitanGraphTestSetup.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.openecomp.sdc.be.components.path.beans; - -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanGraphQuery; -import com.thinkaurelius.titan.core.schema.ConsistencyModifier; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum; -import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils; -import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.utils.UserStatusEnum; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.resources.data.UserData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -public class TitanGraphTestSetup { - - - private static final Logger logger = LoggerFactory.getLogger(TitanGraphTestSetup.class); - - private static TitanGraph graph; - - public static boolean createGraph( TitanGraph graph) { - TitanGraphTestSetup.graph = graph; - createIndexesAndDefaults(); - - logger.info("** Titan graph created "); - - return true; - } - - private static boolean isVertexExist(Map properties) { - TitanGraphQuery query = graph.query(); - - if (properties != null && !properties.isEmpty()) { - for (Map.Entry entry : properties.entrySet()) { - query = query.has(entry.getKey(), entry.getValue()); - } - } - Iterable vertecies = query.vertices(); - java.util.Iterator iterator = vertecies.iterator(); - if (iterator.hasNext()) { - return true; - } - return false; - } - - private static void createDefaultAdminUser() { - createUser(getDefaultUserAdmin()); - graph.tx().commit(); - - } - - private static void createUser(UserData user) { - Map checkedProperties = new HashMap<>(); - checkedProperties.put(GraphPropertiesDictionary.USERID.getProperty(), user.getUserId()); - checkedProperties.put(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.User.getName()); - Map properties = null; - if (!isVertexExist(checkedProperties)) { - Vertex vertex = graph.addVertex(); - vertex.property(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.User.getName()); - properties = user.toGraphMap(); - for (Map.Entry entry : properties.entrySet()) { - vertex.property(entry.getKey(), entry.getValue()); - } - } - } - - private static UserData getDefaultUserAdmin() { - UserData userData = new UserData(); - userData.setAction(ActionEnum.Create); - userData.setElementType(GraphElementTypeEnum.Node); - userData.setUserId("jh0003"); - userData.setEmail("admin@sdc.com"); - userData.setFirstName("Jimmy"); - userData.setLastName("Hendrix"); - userData.setRole("ADMIN"); - userData.setStatus(UserStatusEnum.ACTIVE.name()); - userData.setLastLoginTime(0L); - return userData; - } - - - private static void createVertexIndixes() { - logger.info("** createVertexIndixes started"); - - TitanManagement graphMgt = graph.openManagement(); - TitanGraphIndex index = null; - for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) { - PropertyKey propKey = null; - if (!graphMgt.containsPropertyKey(prop.getProperty())) { - Class clazz = prop.getClazz(); - if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) { - propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make(); - } - } else { - propKey = graphMgt.getPropertyKey(prop.getProperty()); - } - if (prop.isIndexed()) { - if (!graphMgt.containsGraphIndex(prop.getProperty())) { - if (prop.isUnique()) { - index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex(); - - graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures - // only - // one - // name - // per - // vertex - graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures - // name - // uniqueness - // in - // the - // graph - - } else { - graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex(); - } - } - } - } - graphMgt.commit(); - logger.info("** createVertexIndixes ended"); - - } - - private static void createEdgeIndixes() { - logger.info("** createEdgeIndixes started"); - TitanManagement graphMgt = graph.openManagement(); - for (GraphEdgePropertiesDictionary prop : GraphEdgePropertiesDictionary.values()) { - if (!graphMgt.containsGraphIndex(prop.getProperty())) { - PropertyKey propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make(); - graphMgt.buildIndex(prop.getProperty(), Edge.class).addKey(propKey).buildCompositeIndex(); - - } - } - graphMgt.commit(); - logger.info("** createEdgeIndixes ended"); - } - - private static void createIndexesAndDefaults() { - createVertexIndixes(); - createEdgeIndixes(); - createDefaultAdminUser(); - createRootCatalogVertex(); - } - private static void createRootCatalogVertex(){ - Vertex vertex = graph.addVertex(); - vertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty(), IdBuilderUtils.generateUniqueId()); - vertex.property(GraphPropertyEnum.LABEL.getProperty(), VertexTypeEnum.CATALOG_ROOT.getName()); - graph.tx().commit(); - } -} 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 78f4964b7e..0ae1d8c80c 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 @@ -20,15 +20,15 @@ package org.openecomp.sdc.be.components.path.utils; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphVertex; import fj.data.Either; import org.apache.tinkerpop.gremlin.structure.io.IoCore; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; @@ -44,21 +44,21 @@ import java.util.UUID; public final class GraphTestUtils { - public static GraphVertex createRootCatalogVertex(TitanDao titanDao) { + public static GraphVertex createRootCatalogVertex(JanusGraphDao janusGraphDao) { GraphVertex catalogRootVertex = new GraphVertex(VertexTypeEnum.CATALOG_ROOT); catalogRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId()); - return titanDao.createVertex(catalogRootVertex) + return janusGraphDao.createVertex(catalogRootVertex) .either(v -> v, s -> null); } - public static GraphVertex createRootArchiveVertex(TitanDao titanDao) { + public static GraphVertex createRootArchiveVertex(JanusGraphDao janusGraphDao) { GraphVertex archiveRootVertex = new GraphVertex(VertexTypeEnum.ARCHIVE_ROOT); archiveRootVertex.setUniqueId(IdBuilderUtils.generateUniqueId()); - return titanDao.createVertex(archiveRootVertex) + return janusGraphDao.createVertex(archiveRootVertex) .either(v -> v, s -> null); } - public static GraphVertex createResourceVertex(TitanDao titanDao, Map metadataProps, ResourceTypeEnum type) { + public static GraphVertex createResourceVertex(JanusGraphDao janusGraphDao, Map metadataProps, ResourceTypeEnum type) { GraphVertex vertex = new GraphVertex(); if (type == ResourceTypeEnum.VF) { vertex.setLabel(VertexTypeEnum.TOPOLOGY_TEMPLATE); @@ -77,12 +77,12 @@ public final class GraphTestUtils { for (Map.Entry prop : metadataProps.entrySet()) { vertex.addMetadataProperty(prop.getKey(), prop.getValue()); } - titanDao.createVertex(vertex); - titanDao.commit(); + janusGraphDao.createVertex(vertex); + janusGraphDao.commit(); return vertex; } - public static GraphVertex createServiceVertex(TitanDao titanDao, Map metadataProps){ + public static GraphVertex createServiceVertex(JanusGraphDao janusGraphDao, Map metadataProps){ GraphVertex vertex = new GraphVertex(VertexTypeEnum.TOPOLOGY_TEMPLATE); String uuid = UUID.randomUUID().toString(); @@ -95,27 +95,27 @@ public final class GraphTestUtils { for (Map.Entry prop : metadataProps.entrySet()) { vertex.addMetadataProperty(prop.getKey(), prop.getValue()); } - titanDao.createVertex(vertex); - titanDao.commit(); + janusGraphDao.createVertex(vertex); + janusGraphDao.commit(); return vertex; } - public static void clearGraph(TitanDao titanDao) { - Either graphResult = titanDao.getGraph(); - TitanGraph graph = graphResult.left().value(); + public static void clearGraph(JanusGraphDao janusGraphDao) { + Either graphResult = janusGraphDao.getGraph(); + JanusGraph graph = graphResult.left().value(); - Iterable vertices = graph.query().vertices(); + Iterable vertices = graph.query().vertices(); if (vertices != null) { - Iterator iterator = vertices.iterator(); + Iterator iterator = vertices.iterator(); while (iterator.hasNext()) { - TitanVertex vertex = iterator.next(); + JanusGraphVertex vertex = iterator.next(); vertex.remove(); } } - titanDao.commit(); + janusGraphDao.commit(); } - public static String exportGraphMl(TitanGraph graph, String outputDirectory) { + public static String exportGraphMl(JanusGraph graph, String outputDirectory) { String result = null; String outputFile = outputDirectory + File.separator + "exportGraph." + System.currentTimeMillis() + ".graphml"; try { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java index c2bbb034ce..9c2752ea38 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeceleratorTest.java @@ -11,7 +11,7 @@ import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import java.util.LinkedList; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java index 14a4a02313..8ea89d2f76 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstanceInputPropertyDeclaratorTest.java @@ -53,7 +53,7 @@ import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java index bad71961bd..0f744c23aa 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java @@ -59,7 +59,7 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java index b432502996..c9e32e7327 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyDeclaratorTest.java @@ -50,7 +50,7 @@ import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java index 11292dc0e1..68889a3594 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentPropertyToPolicyDeclaratorTest.java @@ -22,7 +22,7 @@ import org.openecomp.sdc.be.datatypes.elements.GetPolicyValueDataDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @RunWith(MockitoJUnitRunner.class) diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java index 586cc55462..9577b536f9 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java index f85388a06b..0f065b8ffb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java @@ -17,7 +17,7 @@ import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.PolicyOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.PolicyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java index c44b907344..e343202042 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/propertytopolicydeclarators/ComponentInstancePropertyToPolicyDeclaratorTest.java @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.components.property.propertytopolicydeclarators; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -21,7 +19,6 @@ import org.mockito.Captor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.mockito.Spy; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; @@ -30,7 +27,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; public class ComponentInstancePropertyToPolicyDeclaratorTest { 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 ea9095fd11..c23bb1c6b8 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.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; @@ -53,8 +53,8 @@ import org.openecomp.sdc.be.model.ResourceMetadataDefinition; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.ServiceMetadataDefinition; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; @@ -106,7 +106,7 @@ public class UpgradeBusinessLogicTest { private UpgradeOperation upgradeOperation; @Mock - private TitanDao titanDao; + private JanusGraphDao janusGraphDao; @InjectMocks private UpgradeBusinessLogic upgradeBusinessLogic; @@ -116,7 +116,8 @@ public class UpgradeBusinessLogicTest { MockitoAnnotations.initMocks(this); upgradeBusinessLogic = new UpgradeBusinessLogic(lifecycleBusinessLogic, componentInstanceBusinessLogic, - userValidations, toscaOperationFacade, componentsUtils, upgradeOperation, titanDao); + userValidations, toscaOperationFacade, componentsUtils, upgradeOperation, + janusGraphDao); user = new User(); user.setRole(Role.ADMIN.name()); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java index 480c8cfec7..8815510369 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/AnnotationValidatorTest.java @@ -34,7 +34,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.components.impl.utils.ExceptionUtils; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.Annotation; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -71,7 +71,7 @@ public class AnnotationValidatorTest { public void setUp() throws Exception { annotationValidator = new AnnotationValidator(propertyValidator, exceptionUtils, dataTypeCache, componentsUtils); allData = Collections.emptyMap(); - Either, TitanOperationStatus> cacheResponse = Either.left(allData); + Either, JanusGraphOperationStatus> cacheResponse = Either.left(allData); Mockito.when(dataTypeCache.getAll()).thenReturn(cacheResponse); annotationTypeProperties = Collections.emptyList(); propertyDataDefinitions = new ArrayList<>(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java index c3b5a6bc08..c6d7e569d3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ComponentValidationsTest.java @@ -33,7 +33,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java index dfc1b18837..1ff159f317 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java @@ -39,7 +39,7 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; import org.openecomp.sdc.exception.ResponseFormat; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java index 95020b6112..16df8f31be 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtilTest.java @@ -29,14 +29,14 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.exception.ResponseFormat; @@ -68,7 +68,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void primitiveValueSuccessTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -84,7 +84,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void primitiveValueFailTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -100,7 +100,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void complexWithValidValueSuccessTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -116,7 +116,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void complexWithValidValueFailTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -132,7 +132,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void complexWithListWithPrimitiveValueSuccessTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -148,7 +148,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void complexWithListWithPrimitiveValueFailTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -164,7 +164,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void complexWithMapWithPrimitiveValueSuccessTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -180,7 +180,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void complexWithMapWithPrimitiveValueFailTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -196,7 +196,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void inputValidValueSuccessTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); InputDefinition inputDefinition = new InputDefinition(); @@ -216,7 +216,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void inputValidValueFailTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); InputDefinition inputDefinition = new InputDefinition(); @@ -235,7 +235,7 @@ public class PropertyValueConstraintValidationUtilTest { @Test public void serviceConsumptionValidValueSuccessTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); @@ -251,7 +251,7 @@ public class PropertyValueConstraintValidationUtilTest { } @Test public void serviceConsumptionValidValueFailTest() { - Either, TitanOperationStatus> either = Either.left(dataTypeDefinitionMap); + Either, JanusGraphOperationStatus> either = Either.left(dataTypeDefinitionMap); Mockito.when(applicationDataTypeCache.getAll()).thenReturn(either); PropertyDefinition propertyDefinition = new PropertyDefinition(); 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 5a2b598ed8..e011aabdd9 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 @@ -35,16 +35,16 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponent import org.openecomp.sdc.be.components.path.utils.GraphTestUtils; import org.openecomp.sdc.be.components.validation.AccessValidations; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.DAOTitanStrategy; -import org.openecomp.sdc.be.dao.TitanClientStrategy; +import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy; +import org.openecomp.sdc.be.dao.JanusGraphClientStrategy; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao; -import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.dto.ExternalRefDTO; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -52,8 +52,8 @@ import org.openecomp.sdc.be.impl.ServletUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.operations.*; -import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.*; +import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.impl.OperationUtils; @@ -110,7 +110,7 @@ public class ExternalRefServletTest extends JerseyTest { private static final ToscaOperationFacade toscaOperationFacadeMock = Mockito.mock(ToscaOperationFacade.class); private static final AccessValidations accessValidationsMock = Mockito.mock(AccessValidations.class); private static final ComponentLocker componentLocker = Mockito.mock(ComponentLocker.class); - private static final HealingTitanGenericDao titanGenericDao = Mockito.mock(HealingTitanGenericDao.class); + private static final HealingJanusGraphGenericDao janusGraphGenericDao = Mockito.mock(HealingJanusGraphGenericDao.class); private static final ICacheMangerOperation cacheManagerOperation = Mockito.mock(ICacheMangerOperation.class); private static final IGraphLockOperation graphLockOperation = Mockito.mock(IGraphLockOperation.class); @@ -136,7 +136,7 @@ public class ExternalRefServletTest extends JerseyTest { private GraphVertex serviceVertex; private GraphVertex resourceVertex; private ExternalReferencesOperation externalReferenceOperation; - private HealingTitanDao titanDao; + private HealingJanusGraphDao janusGraphDao; private OperationUtils operationUtils; @Bean @@ -145,7 +145,7 @@ public class ExternalRefServletTest extends JerseyTest { } @Bean - OperationUtils operationUtils() {return new OperationUtils(titanDao());} + OperationUtils operationUtils() {return new OperationUtils(janusGraphDao());} @Bean ComponentExceptionMapper componentExceptionMapper() { @@ -174,9 +174,9 @@ public class ExternalRefServletTest extends JerseyTest { @Bean ExternalReferencesOperation externalReferencesOperation() { - this.externalReferenceOperation = new ExternalReferencesOperation(titanDao(), nodeTypeOpertaion(), topologyTemplateOperation(), idMapper()); + this.externalReferenceOperation = new ExternalReferencesOperation(janusGraphDao(), nodeTypeOpertaion(), topologyTemplateOperation(), idMapper()); this.externalReferenceOperation.setHealingPipelineDao(healingPipelineDao()); - GraphTestUtils.clearGraph(titanDao); + GraphTestUtils.clearGraph(janusGraphDao); initGraphForTest(); return this.externalReferenceOperation; } @@ -202,7 +202,7 @@ public class ExternalRefServletTest extends JerseyTest { @Bean ArchiveOperation archiveOperation() { - return new ArchiveOperation(titanDao(), graphLockOperation()); + return new ArchiveOperation(janusGraphDao(), graphLockOperation()); } @Bean @@ -231,19 +231,19 @@ public class ExternalRefServletTest extends JerseyTest { } @Bean - HealingTitanDao titanDao() { - this.titanDao = new HealingTitanDao(titanGraphClient()); - return titanDao; + HealingJanusGraphDao janusGraphDao() { + this.janusGraphDao = new HealingJanusGraphDao(janusGraphClient()); + return janusGraphDao; } @Bean - TitanGraphClient titanGraphClient() { - return new TitanGraphClient(titanClientStrategy()); + JanusGraphClient janusGraphClient() { + return new JanusGraphClient(janusGraphClientStrategy()); } @Bean - TitanClientStrategy titanClientStrategy() { - return new DAOTitanStrategy(); + JanusGraphClientStrategy janusGraphClientStrategy() { + return new DAOJanusGraphStrategy(); } @Bean @@ -257,8 +257,8 @@ public class ExternalRefServletTest extends JerseyTest { } @Bean - TitanGenericDao titanGenericDao() { - return titanGenericDao; + JanusGraphGenericDao janusGraphGenericDao() { + return janusGraphGenericDao; } @Bean("healingPipelineDao") @@ -273,11 +273,11 @@ public class ExternalRefServletTest extends JerseyTest { private void initGraphForTest() { if (!setupDone) { - resourceVertex = GraphTestUtils.createResourceVertex(titanDao, new HashMap<>(), ResourceTypeEnum.VF); + resourceVertex = GraphTestUtils.createResourceVertex(janusGraphDao, new HashMap<>(), ResourceTypeEnum.VF); resourceVertexUuid = resourceVertex.getUniqueId(); //create a service and add ref - serviceVertex = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>()); + serviceVertex = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>()); serviceVertexUuid = this.serviceVertex.getUniqueId(); //monitoring references @@ -289,8 +289,8 @@ public class ExternalRefServletTest extends JerseyTest { //workflow references externalReferenceOperation.addExternalReference(serviceVertexUuid, COMPONENT_ID, WORKFLOW_OBJECT_TYPE, REF_6); - final TitanOperationStatus commit = this.titanDao.commit(); - assertThat(commit).isEqualTo(TitanOperationStatus.OK); + final JanusGraphOperationStatus commit = this.janusGraphDao.commit(); + assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK); } } @@ -353,7 +353,7 @@ public class ExternalRefServletTest extends JerseyTest { ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); org.openecomp.sdc.be.config.Configuration configuration = new org.openecomp.sdc.be.config.Configuration(); - configuration.setTitanInMemoryGraph(true); + configuration.setJanusGraphInMemoryGraph(true); configurationManager.setConfiguration(configuration); ExternalConfiguration.setAppName("catalog-be"); 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 f315ddf9d0..2ad52251f6 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 @@ -53,17 +53,17 @@ import org.openecomp.sdc.be.components.path.utils.GraphTestUtils; import org.openecomp.sdc.be.components.validation.AccessValidations; import org.openecomp.sdc.be.components.validation.ComponentValidations; import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.dao.DAOTitanStrategy; -import org.openecomp.sdc.be.dao.TitanClientStrategy; +import org.openecomp.sdc.be.dao.DAOJanusGraphStrategy; +import org.openecomp.sdc.be.dao.JanusGraphClientStrategy; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.impl.HealingPipelineDao; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.dao.jsongraph.HealingTitanDao; +import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; -import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanGraphClient; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; @@ -75,13 +75,13 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.catalog.CatalogComponent; -import org.openecomp.sdc.be.model.jsontitan.operations.ArchiveOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.CategoryOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArchiveOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CategoryOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTypeOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -121,14 +121,15 @@ public class ArchiveEndpointTest extends JerseyTest { private static final AccessValidations accessValidationsMock = mock(AccessValidations.class); private static final ComponentValidations componentValidationsMock = mock(ComponentValidations.class); private static final IGraphLockOperation graphLockOperation = mock(IGraphLockOperation.class); - private static final HealingTitanGenericDao titanGenericDao = mock(HealingTitanGenericDao.class); + private static final HealingJanusGraphGenericDao + janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class); private static final HealingPipelineDao HEALING_PIPELINE_DAO = mock(HealingPipelineDao.class); private static final ICacheMangerOperation cacheManagerOperation = mock(ICacheMangerOperation.class); private static GraphVertex serviceVertex; private static GraphVertex resourceVertex; private static GraphVertex resourceVertexVspArchived; - private static HealingTitanDao titanDao; + private static HealingJanusGraphDao janusGraphDao; @Configuration @PropertySource("classpath:dao.properties") @@ -158,13 +159,13 @@ public class ArchiveEndpointTest extends JerseyTest { @Bean ArchiveBusinessLogic archiveBusinessLogic() { - return new ArchiveBusinessLogic(titanDao(), accessValidations(), archiveOperation(), toscaOperationFacade(), componentUtils); + return new ArchiveBusinessLogic(janusGraphDao(), accessValidations(), archiveOperation(), toscaOperationFacade(), componentUtils); } @Bean ArchiveOperation archiveOperation() { - this.archiveOperation = new ArchiveOperation(titanDao(), graphLockOperation()); - GraphTestUtils.clearGraph(titanDao); + this.archiveOperation = new ArchiveOperation(janusGraphDao(), graphLockOperation()); + GraphTestUtils.clearGraph(janusGraphDao); initGraphForTest(); return this.archiveOperation; } @@ -210,19 +211,19 @@ public class ArchiveEndpointTest extends JerseyTest { } @Bean - HealingTitanDao titanDao() { - titanDao = new HealingTitanDao(titanGraphClient()); - return titanDao; + HealingJanusGraphDao janusGraphDao() { + janusGraphDao = new HealingJanusGraphDao(janusGraphClient()); + return janusGraphDao; } @Bean - TitanGraphClient titanGraphClient() { - return new TitanGraphClient(titanClientStrategy()); + JanusGraphClient janusGraphClient() { + return new JanusGraphClient(janusGraphClientStrategy()); } @Bean - TitanClientStrategy titanClientStrategy() { - return new DAOTitanStrategy(); + JanusGraphClientStrategy janusGraphClientStrategy() { + return new DAOJanusGraphStrategy(); } @Bean @@ -236,8 +237,8 @@ public class ArchiveEndpointTest extends JerseyTest { } @Bean - TitanGenericDao titanGenericDao() { - return titanGenericDao; + JanusGraphGenericDao janusGraphGenericDao() { + return janusGraphGenericDao; } @Bean @@ -247,31 +248,31 @@ public class ArchiveEndpointTest extends JerseyTest { private void initGraphForTest() { //Create Catalog Root - catalogVertex = GraphTestUtils.createRootCatalogVertex(titanDao); + catalogVertex = GraphTestUtils.createRootCatalogVertex(janusGraphDao); //Create Archive Root - GraphTestUtils.createRootArchiveVertex(titanDao); + GraphTestUtils.createRootArchiveVertex(janusGraphDao); createSingleVersionServiceAndResource(); } private void createSingleVersionServiceAndResource() { //Create Service for Scenario 1 Tests (1 Service) - serviceVertex = GraphTestUtils.createServiceVertex(titanDao, propsForHighestVersion()); + serviceVertex = GraphTestUtils.createServiceVertex(janusGraphDao, propsForHighestVersion()); Map props = propsForHighestVersion(); props.put(GraphPropertyEnum.IS_VSP_ARCHIVED, false); props.put(GraphPropertyEnum.CSAR_UUID, CSAR_UUID1); - resourceVertex = GraphTestUtils.createResourceVertex(titanDao, props, ResourceTypeEnum.VF); + resourceVertex = GraphTestUtils.createResourceVertex(janusGraphDao, props, ResourceTypeEnum.VF); props = propsForHighestVersion(); props.put(GraphPropertyEnum.IS_VSP_ARCHIVED, true); props.put(GraphPropertyEnum.CSAR_UUID, CSAR_UUID2); - resourceVertexVspArchived = GraphTestUtils.createResourceVertex(titanDao, props, ResourceTypeEnum.VF); + resourceVertexVspArchived = GraphTestUtils.createResourceVertex(janusGraphDao, props, ResourceTypeEnum.VF); //Connect Service/Resource to Catalog Root - titanDao.createEdge(catalogVertex, serviceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null); - titanDao.createEdge(catalogVertex, resourceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null); + janusGraphDao.createEdge(catalogVertex, serviceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null); + janusGraphDao.createEdge(catalogVertex, resourceVertex, EdgeLabelEnum.CATALOG_ELEMENT, null); } private Map propsForHighestVersion(){ @@ -328,7 +329,7 @@ public class ArchiveEndpointTest extends JerseyTest { ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); org.openecomp.sdc.be.config.Configuration configuration = new org.openecomp.sdc.be.config.Configuration(); - configuration.setTitanInMemoryGraph(true); + configuration.setJanusGraphInMemoryGraph(true); configurationManager.setConfiguration(configuration); ExternalConfiguration.setAppName("catalog-be"); @@ -412,16 +413,16 @@ public class ArchiveEndpointTest extends JerseyTest { } private void checkoutComponent(GraphVertex component) { - Either vE = titanDao.getVertexById(component.getUniqueId()); + Either vE = janusGraphDao.getVertexById(component.getUniqueId()); GraphVertex v = vE.left().value(); v.addMetadataProperty(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); v.setJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); - titanDao.updateVertex(v); - titanDao.commit(); + janusGraphDao.updateVertex(v); + janusGraphDao.commit(); } private void assertOnVertexProp(String componentId, Object expectedValue) { - Either vE = titanDao.getVertexById(componentId); + Either vE = janusGraphDao.getVertexById(componentId); GraphVertex v = vE.left().value(); assertThat(v.getMetadataProperty(GraphPropertyEnum.IS_VSP_ARCHIVED)).isEqualTo(expectedValue); } 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 2a959ec843..60fb579ae9 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 @@ -19,13 +19,13 @@ 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.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.jsontitan.operations.UpgradeOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; @@ -71,7 +71,7 @@ public class AutomatedUpgradeEndpointTest extends JerseySpringBaseTest { private static ToscaOperationFacade toscaOperationFacade; private static ComponentsUtils componentsUtils; private static UpgradeOperation upgradeOperation; - private static TitanDao titanDao; + private static JanusGraphDao janusGraphDao; private static User user; private static Resource vfPrev; @@ -96,7 +96,8 @@ public class AutomatedUpgradeEndpointTest extends JerseySpringBaseTest { @Bean UpgradeBusinessLogic upgradeBusinessLogic() { - return new UpgradeBusinessLogic(lifecycleBusinessLogic, componentInstanceBusinessLogic, userValidations, toscaOperationFacade, componentsUtils, upgradeOperation, titanDao); + return new UpgradeBusinessLogic(lifecycleBusinessLogic, componentInstanceBusinessLogic, userValidations, toscaOperationFacade, componentsUtils, upgradeOperation, + janusGraphDao); } } @@ -108,7 +109,7 @@ public class AutomatedUpgradeEndpointTest extends JerseySpringBaseTest { toscaOperationFacade = mock(ToscaOperationFacade.class); componentsUtils = mock(ComponentsUtils.class); upgradeOperation = mock(UpgradeOperation.class); - titanDao = mock(TitanDao.class); + janusGraphDao = mock(JanusGraphDao.class); user = mock(User.class); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java index 38373bdb08..d9ae9cc53e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupEndpointTest.java @@ -23,7 +23,7 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GroupOperation; 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 1af04ac207..6acfd36e0a 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 @@ -15,8 +15,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.jsongraph.TitanDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +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; @@ -47,7 +47,6 @@ import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; public class GroupTypesEndpointTest extends JerseySpringBaseTest { @@ -57,10 +56,10 @@ public class GroupTypesEndpointTest extends JerseySpringBaseTest { private static final HashSet EXCLUDED_TYPES = Sets.newHashSet("Root", "Heat"); private static ComponentsUtils componentsUtils; - private static TitanGenericDao titanGenericDao; + private static JanusGraphGenericDao janusGraphGenericDao; private static CapabilityTypeOperation capabilityTypeOperation; private static DerivedFromOperation derivedFromOperation; - private static TitanDao titanDao; + private static JanusGraphDao janusGraphDao; private static PropertyOperation propertyOperation; private static CapabilityOperation capabilityOperation; private static UserValidations userValidations; @@ -81,12 +80,12 @@ public class GroupTypesEndpointTest extends JerseySpringBaseTest { @Bean GroupTypeBusinessLogic groupTypeBusinessLogic() { - return new GroupTypeBusinessLogic(groupTypeOperation(), titanDao, userValidations, componentsUtils); + return new GroupTypeBusinessLogic(groupTypeOperation(), janusGraphDao, userValidations, componentsUtils); } @Bean GroupTypeOperation groupTypeOperation() { - return new GroupTypeOperation(titanGenericDao, propertyOperation, capabilityTypeOperation, capabilityOperation, derivedFromOperation, operationUtils); + return new GroupTypeOperation(janusGraphGenericDao, propertyOperation, capabilityTypeOperation, capabilityOperation, derivedFromOperation, operationUtils); } } @@ -95,8 +94,8 @@ public class GroupTypesEndpointTest extends JerseySpringBaseTest { componentsUtils = mock(ComponentsUtils.class); propertyOperation = mock(PropertyOperation.class); capabilityTypeOperation = mock(CapabilityTypeOperation.class); - titanDao = mock(TitanDao.class); - titanGenericDao = mock(TitanGenericDao.class); + janusGraphDao = mock(JanusGraphDao.class); + janusGraphGenericDao = mock(JanusGraphGenericDao.class); userValidations = mock(UserValidations.class); operationUtils = mock(OperationUtils.class); user = mock(User.class); @@ -105,7 +104,7 @@ public class GroupTypesEndpointTest extends JerseySpringBaseTest { @Before public void init() { when(userValidations.validateUserExists(eq(USER_ID), anyString(), anyBoolean())).thenReturn(user); - when(titanGenericDao.getByCriteriaWithPredicate(eq(NodeTypeEnum.GroupType), any(), eq(GroupTypeData.class))).thenReturn(Either.left(buildGroupTypeDataList())); + when(janusGraphGenericDao.getByCriteriaWithPredicate(eq(NodeTypeEnum.GroupType), any(), eq(GroupTypeData.class))).thenReturn(Either.left(buildGroupTypeDataList())); } @Override diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java index d542088763..7ff94c7785 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java @@ -52,7 +52,7 @@ import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PolicyTargetDTO; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java index 5eecc77136..4a9cdad2d8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java @@ -18,9 +18,8 @@ import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.components.impl.CommonImportManager; import org.openecomp.sdc.be.components.validation.AccessValidations; -import org.openecomp.sdc.be.dao.titan.HealingTitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.AnnotationTypeDefinition; @@ -56,7 +55,7 @@ public class TypesUploadEndpointTest extends JerseySpringBaseTest { static final String userId = "jh0003"; private static AccessValidations accessValidations; - private static HealingTitanGenericDao titanGenericDao; + private static HealingJanusGraphGenericDao janusGraphGenericDao; private static PropertyOperation propertyOperation; private static ComponentsUtils componentUtils; private static OperationUtils operationUtils; @@ -82,13 +81,13 @@ public class TypesUploadEndpointTest extends JerseySpringBaseTest { @Bean CommonTypeOperations commonTypeOperations() { - return new CommonTypeOperations(titanGenericDao, propertyOperation, operationUtils); + return new CommonTypeOperations(janusGraphGenericDao, propertyOperation, operationUtils); } } @BeforeClass public static void initClass() { - titanGenericDao = mock(HealingTitanGenericDao.class); + janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class); accessValidations = mock(AccessValidations.class); propertyOperation = mock(PropertyOperation.class); componentUtils = Mockito.mock(ComponentsUtils.class); @@ -113,14 +112,16 @@ public class TypesUploadEndpointTest extends JerseySpringBaseTest { @Test public void creatingAnnotationTypeSuccessTest() { doNothing().when(accessValidations).validateUserExists(eq(userId), anyString()); - when(titanGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); - when(titanGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); - when(titanGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + when(janusGraphGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); + when(janusGraphGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); + when(janusGraphGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right( + JanusGraphOperationStatus.NOT_FOUND)); when(propertyOperation.addPropertiesToElementType(anyString(), eq(NodeTypeEnum.AnnotationType), anyList())).thenReturn(Either.left(emptyMap())); - when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn(TitanOperationStatus.OK); - when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao); - when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.OK); - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn( + JanusGraphOperationStatus.OK); + when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao); + when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.OK); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); FileDataBodyPart filePart = new FileDataBodyPart("annotationTypesZip", new File("src/test/resources/types/annotationTypes.zip")); MultiPart multipartEntity = new FormDataMultiPart(); multipartEntity.bodyPart(filePart); @@ -149,14 +150,17 @@ public class TypesUploadEndpointTest extends JerseySpringBaseTest { @Test public void creatingAnnotationTypeFailureTest() { doNothing().when(accessValidations).validateUserExists(eq(userId), anyString()); - when(titanGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); - when(titanGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); - when(titanGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); - when(propertyOperation.addPropertiesToElementType(anyString(), eq(NodeTypeEnum.AnnotationType), anyList())).thenThrow(new StorageException(TitanOperationStatus.MATCH_NOT_FOUND)); - when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn(TitanOperationStatus.OK); - when(propertyOperation.getTitanGenericDao()).thenReturn(titanGenericDao); - when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.OK); - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphGenericDao.createNode(isA(AnnotationTypeData.class), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); + when(janusGraphGenericDao.getNode(anyString(), eq("org.openecomp.annotations.source.1.0.annotationtype"), eq(AnnotationTypeData.class))).thenReturn(Either.left(new AnnotationTypeData())); + when(janusGraphGenericDao.getByCriteria(eq(NodeTypeEnum.AnnotationType), anyMap(), eq(AnnotationTypeData.class))).thenReturn(Either.right( + JanusGraphOperationStatus.NOT_FOUND)); + when(propertyOperation.addPropertiesToElementType(anyString(), eq(NodeTypeEnum.AnnotationType), anyList())).thenThrow(new StorageException( + JanusGraphOperationStatus.MATCH_NOT_FOUND)); + when(propertyOperation.fillPropertiesList(anyString(), eq(NodeTypeEnum.AnnotationType), any())).thenReturn( + JanusGraphOperationStatus.OK); + when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao); + when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.OK); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); FileDataBodyPart filePart = new FileDataBodyPart("annotationTypesZip", new File("src/test/resources/types/annotationTypes.zip")); MultiPart multipartEntity = new FormDataMultiPart(); multipartEntity.bodyPart(filePart); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java index ff522e15c5..ec06c86abf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java @@ -35,10 +35,12 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.tosca.model.SubstitutionMapping; import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate; +import org.openecomp.sdc.be.tosca.model.ToscaNodeType; +import org.openecomp.sdc.be.tosca.model.ToscaTemplateCapability; import fj.data.Either; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java index 8b1fe5fabb..5b84066f48 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CsarUtilsTest.java @@ -50,20 +50,17 @@ 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.cassandra.SdcSchemaFilesCassandraDao; -import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.InterfaceDefinition; 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.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData; @@ -71,7 +68,6 @@ import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo; import org.openecomp.sdc.be.tosca.model.ToscaTemplate; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; import mockit.Deencapsulation; diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java index 90dc926acf..0252d5a96c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java @@ -21,7 +21,7 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.components.BeConfDependentTest; import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; @@ -51,7 +51,7 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.tosca.model.SubstitutionMapping; @@ -64,7 +64,6 @@ import org.openecomp.sdc.be.tosca.model.ToscaTemplate; import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement; import org.openecomp.sdc.be.tosca.model.ToscaTopolgyTemplate; import org.openecomp.sdc.be.tosca.utils.InputConverter; -import org.yaml.snakeyaml.Yaml; import static org.junit.Assert.assertThat; import static org.hamcrest.CoreMatchers.is; @@ -182,7 +181,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest { component = getNewService(); Mockito.when(capabiltyRequirementConvertor.convertRequirements(Mockito.any(Map.class),Mockito.any(Service.class), Mockito.any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType())); - Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)); // default test when component is Service result = testSubject.exportComponent(component); @@ -195,7 +194,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest { ((Resource) component).setInterfaces(new HashMap<>()); - Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)); Mockito.when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes()).thenReturn(Either.left(Collections.emptyMap())); // default test when convertInterfaceNodeType is right result = testSubject.exportComponentInterface(component, false); @@ -450,7 +449,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest { Map nodeTypes = new HashMap<>(); Either result; - Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(TitanOperationStatus.ALREADY_EXIST)); + Mockito.when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST)); Mockito.when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes()) .thenReturn(Either.left(Collections.emptyMap())); // default test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java index b31ed58713..9c34b1d3f0 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/user/UserBusinessLogicTest.java @@ -12,13 +12,12 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.UserRoleEnum; import org.openecomp.sdc.exception.ResponseFormat; @@ -36,7 +35,7 @@ public class UserBusinessLogicTest { @Mock private ComponentsUtils componentsUtils; @Mock - private TitanGenericDao titanDao; + private JanusGraphGenericDao janusGraphDao; @Before public void setUp() { @@ -339,8 +338,8 @@ public class UserBusinessLogicTest { Mockito.when(userAdminOperation.getUserData(userIdToUpdate, false)).thenReturn(value2); List list = new LinkedList<>(); - list.add(new DetachedEdge("sdas", "fdfs", new HashMap<>(), Pair.with("sadas", "sadasd"), - Pair.with("sadas", "sadasd"))); + list.add(new DetachedEdge("sdas", "fdfs", new HashMap<>(),"sadas","sadasd", + "sadas","sadasd" )); Either, StorageOperationStatus> value3 = Either.left(list); Mockito.when(userAdminOperation.getUserPendingTasksList(Mockito.any(), Mockito.any())).thenReturn(value3); @@ -657,7 +656,7 @@ public class UserBusinessLogicTest { Mockito.when(userAdminOperation.getUserData("mockDU", false)).thenReturn(value2); LinkedList a = new LinkedList<>(); a.add(new DetachedEdge(userUniuqeIdToDeactive, userUniuqeIdToDeactive, new HashMap<>(), - Pair.with("dsfds", "dsfds"), Pair.with("dsfds", "dsfds"))); + "dsfds","dsfds", "dsfds", "dsfds")); Either, StorageOperationStatus> value3 = Either.left(a); Mockito.when(userAdminOperation.getUserPendingTasksList(Mockito.any(), Mockito.any())).thenReturn(value3); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java index 900fdc569a..091e15661c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/common/transaction/mngr/SdncTransactionTest.java @@ -28,8 +28,8 @@ import org.mockito.Mockito; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; import org.openecomp.sdc.be.dao.impl.ESCatalogDAO; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; @@ -48,17 +48,17 @@ import static org.mockito.Mockito.when; public class SdncTransactionTest { private static ESCatalogDAO esCatalogDao = Mockito.mock(ESCatalogDAO.class); - private static TitanGenericDao titanGenericDao = Mockito.mock(TitanGenericDao.class); + private static JanusGraphGenericDao janusGraphGenericDao = Mockito.mock(JanusGraphGenericDao.class); private static final Logger log = Mockito.spy(Logger.getLogger(SdncTransactionTest.class)); private static int transactionId = 0; private static ConfigurationManager configurationManager; public enum TestAction { - TitanAction, Rollback, GeneralAction + JanusGraphAction, Rollback, GeneralAction } public enum TestResponse { - TitanResponseSuccess, GeneralSuccess + JanusGraphResponseSuccess, GeneralSuccess } @BeforeClass @@ -75,22 +75,24 @@ public class SdncTransactionTest { public void beforeTest() { reset(log); reset(esCatalogDao); - reset(titanGenericDao); + reset(janusGraphGenericDao); } @Test - public void testInvokeTitanAction() { + public void testInvokeJanusGraphAction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); - doBasicTitanAction(transactionId, tx, false, true); + doBasicJanusGraphAction(transactionId, tx, false, true); assertSame(tx.getStatus(), TransactionStatusEnum.OPEN); } @Test public void testInvokeESAction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doESAddArtifactAction(transactionId, tx, true, true); assertSame(tx.getStatus(), TransactionStatusEnum.OPEN); @@ -99,7 +101,8 @@ public class SdncTransactionTest { @Test public void testfinishTransaction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doFinishTransaction(transactionId, tx, true); assertSame(tx.getStatus(), TransactionStatusEnum.CLOSED); } @@ -107,7 +110,8 @@ public class SdncTransactionTest { @Test public void testFinishOnClosedTransaction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doFinishTransaction(transactionId, tx, true); TransactionCodeEnum finishTransaction = tx.finishTransaction(); @@ -120,30 +124,33 @@ public class SdncTransactionTest { @Test public void testCallingLastActionTwice() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); - doBasicTitanAction(transactionId, tx, true, true); - Either doBasicTitanAction = doBasicTitanAction(transactionId, tx, true, false); - assertTrue(doBasicTitanAction.isRight()); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); + doBasicJanusGraphAction(transactionId, tx, true, true); + Either doBasicJanusGraphAction = doBasicJanusGraphAction(transactionId, tx, true, false); + assertTrue(doBasicJanusGraphAction.isRight()); assertNotSame(tx.getStatus(), TransactionStatusEnum.OPEN); - verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DOUBLE_FINISH_FLAG_ACTION, transactionId, DBTypeEnum.TITAN.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DOUBLE_FINISH_FLAG_ACTION, transactionId, DBTypeEnum.JANUSGRAPH + .name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); } @Test public void testActionOnClosedTransaction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doFinishTransaction(transactionId, tx, true); Either eitherESResult = tx.invokeESAction(false, ESActionTypeEnum.ADD_ARTIFACT, createDummyArtifactData()); assertTrue(eitherESResult.isRight()); assertSame(eitherESResult.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED); - Either eitherTitanResult = tx.invokeTitanAction(false, createBasicAction(TestAction.TitanAction, TestResponse.TitanResponseSuccess)); - assertTrue(eitherTitanResult.isRight()); - assertSame(eitherTitanResult.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED); + Either eitherJanusGraphResult = tx.invokeJanusGraphAction(false, createBasicAction(TestAction.JanusGraphAction, TestResponse.JanusGraphResponseSuccess)); + assertTrue(eitherJanusGraphResult.isRight()); + assertSame(eitherJanusGraphResult.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED); - Either eitherGeneralDBAction = tx.invokeGeneralDBAction(true, DBTypeEnum.TITAN, createBasicAction(TestAction.TitanAction, TestResponse.TitanResponseSuccess), - createBasicAction(TestAction.Rollback, TestResponse.TitanResponseSuccess)); + Either eitherGeneralDBAction = tx.invokeGeneralDBAction(true, DBTypeEnum.JANUSGRAPH, createBasicAction(TestAction.JanusGraphAction, TestResponse.JanusGraphResponseSuccess), + createBasicAction(TestAction.Rollback, TestResponse.JanusGraphResponseSuccess)); assertTrue(eitherGeneralDBAction.isRight()); assertSame(eitherGeneralDBAction.right().value(), TransactionCodeEnum.TRANSACTION_CLOSED); @@ -155,9 +162,10 @@ public class SdncTransactionTest { @Test public void testBasicHappyScenario() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); - doBasicTitanAction(transactionId, tx, false, true); + doBasicJanusGraphAction(transactionId, tx, false, true); assertSame(tx.getStatus(), TransactionStatusEnum.OPEN); doESAddArtifactAction(transactionId, tx, true, true); @@ -172,23 +180,27 @@ public class SdncTransactionTest { @Test public void testRollbackSucceededOnAction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doESAddArtifactAction(transactionId, tx, false, true); - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); String crushMessage = "DB Crush Simulation"; - Either eitherTransactionResult = tx.invokeTitanAction(false, createCrushingAction(TestAction.TitanAction, crushMessage)); + Either eitherTransactionResult = tx.invokeJanusGraphAction(false, createCrushingAction(TestAction.JanusGraphAction, crushMessage)); assertTrue(eitherTransactionResult.isRight()); assertSame(eitherTransactionResult.right().value(), TransactionCodeEnum.ROLLBACK_SUCCESS); assertSame(tx.getStatus(), TransactionStatusEnum.CLOSED); - verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.TITAN.name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log).info(LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); @@ -197,35 +209,40 @@ public class SdncTransactionTest { @Test public void testRollbackFailedOnAction() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doESAddArtifactAction(transactionId, tx, false, true); - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.NOT_CONNECTED); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.NOT_CONNECTED); String crushMessage = "DB Crush Simulation"; - Either eitherTransactionResult = tx.invokeTitanAction(false, createCrushingAction(TestAction.TitanAction, crushMessage)); + Either eitherTransactionResult = tx.invokeJanusGraphAction(false, createCrushingAction(TestAction.JanusGraphAction, crushMessage)); assertTrue(eitherTransactionResult.isRight()); assertSame(tx.getStatus(), TransactionStatusEnum.FAILED_ROLLBACK); assertSame(eitherTransactionResult.right().value(), TransactionCodeEnum.ROLLBACK_FAILED); - verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.TITAN.name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.DB_ACTION_FAILED_WITH_EXCEPTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, crushMessage, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); } @Test public void testRollbackSucceededOnCommit() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doESAddArtifactAction(transactionId, tx, false, true); - doBasicTitanAction(transactionId, tx, true, true); + doBasicJanusGraphAction(transactionId, tx, true, true); - when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.GENERAL_ERROR); - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.GENERAL_ERROR); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); // finishTransaction TransactionCodeEnum transactionCode = tx.finishTransaction(); assertSame(transactionCode, TransactionCodeEnum.ROLLBACK_SUCCESS); @@ -234,8 +251,10 @@ public class SdncTransactionTest { verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log).info(LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log).info(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_SUCCEEDED_GENERAL, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); @@ -244,12 +263,13 @@ public class SdncTransactionTest { @Test public void testRollbackFailedOnCommit() { int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); doESAddArtifactAction(transactionId, tx, false, true); - doBasicTitanAction(transactionId, tx, true, true); + doBasicJanusGraphAction(transactionId, tx, true, true); - when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.GENERAL_ERROR); - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.GENERAL_ERROR); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); String esError = "No Connection to Es"; Mockito.doThrow(new RuntimeException(esError)).when(esCatalogDao).deleteArtifact(Mockito.anyString()); // finishTransaction @@ -260,15 +280,18 @@ public class SdncTransactionTest { verify(log, times(1)).debug(LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_PERSISTENT_ACTION, DBTypeEnum.ELASTIC_SEARCH.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.TITAN.name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log, times(1)).debug(TransactionUtils.TRANSACTION_MARKER, LogMessages.ROLLBACK_NON_PERSISTENT_ACTION, DBTypeEnum.JANUSGRAPH + .name(), transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); } @Test public void testInvokeGeneralAction() { - when(titanGenericDao.rollback()).thenReturn(TitanOperationStatus.OK); + when(janusGraphGenericDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); int transactionId = getNextTransactionId(); - TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, titanGenericDao); + TransactionSdncImpl tx = new TransactionSdncImpl(transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT, esCatalogDao, + janusGraphGenericDao); IDBAction generalAction = createBasicAction(TestAction.GeneralAction, TestResponse.GeneralSuccess); IDBAction rollbackAction = createBasicAction(TestAction.Rollback, TestResponse.GeneralSuccess); String crushMessage = "No DB Connection"; @@ -294,30 +317,31 @@ public class SdncTransactionTest { } - private Either doBasicTitanAction(int transactionId, TransactionSdncImpl tx, boolean isLastAction, boolean isVerifyAction) { - // Add Titan Action - Either eitherTitanResult = tx.invokeTitanAction(isLastAction, createBasicAction(TestAction.TitanAction, TestResponse.TitanResponseSuccess)); + private Either doBasicJanusGraphAction(int transactionId, TransactionSdncImpl tx, boolean isLastAction, boolean isVerifyAction) { + // Add JanusGraph Action + Either eitherJanusGraphResult = tx.invokeJanusGraphAction(isLastAction, createBasicAction(TestAction.JanusGraphAction, TestResponse.JanusGraphResponseSuccess)); if (isVerifyAction) { - // Check Titan Action - assertTrue(eitherTitanResult.isLeft()); - assertSame(eitherTitanResult.left().value(), TestResponse.TitanResponseSuccess); - verify(log).debug(TestAction.TitanAction.name()); - verify(log).debug(LogMessages.INVOKE_ACTION, transactionId, DBTypeEnum.TITAN.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + // Check JanusGraph Action + assertTrue(eitherJanusGraphResult.isLeft()); + assertSame(eitherJanusGraphResult.left().value(), TestResponse.JanusGraphResponseSuccess); + verify(log).debug(TestAction.JanusGraphAction.name()); + verify(log).debug(LogMessages.INVOKE_ACTION, transactionId, DBTypeEnum.JANUSGRAPH.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); verifyNoErrorsInLog(); verifyNoInfoInLog(); } - return eitherTitanResult; + return eitherJanusGraphResult; } private TransactionCodeEnum doFinishTransaction(int transactionId, TransactionSdncImpl tx, boolean isVerifyAction) { // Prerequisite finishTransaction - when(titanGenericDao.commit()).thenReturn(TitanOperationStatus.OK); + when(janusGraphGenericDao.commit()).thenReturn(JanusGraphOperationStatus.OK); // finishTransaction TransactionCodeEnum transactionCode = tx.finishTransaction(); if (isVerifyAction) { // Check finishTransaction verify(log).debug(LogMessages.COMMIT_ACTION_ALL_DB, transactionId, TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); - verify(log).debug(LogMessages.COMMIT_ACTION_SPECIFIC_DB, transactionId, DBTypeEnum.TITAN.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); + verify(log).debug(LogMessages.COMMIT_ACTION_SPECIFIC_DB, transactionId, DBTypeEnum.JANUSGRAPH + .name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); assertSame(transactionCode, TransactionCodeEnum.SUCCESS); } return transactionCode; @@ -332,7 +356,7 @@ public class SdncTransactionTest { Either eitherEsAction = tx.invokeESAction(isLastAction, ESActionTypeEnum.ADD_ARTIFACT, createDummyArtifactData()); if (isVerifyAction) { - // Check Titan Action + // Check JanusGraph Action assertTrue(eitherEsAction.isLeft()); assertSame(eitherEsAction.left().value(), DBActionCodeEnum.SUCCESS); verify(log).debug(LogMessages.INVOKE_ACTION, transactionId, DBTypeEnum.ELASTIC_SEARCH.name(), TransactionUtils.DUMMY_USER, ActionTypeEnum.ADD_ARTIFACT.name()); diff --git a/catalog-be/src/test/resources/config/catalog-be/configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/configuration.yaml index e8bebc8471..803805edf1 100644 --- a/catalog-be/src/test/resources/config/catalog-be/configuration.yaml +++ b/catalog-be/src/test/resources/config/catalog-be/configuration.yaml @@ -26,15 +26,15 @@ released: 2012-11-30 toscaConformanceLevel: 8.0 minToscaConformanceLevel: 3.0 -titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties -titanInMemoryGraph: false -titanLockTimeout: 1800 +janusGraphCfgFile: /home/vagrant/catalog-be/config/catalog-be/janusgraph.properties +janusGraphInMemoryGraph: false +janusGraphLockTimeout: 1800 -# The interval to try and reconnect to titan DB when it is down during ASDC startup: -titanReconnectIntervalInSeconds: 3 +# The interval to try and reconnect to janusgraph DB when it is down during ASDC startup: +janusGraphReconnectIntervalInSeconds: 3 -# The read timeout towards Titan DB when health check is invoked: -titanHealthCheckReadTimeout: 1 +# The read timeout towards JanusGraph DB when health check is invoked: +janusGraphHealthCheckReadTimeout: 1 # The interval to try and reconnect to Elasticsearch when it is down during ASDC startup: esReconnectIntervalInSeconds: 3 diff --git a/catalog-be/src/test/resources/paths/path-context.xml b/catalog-be/src/test/resources/paths/path-context.xml index b9415bfbfa..8f6dea21a7 100644 --- a/catalog-be/src/test/resources/paths/path-context.xml +++ b/catalog-be/src/test/resources/paths/path-context.xml @@ -38,7 +38,7 @@ Modifications copyright (c) 2018 Nokia org.openecomp.sdc.be.dao.neo4j, org.openecomp.sdc.be.model.operations.impl, org.openecomp.sdc.be.model.cache, - org.openecomp.sdc.be.dao.titan, + org.openecomp.sdc.be.dao.janusgraph, org.openecomp.sdc.be.user, org.openecomp.sdc.be.impl, org.openecomp.sdc.be.auditing.impl, @@ -51,8 +51,8 @@ Modifications copyright (c) 2018 Nokia org.openecomp.sdc.be.switchover.detector, org.openecomp.sdc.be.tosca, org.openecomp.sdc.be.model.operations.impl, - org.openecomp.sdc.be.model.jsontitan.operations, - org.openecomp.sdc.be.model.jsontitan.utils, + org.openecomp.sdc.be.model.jsonjanusgraph.operations, + org.openecomp.sdc.be.model.jsonjanusgraph.utils, org.openecomp.sdc.be.components.csar, org.openecomp.sdc.be.datamodel.utils, org.openecomp.sdc.be.model.utils, @@ -79,7 +79,7 @@ Modifications copyright (c) 2018 Nokia - + -- cgit 1.2.3-korg