diff options
author | vasraz <vasyl.razinkov@est.tech> | 2020-04-02 19:23:40 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-04-06 13:51:34 +0000 |
commit | e052e9b0cc7d30f2fb4bada0a3e75e2c4d0e2f73 (patch) | |
tree | 2c0f35ed963d190ce31018a4b61fce658b8b8424 /catalog-dao/src/main/java/org | |
parent | 8c5c8c57766412f57a8c7168b268b59e8ae72667 (diff) |
Increase test coverage
Change-Id: I5ed0e2520305519af573df10768c3ee69c39f213
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-2833
Diffstat (limited to 'catalog-dao/src/main/java/org')
7 files changed, 143 insertions, 236 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/Account.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/Account.java index 6ff717df92..6a1e495d51 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/Account.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/Account.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,67 +20,24 @@ package org.openecomp.sdc.be.dao; -//import com.datastax.driver.mapping.annotations.Column; -//import com.datastax.driver.mapping.annotations.Frozen; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import com.google.common.base.Objects; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; @Table(keyspace = "dstest", name = "accounts") +@Getter +@Setter +@EqualsAndHashCode +@AllArgsConstructor +@NoArgsConstructor public class Account { - @PartitionKey - private String email; - private String name; - // @Column (name = "addr") - // @Frozen - // private Address address; - - public Account() { - } - - // public Account(String name, String email, Address address) { - public Account(String name, String email) { - this.name = name; - this.email = email; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - // - // public Address getAddress() { - // return address; - // } - // - // public void setAddress(Address address) { - // this.address = address; - // } - - @Override - public boolean equals(Object other) { - if (other instanceof Account) { - Account that = (Account) other; - return Objects.equal(this.name, that.name) && Objects.equal(this.email, that.email); - } - return false; - } - - @Override - public int hashCode() { - return Objects.hashCode(name, email); - } + @PartitionKey + private String email; + private String name; } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java index 1a96ebf87b..1f7d6b9c7b 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOJanusGraphStrategy.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java index 9dc9c84466..d35f00b5f8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java @@ -21,68 +21,69 @@ package org.openecomp.sdc.be.dao.jsongraph.types; public enum EdgeLabelEnum { - ARTIFACTS, - DEPLOYMENT_ARTIFACTS, - INST_DEPLOYMENT_ARTIFACTS, - INSTANCE_ARTIFACTS, - INTERFACE_ARTIFACTS, - TOSCA_ARTIFACTS, - PROPERTIES, - CAPABILITIES, - CAPABILITIES_PROPERTIES, - REQUIREMENTS, - ATTRIBUTES, - ADDITIONAL_INFORMATION, - CATEGORY, - DERIVED_FROM, - STATE, - LAST_STATE, - LAST_MODIFIER, - VERSION, - CREATOR, - SUB_CATEGORY, - INPUTS, - GROUPS, - INST_PROPERTIES, - INST_INPUTS, - INST_ATTRIBUTES, - INST_GROUPS, - SERVICE_API_ARTIFACTS, - FORWARDING_PATH, - CALCULATED_CAPABILITIES, - FULLFILLED_CAPABILITIES, - CALCULATED_REQUIREMENTS, - FULLFILLED_REQUIREMENTS, - LAST_DISTRIBUTION_STATE_MODIFIER, - CALCULATED_CAP_PROPERTIES, - POLICIES, - EXTERNAL_REFS, - CATALOG_ELEMENT, + ARTIFACTS, + DEPLOYMENT_ARTIFACTS, + INST_DEPLOYMENT_ARTIFACTS, + INSTANCE_ARTIFACTS, + INTERFACE_ARTIFACTS, + TOSCA_ARTIFACTS, + PROPERTIES, + CAPABILITIES, + CAPABILITIES_PROPERTIES, + REQUIREMENTS, + ATTRIBUTES, + ADDITIONAL_INFORMATION, + CATEGORY, + DERIVED_FROM, + STATE, + LAST_STATE, + LAST_MODIFIER, + VERSION, + CREATOR, + SUB_CATEGORY, + INPUTS, + GROUPS, + INST_PROPERTIES, + INST_INPUTS, + INST_ATTRIBUTES, + INST_GROUPS, + SERVICE_API_ARTIFACTS, + FORWARDING_PATH, + CALCULATED_CAPABILITIES, + FULLFILLED_CAPABILITIES, + CALCULATED_REQUIREMENTS, + FULLFILLED_REQUIREMENTS, + LAST_DISTRIBUTION_STATE_MODIFIER, + CALCULATED_CAP_PROPERTIES, + POLICIES, + EXTERNAL_REFS, + CATALOG_ELEMENT, ARCHIVE_ELEMENT, - INSTANCE_OF, - PROXY_OF, - ALLOTTED_OF, - INTERFACE, - INTERFACE_OPERATION, - INST_INTERFACES, - NODE_FILTER_TEMPLATE, - DATA_TYPES; + INSTANCE_OF, + PROXY_OF, + ALLOTTED_OF, + INTERFACE, + INTERFACE_OPERATION, + INST_INTERFACES, + NODE_FILTER_TEMPLATE, + DATA_TYPES; /** - * Returns EdgeLabelEnum according received name - * @param name - * @return - */ - public static EdgeLabelEnum getEdgeLabelEnum(String name){ - for(EdgeLabelEnum currLabel : EdgeLabelEnum.values()){ - if (currLabel.name().equals(name)){ - return currLabel; - } - } - return null; - } + * Returns EdgeLabelEnum according received name + * + * @param name + * @return + */ + public static EdgeLabelEnum getEdgeLabelEnum(String name) { + for (EdgeLabelEnum currLabel : EdgeLabelEnum.values()) { + if (currLabel.name().equals(name)) { + return currLabel; + } + } + return null; + } - public boolean isInstanceArtifactsLabel() { - return this.equals(INSTANCE_ARTIFACTS) || this.equals(INST_DEPLOYMENT_ARTIFACTS); - } + public boolean isInstanceArtifactsLabel() { + return this.equals(INSTANCE_ARTIFACTS) || this.equals(INST_DEPLOYMENT_ARTIFACTS); + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java index e47a78d9f0..d2f6d09908 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,27 +20,24 @@ package org.openecomp.sdc.be.dao.jsongraph.types; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor public enum EdgePropertyEnum { - - STATE ("state"), - INSTANCES("instances"); - private String property; - - public String getProperty() { - return property; - } + STATE("state"), + INSTANCES("instances"); + + private final String property; - EdgePropertyEnum (String property){ - this.property = property; - } - - public static EdgePropertyEnum getByProperty(String property){ - for ( EdgePropertyEnum inst : EdgePropertyEnum.values() ){ - if ( inst.getProperty().equals(property) ){ - return inst; - } - } - return null; - } + public static EdgePropertyEnum getByProperty(String property) { + for (EdgePropertyEnum inst : EdgePropertyEnum.values()) { + if (inst.getProperty().equals(property)) { + return inst; + } + } + return null; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java deleted file mode 100644 index c9120bbcf7..0000000000 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.be.dao.jsongraph.types; - -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; - -public enum GraphJsonProperty { - METADATA (GraphPropertyEnum.METADATA), - JSON (GraphPropertyEnum.JSON); - - private GraphPropertyEnum propInGraph; - - GraphJsonProperty (GraphPropertyEnum propInGraph){ - this.propInGraph = propInGraph; - } - - public GraphPropertyEnum getPropInGraph() { - return propInGraph; - } - -} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java index 485531aa52..ac0ceeb09b 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,8 +22,8 @@ package org.openecomp.sdc.be.dao.jsongraph.types; public enum JsonParseFlagEnum { - NoParse, - ParseAll, - ParseJson, - ParseMetadata + NoParse, + ParseAll, + ParseJson, + ParseMetadata } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java index 053a690858..01d3ac493d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,66 +20,57 @@ package org.openecomp.sdc.be.dao.jsongraph.types; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.openecomp.sdc.be.datatypes.elements.*; import org.openecomp.sdc.be.resources.data.DataTypeData; - +@Getter +@AllArgsConstructor public enum VertexTypeEnum { NODE_TYPE ("node_type", null), - TOPOLOGY_TEMPLATE ("topology_template", CompositionDataDefinition.class), + TOPOLOGY_TEMPLATE ("topology_template", CompositionDataDefinition.class), ARTIFACTS ("artifacts", ArtifactDataDefinition.class), - TOSCA_ARTIFACTS ("tosca_artifacts", ArtifactDataDefinition.class), - DEPLOYMENT_ARTIFACTS ("deployment_artifacts", ArtifactDataDefinition.class), + TOSCA_ARTIFACTS ("tosca_artifacts", ArtifactDataDefinition.class), + DEPLOYMENT_ARTIFACTS ("deployment_artifacts", ArtifactDataDefinition.class), INST_DEPLOYMENT_ARTIFACTS ("inst_deployment_artifacts", MapArtifactDataDefinition.class), - INTERFACE_ARTIFACTS ("interface_artifacts", InterfaceDataDefinition.class), - INSTANCE_ARTIFACTS ("instance_artifacts", MapArtifactDataDefinition.class), - PROPERTIES ("properties", PropertyDataDefinition.class), + INTERFACE_ARTIFACTS ("interface_artifacts", InterfaceDataDefinition.class), + INSTANCE_ARTIFACTS ("instance_artifacts", MapArtifactDataDefinition.class), + PROPERTIES ("properties", PropertyDataDefinition.class), CAPABILITIES ("capabilities", ListCapabilityDataDefinition.class), - CAPABILITIES_PROPERTIES ("capabilities_properties", MapPropertiesDataDefinition.class), + CAPABILITIES_PROPERTIES ("capabilities_properties", MapPropertiesDataDefinition.class), REQUIREMENTS ("requirements", ListRequirementDataDefinition.class), - ATTRIBUTES ("attributes", PropertyDataDefinition.class), - RESOURCE_CATEGORY ("resourceNewCategory", null), - RESOURCE_SUBCATEGORY ("resourceSubcategory", null), - SERVICE_CATEGORY ("serviceNewCategory", null), - ADDITIONAL_INFORMATION ("additional_information", AdditionalInfoParameterDataDefinition.class), + ATTRIBUTES ("attributes", PropertyDataDefinition.class), + RESOURCE_CATEGORY ("resourceNewCategory", null), + RESOURCE_SUBCATEGORY ("resourceSubcategory", null), + SERVICE_CATEGORY ("serviceNewCategory", null), + ADDITIONAL_INFORMATION ("additional_information", AdditionalInfoParameterDataDefinition.class), USER ("user", null), - INPUTS ("inputs", PropertyDataDefinition.class), - GROUPS ("groups", GroupDataDefinition.class), - INST_ATTRIBUTES ("instAttributes", MapPropertiesDataDefinition.class), - INST_PROPERTIES ("instProperties", MapPropertiesDataDefinition.class), - INST_INPUTS ("instInputs", MapPropertiesDataDefinition.class), - INST_GROUPS ("instGroups", MapGroupsDataDefinition.class), - SERVICE_API_ARTIFACTS ("serviceApiArtifacts", ArtifactDataDefinition.class), - CALCULATED_CAPABILITIES ("calculatedCapabilities", MapListCapabilityDataDefinition.class), - FULLFILLED_CAPABILITIES ("fullfilledCapabilities", MapListCapabilityDataDefinition.class), - CALCULATED_REQUIREMENTS ("calculatedRequirements", MapListRequirementDataDefinition.class), - FULLFILLED_REQUIREMENTS ("fullfilledRequirements", MapListRequirementDataDefinition.class), - CALCULATED_CAP_PROPERTIES ("calculatedCapProperties", MapCapabilityProperty.class), - FORWARDING_PATH ("path", ForwardingPathDataDefinition.class), + INPUTS ("inputs", PropertyDataDefinition.class), + GROUPS ("groups", GroupDataDefinition.class), + INST_ATTRIBUTES ("instAttributes", MapPropertiesDataDefinition.class), + INST_PROPERTIES ("instProperties", MapPropertiesDataDefinition.class), + INST_INPUTS ("instInputs", MapPropertiesDataDefinition.class), + INST_GROUPS ("instGroups", MapGroupsDataDefinition.class), + SERVICE_API_ARTIFACTS ("serviceApiArtifacts", ArtifactDataDefinition.class), + CALCULATED_CAPABILITIES ("calculatedCapabilities", MapListCapabilityDataDefinition.class), + FULLFILLED_CAPABILITIES ("fullfilledCapabilities", MapListCapabilityDataDefinition.class), + CALCULATED_REQUIREMENTS ("calculatedRequirements", MapListRequirementDataDefinition.class), + FULLFILLED_REQUIREMENTS ("fullfilledRequirements", MapListRequirementDataDefinition.class), + CALCULATED_CAP_PROPERTIES ("calculatedCapProperties", MapCapabilityProperty.class), + FORWARDING_PATH ("path", ForwardingPathDataDefinition.class), POLICIES ("policies", PolicyDataDefinition.class), - EXTERNAL_REF ("componentInstanceExtRefs", MapComponentInstanceExternalRefs.class), - CATALOG_ROOT ("catalogRoot", null), - ARCHIVE_ROOT ("archiveRoot", null), + EXTERNAL_REF ("componentInstanceExtRefs", MapComponentInstanceExternalRefs.class), + CATALOG_ROOT ("catalogRoot", null), + ARCHIVE_ROOT ("archiveRoot", null), INTERFACE ("interface", InterfaceDataDefinition.class), - INTERFACE_OPERATION ("interfaceOperation", OperationDataDefinition.class), - NODE_FILTER_TEMPLATE ("NodeTemplateFilter", CINodeFilterDataDefinition.class), - INST_INTERFACES ("InstInterfaces", MapInterfaceDataDefinition.class), - DATA_TYPES ("data_types", DataTypeDataDefinition.class); + INTERFACE_OPERATION ("interfaceOperation", OperationDataDefinition.class), + NODE_FILTER_TEMPLATE ("NodeTemplateFilter", CINodeFilterDataDefinition.class), + INST_INTERFACES ("InstInterfaces", MapInterfaceDataDefinition.class), + DATA_TYPES ("data_types", DataTypeDataDefinition.class); - private String name; - private Class classOfJson; - VertexTypeEnum(String name, Class clazz){ - this.name = name; - classOfJson = clazz; - } - - public String getName() { - return name; - } - - public Class getClassOfJson() { - return classOfJson; - } + private final String name; + private final Class classOfJson; public static VertexTypeEnum getByName(String name){ for ( VertexTypeEnum inst : VertexTypeEnum.values() ){ |