diff options
author | xuegao <xue.gao@intl.att.com> | 2021-03-15 14:10:57 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-16 13:31:41 +0000 |
commit | c094ebe82e4e9797c4ee20c5e14bf293f7c193c4 (patch) | |
tree | 779d5308199edf97643a9569676bb22b41905980 /openecomp-be | |
parent | 1da764ea13793535597dc6518b5e953393e9dbe0 (diff) |
Improve test coverage
Use Lombok annotations to improve test coverage.
Issue-ID: SDC-3428
Change-Id: I78a9fa6171ba26e431b5e587b24548322c464ecc
Signed-off-by: xuegao <xue.gao@intl.att.com>
Diffstat (limited to 'openecomp-be')
12 files changed, 135 insertions, 699 deletions
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java index 3279f02a5d..81ad393607 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-api/src/main/java/org/openecomp/sdc/itempermissions/type/ItemPermissionsEntity.java @@ -23,11 +23,17 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; /** * Created by ayalaben on 6/18/2017. */ +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "item_permissions") public class ItemPermissionsEntity { @@ -41,29 +47,4 @@ public class ItemPermissionsEntity { @Column(name = "permission") private String permission; - - - public String getItemId() { - return itemId; - } - - public void setItemId(String itemId) { - this.itemId = itemId; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getPermission() { - return permission; - } - - public void setPermission(String permission) { - this.permission = permission; - } } diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java index bc34b8dfda..bd6a978ed6 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java @@ -23,10 +23,16 @@ package org.openecomp.sdc.action.dao.types; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.action.types.ActionArtifact; import java.nio.ByteBuffer; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "action_artifact") public class ActionArtifactEntity { @@ -41,44 +47,11 @@ public class ActionArtifactEntity { @Column(name = "artifact") private ByteBuffer artifact; - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public ActionArtifactEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - public ActionArtifactEntity(String artifactUuId, int effectiveVersion) { this.artifactUuId = artifactUuId; this.effectiveVersion = effectiveVersion; } - public String getArtifactUuId() { - return artifactUuId; - } - - public void setArtifactUuId(String artifactUuId) { - this.artifactUuId = artifactUuId; - } - - public int getEffectiveVersion() { - return effectiveVersion; - } - - public void setEffectiveVersion(int effectiveVersion) { - this.effectiveVersion = effectiveVersion; - } - - public ByteBuffer getArtifact() { - return artifact; - } - - public void setArtifact(ByteBuffer artifact) { - this.artifact = artifact; - } - /** * To dto action artifact. * diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java index 17f6deaa72..d84d560557 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java @@ -25,11 +25,16 @@ import java.util.Date; import java.util.Set; import java.util.stream.Collectors; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.action.types.Action; import org.openecomp.sdc.versioning.dao.types.Version; - +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "Action") public class ActionEntity { @@ -61,64 +66,11 @@ public class ActionEntity { @Column(name = "data") private String data; - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public ActionEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - public ActionEntity(String actionInvariantUuId, Version version) { this.actionInvariantUuId = actionInvariantUuId; this.version = version; } - public String getActionUuId() { - return actionUuId; - } - - public void setActionUuId(String actionUuId) { - this.actionUuId = actionUuId; - } - - public String getActionInvariantUuId() { - return actionInvariantUuId; - } - - public void setActionInvariantUuId(String actionInvariantUuId) { - this.actionInvariantUuId = actionInvariantUuId; - } - - public Version getVersion() { - return version; - } - - public void setVersion(Version version) { - this.version = version; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Set<String> getVendorList() { - return vendorList; - } - /** * Sets vendor list. * @@ -129,10 +81,6 @@ public class ActionEntity { vendorList.stream().map(String::toLowerCase).collect(Collectors.toSet()) : vendorList; } - public Set<String> getCategoryList() { - return categoryList; - } - /** * Sets category list. * @@ -144,46 +92,6 @@ public class ActionEntity { categoryList; } - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public Set<String> getSupportedModels() { - return supportedModels; - } - - public void setSupportedModels(Set<String> supportedModels) { - this.supportedModels = supportedModels; - } - - public Set<String> getSupportedComponents() { - return supportedComponents; - } - - public void setSupportedComponents(Set<String> supportedComponents) { - this.supportedComponents = supportedComponents; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - /** * To dto action. * diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java index a5025e5de8..f8380a9785 100644 --- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java @@ -23,8 +23,16 @@ package org.openecomp.sdc.action.dao.types; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.action.types.OpenEcompComponent; +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor @Table(keyspace = "dox", name = "EcompComponent") public class OpenEcompComponentEntity { @@ -35,35 +43,6 @@ public class OpenEcompComponentEntity { @Column(name = "name") private String name; - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public OpenEcompComponentEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - - public OpenEcompComponentEntity(String id, String name) { - this.id = id; - this.name = name; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } /** * To dto OPENECOMP component. diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java new file mode 100644 index 0000000000..3fbecb4082 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/test/java/org/openecomp/sdc/action/dao/types/ActionEntityTest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2021 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.action.dao.types; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; + +import java.util.HashSet; +import java.util.Set; + + +public class ActionEntityTest { + + @Test + public void TestSetVendorList() { + ActionEntity entity = new ActionEntity(); + + entity.setVendorList(null); + assertEquals(null, entity.getVendorList()); + + Set<String> stringSet = new HashSet<>(); + entity.setVendorList(stringSet); + assertEquals(stringSet, entity.getVendorList()); + + stringSet.add("TesT"); + entity.setVendorList(stringSet); + assertEquals("test", entity.getVendorList().toArray()[0]); + } + + @Test + public void TestSetCategoryList() { + ActionEntity entity = new ActionEntity(); + + entity.setCategoryList(null); + assertEquals(null, entity.getCategoryList()); + + Set<String> stringSet = new HashSet<>(); + entity.setCategoryList(stringSet); + assertEquals(stringSet, entity.getCategoryList()); + + stringSet.add("TesT"); + entity.setCategoryList(stringSet); + assertEquals("test", entity.getCategoryList().toArray()[0]); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java index 3c65624c15..f878bea2df 100644 --- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java +++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityLogEntity.java @@ -20,11 +20,16 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.versioning.dao.types.Version; import java.util.Date; - +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "activity_log") public class ActivityLogEntity { @PartitionKey @@ -43,15 +48,6 @@ public class ActivityLogEntity { private String message; private String comment; - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public ActivityLogEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - public ActivityLogEntity(String itemId, Version version) { this.itemId = itemId; this.versionId = version == null ? null : version.getId(); @@ -67,76 +63,4 @@ public class ActivityLogEntity { this.comment = comment; this.timestamp = new Date(); } - - public String getItemId() { - return itemId; - } - - public void setItemId(String itemId) { - this.itemId = itemId; - } - - public String getVersionId() { - return versionId; - } - - public void setVersionId(String versionId) { - this.versionId = versionId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ActivityType getType() { - return type; - } - - public void setType(ActivityType type) { - this.type = type; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntity.java index fc569d5bd4..dfdc0bc0c6 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntity.java @@ -21,9 +21,17 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.type; import com.datastax.driver.mapping.annotations.*; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionableEntity; +@EqualsAndHashCode +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_component_dependency_model") public class ComponentDependencyModelEntity implements VersionableEntity { @@ -44,14 +52,6 @@ public class ComponentDependencyModelEntity implements VersionableEntity { @Column(name = "relation") private String relation; - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public ComponentDependencyModelEntity() { - // Don't delete! Default constructor is required by DataStax driver - } /** * Instantiates a new ComponentDependencyModelEntity entity. @@ -75,102 +75,4 @@ public class ComponentDependencyModelEntity implements VersionableEntity { public String getFirstClassCitizenId() { return getVspId(); } - - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - - public String getVspId() { - return vspId; - } - - public void setVspId(String vspId) { - this.vspId = vspId; - } - - public String getTargetComponentId() { - return targetComponentId; - } - - public void setTargetComponentId(String targetComponentId) { - this.targetComponentId = targetComponentId; - } - - public String getSourceComponentId() { - return sourceComponentId; - } - - public void setSourceComponentId(String sourceComponentId) { - this.sourceComponentId = sourceComponentId; - } - - public String getRelation() { - return relation; - } - - public void setRelation(String relation) { - this.relation = relation; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - ComponentDependencyModelEntity that = (ComponentDependencyModelEntity) o; - - if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) { - return false; - } - if (version != null ? !version.equals(that.version) : that.version != null) { - return false; - } - if (id != null ? !id.equals(that.id) : that.id != null) { - return false; - } - if (sourceComponentId != null ? !sourceComponentId.equals(that.sourceComponentId) - : that.sourceComponentId != null) { - return false; - } - if (targetComponentId != null ? !targetComponentId.equals(that.targetComponentId) - : that.targetComponentId != null) { - return false; - } - if (relation != null ? !relation.equals(that.relation) : that.relation != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = vspId != null ? vspId.hashCode() : 0; - result = 31 * result + (version != null ? version.hashCode() : 0); - result = 31 * result + (id != null ? id.hashCode() : 0); - result = 31 * result + (sourceComponentId != null ? sourceComponentId.hashCode() : 0); - result = 31 * result + (targetComponentId != null ? targetComponentId.hashCode() : 0); - result = 31 * result + (relation != null ? relation.hashCode() : 0); - return result; - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java index c13ce149bc..18c4d949ab 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java @@ -21,6 +21,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.type; import com.datastax.driver.mapping.annotations.*; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; @@ -30,7 +34,10 @@ import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; import java.util.List; - +@EqualsAndHashCode +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_component") public class ComponentEntity implements CompositionEntity { public static final String ENTITY_TYPE = "Vendor Software Product Component"; @@ -52,15 +59,6 @@ public class ComponentEntity implements CompositionEntity { private List<NicEntity> nics = new ArrayList<>(); /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public ComponentEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - - /** * Instantiates a new Component entity. * * @param vspId the vsp id @@ -84,34 +82,6 @@ public class ComponentEntity implements CompositionEntity { } @Override - public String getCompositionData() { - return compositionData; - } - - @Override - public void setCompositionData(String compositionData) { - this.compositionData = compositionData; - } - - @Override - public String getQuestionnaireData() { - return questionnaireData; - } - - @Override - public void setQuestionnaireData(String questionnaireData) { - this.questionnaireData = questionnaireData; - } - - public String getVspId() { - return vspId; - } - - public void setVspId(String vspId) { - this.vspId = vspId; - } - - @Override public String getEntityType() { return ENTITY_TYPE; } @@ -121,26 +91,6 @@ public class ComponentEntity implements CompositionEntity { return getVspId(); } - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - public ComponentData getComponentCompositionData() { return compositionData == null ? null : JsonUtil.json2Object(compositionData, ComponentData.class); @@ -149,51 +99,4 @@ public class ComponentEntity implements CompositionEntity { public void setComponentCompositionData(ComponentData component) { this.compositionData = component == null ? null : JsonUtil.object2Json(component); } - - public List<NicEntity> getNics() { - return nics; - } - - public void setNics(List<NicEntity> nics) { - this.nics = nics; - } - - @Override - public int hashCode() { - int result = vspId != null ? vspId.hashCode() : 0; - result = 31 * result + (version != null ? version.hashCode() : 0); - result = 31 * result + (id != null ? id.hashCode() : 0); - result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0); - result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0); - return result; - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object == null || getClass() != object.getClass()) { - return false; - } - - ComponentEntity that = (ComponentEntity) object; - - if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) { - return false; - } - if (version != null ? !version.equals(that.version) : that.version != null) { - return false; - } - if (id != null ? !id.equals(that.id) : that.id != null) { - return false; - } - if (compositionData != null ? !compositionData.equals(that.compositionData) - : that.compositionData != null) { - return false; - } - return questionnaireData != null ? questionnaireData.equals(that.questionnaireData) - : that.questionnaireData == null; - - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComputeEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComputeEntity.java index 1d3c432e69..590fca602e 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComputeEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComputeEntity.java @@ -21,12 +21,18 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.type; import com.datastax.driver.mapping.annotations.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComputeData; import org.openecomp.sdc.versioning.dao.types.Version; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_component_compute") public class ComputeEntity implements CompositionEntity { public static final String ENTITY_TYPE = "Vendor Software Product Component Compute Flavor"; @@ -48,15 +54,6 @@ public class ComputeEntity implements CompositionEntity { @Column(name = "questionnaire_data") private String questionnaireData; - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public ComputeEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - public ComputeEntity(String vspId, Version version, String componentId, String id) { this.vspId = vspId; this.version = version; @@ -75,26 +72,6 @@ public class ComputeEntity implements CompositionEntity { } @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - - @Override public CompositionEntityType getType() { return CompositionEntityType.compute; } @@ -105,42 +82,6 @@ public class ComputeEntity implements CompositionEntity { new CompositionEntityId(getComponentId(), new CompositionEntityId(getVspId(), null))); } - @Override - public String getCompositionData() { - return compositionData; - } - - @Override - public void setCompositionData(String compositionData) { - this.compositionData = compositionData; - } - - @Override - public String getQuestionnaireData() { - return questionnaireData; - } - - @Override - public void setQuestionnaireData(String questionnaireData) { - this.questionnaireData = questionnaireData; - } - - public String getVspId() { - return vspId; - } - - public void setVspId(String vspId) { - this.vspId = vspId; - } - - public String getComponentId() { - return componentId; - } - - public void setComponentId(String componentId) { - this.componentId = componentId; - } - public ComputeData getComputeCompositionData() { return compositionData == null ? null : JsonUtil.json2Object(compositionData, ComputeData.class); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/DeploymentFlavorEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/DeploymentFlavorEntity.java index fb28154a48..dd145b1f54 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/DeploymentFlavorEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/DeploymentFlavorEntity.java @@ -21,12 +21,20 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.type; import com.datastax.driver.mapping.annotations.*; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.sdc.vendorsoftwareproduct.types.composition.DeploymentFlavor; import org.openecomp.sdc.versioning.dao.types.Version; +@EqualsAndHashCode +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_deployment_flavor") public class DeploymentFlavorEntity implements CompositionEntity{ private static final String ENTITY_TYPE = "Vendor Software Product Deployment Flavor"; @@ -46,15 +54,6 @@ public class DeploymentFlavorEntity implements CompositionEntity{ private String questionnaireData; /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public DeploymentFlavorEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - - /** * Instantiates a new DeploymentFlavor entity. * * @param vspId the vsp id @@ -77,34 +76,6 @@ public class DeploymentFlavorEntity implements CompositionEntity{ } @Override - public String getCompositionData() { - return compositionData; - } - - @Override - public void setCompositionData(String compositionData) { - this.compositionData = compositionData; - } - - @Override - public String getQuestionnaireData() { - return questionnaireData; - } - - @Override - public void setQuestionnaireData(String questionnaireData) { - this.questionnaireData = questionnaireData; - } - - public String getVspId() { - return vspId; - } - - public void setVspId(String vspId) { - this.vspId = vspId; - } - - @Override public String getEntityType() { return ENTITY_TYPE; } @@ -114,26 +85,6 @@ public class DeploymentFlavorEntity implements CompositionEntity{ return getVspId(); } - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - public DeploymentFlavor getDeploymentFlavorCompositionData() { return compositionData == null ? null : JsonUtil.json2Object(compositionData, DeploymentFlavor.class); } @@ -141,43 +92,4 @@ public class DeploymentFlavorEntity implements CompositionEntity{ public void setDeploymentFlavorCompositionData(DeploymentFlavor deploymentFlavor) { this.compositionData = deploymentFlavor == null ? null : JsonUtil.object2Json(deploymentFlavor); } - - @Override - public int hashCode() { - int result = vspId != null ? vspId.hashCode() : 0; - result = 31 * result + (version != null ? version.hashCode() : 0); - result = 31 * result + (id != null ? id.hashCode() : 0); - result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0); - result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0); - return result; - } - - @Override - public boolean equals(Object object) { - if (this == object) { - return true; - } - if (object == null || getClass() != object.getClass()) { - return false; - } - - DeploymentFlavorEntity that = (DeploymentFlavorEntity) object; - - if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) { - return false; - } - if (version != null ? !version.equals(that.version) : that.version != null) { - return false; - } - if (id != null ? !id.equals(that.id) : that.id != null) { - return false; - } - if (compositionData != null ? !compositionData.equals(that.compositionData) - : that.compositionData != null) { - return false; - } - return questionnaireData != null ? questionnaireData.equals(that.questionnaireData) - : that.questionnaireData == null; - - } } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java index fe92b397cd..e5c541216c 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/HealingHandler.java @@ -42,11 +42,11 @@ public class HealingHandler { public void populateHealingTable(List<HealingEntity> healingEntities) { healingEntities.forEach(healingEntity -> { if (isHealingRecordExist(healingEntity)) { - accessor.updateFlag(healingEntity.getHealingFlag(), healingEntity.getSpace(), + accessor.updateFlag(healingEntity.isHealingFlag(), healingEntity.getSpace(), healingEntity.getItemId(), healingEntity.getVersionId()); } else { accessor.create(healingEntity.getSpace(), healingEntity.getItemId(), - healingEntity.getVersionId(), healingEntity.getHealingFlag(), + healingEntity.getVersionId(), healingEntity.isHealingFlag(), healingEntity.getOldVersion()); } }); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java index b25b8fbec4..155c8e2215 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/HealingEntity.java @@ -18,10 +18,18 @@ package org.openecomp.core.tools.store.zusammen.datatypes; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; /** * Created by ayalaben on 10/15/2017 */ +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor @Table(keyspace = "dox", name = "healing") public class HealingEntity { @@ -42,62 +50,4 @@ public class HealingEntity { @Column(name = "old_version") private String oldVersion; - - /** - * Every entity class must have a default constructor according to - * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/"> - * Definition of mapped classes</a>. - */ - public HealingEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - - public HealingEntity(String space, String itemId, String versionId, boolean healingFlag, - String oldVersion) { - this.space = space; - this.itemId = itemId; - this.versionId = versionId; - this.healingFlag = healingFlag; - this.oldVersion = oldVersion; - } - - public String getSpace() { - return space; - } - - public void setSpace(String space) { - this.space = space; - } - - public String getItemId() { - return itemId; - } - - public void setItemId(String itemId) { - this.itemId = itemId; - } - - public String getVersionId() { - return versionId; - } - - public void setVersionId(String versionId) { - this.versionId = versionId; - } - - public boolean getHealingFlag() { - return healingFlag; - } - - public void setHealingFlag(boolean healingFlag) { - this.healingFlag = healingFlag; - } - - public String getOldVersion() { - return oldVersion; - } - - public void setOldVersion(String oldVersion) { - this.oldVersion = oldVersion; - } } |