diff options
author | xuegao <xue.gao@intl.att.com> | 2021-03-16 08:18:21 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-17 12:06:31 +0000 |
commit | fd07dec6fc32c6d20a5f6ca23587ec57fa2346aa (patch) | |
tree | 5e67d877dfa4a7f367f361357e38d97e63f084fa /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib | |
parent | 425040c807f03eaae14b3c02708533f4f546d9c6 (diff) |
Improve test coverage
Use Lombok annotations to improve test coverage.
Issue-ID: SDC-3428
Signed-off-by: xuegao <xue.gao@intl.att.com>
Change-Id: I3701c1ae8f8a1648c17227095071a7a581eb8ac1
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
3 files changed, 24 insertions, 307 deletions
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/ImageEntity.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/ImageEntity.java index e4e4a949f7..b85fd6c76c 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/ImageEntity.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/ImageEntity.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.Image; import org.openecomp.sdc.versioning.dao.types.Version; +@EqualsAndHashCode +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_component_image") public class ImageEntity implements CompositionEntity { @@ -50,15 +58,6 @@ public class ImageEntity 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 ImageEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - - /** * Instantiates a new Image entity. * * @param vspId the vsp id @@ -72,30 +71,6 @@ public class ImageEntity implements CompositionEntity { this.id = id; } - public String getVspId() { - return vspId; - } - - public void setVspId(String vspId) { - this.vspId = vspId; - } - - public Version getVersion() { - return version; - } - - public void setVersion(Version version) { - this.version = version; - } - - public String getComponentId() { - return componentId; - } - - public void setComponentId(String componentId) { - this.componentId = componentId; - } - @Override public String getEntityType() { return ENTITY_TYPE; @@ -106,22 +81,6 @@ public class ImageEntity implements CompositionEntity { return getVspId(); } - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getQuestionnaireData() { - return questionnaireData; - } - - public void setQuestionnaireData(String questionnaireData) { - this.questionnaireData = questionnaireData; - } - @Override public CompositionEntityType getType() { return CompositionEntityType.image; @@ -133,14 +92,6 @@ public class ImageEntity implements CompositionEntity { new CompositionEntityId(getComponentId(), new CompositionEntityId(getVspId(), null))); } - public String getCompositionData() { - return compositionData; - } - - public void setCompositionData(String compositionData) { - this.compositionData = compositionData; - } - public Image getImageCompositionData() { return compositionData == null ? null : JsonUtil.json2Object(compositionData, Image.class); } @@ -148,48 +99,4 @@ public class ImageEntity implements CompositionEntity { public void setImageCompositionData(Image image) { this.compositionData = image == null ? null : JsonUtil.object2Json(image); } - - @Override - public int hashCode() { - int result = vspId != null ? vspId.hashCode() : 0; - result = 31 * result + (version != null ? version.hashCode() : 0); - result = 31 * result + (componentId != null ? componentId.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; - } - - ImageEntity imageEntity = (ImageEntity) object; - - if (vspId != null ? !vspId.equals(imageEntity.vspId) : imageEntity.vspId != null) { - return false; - } - if (version != null ? !version.equals(imageEntity.version) : imageEntity.version != null) { - return false; - } - if (componentId != null ? !componentId.equals(imageEntity.componentId) - : imageEntity.componentId != null) { - return false; - } - if (id != null ? !id.equals(imageEntity.id) : imageEntity.id != null) { - return false; - } - if (compositionData != null ? !compositionData.equals(imageEntity.compositionData) - : imageEntity.compositionData != null) { - return false; - } - return questionnaireData != null ? questionnaireData.equals(imageEntity.questionnaireData) - : imageEntity.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/NetworkEntity.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/NetworkEntity.java index 68bfe82cbb..4c02fd4723 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/NetworkEntity.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/NetworkEntity.java @@ -21,13 +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.Network; import org.openecomp.sdc.versioning.dao.types.Version; - +@Getter +@Setter +@EqualsAndHashCode +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_network") public class NetworkEntity implements CompositionEntity { private static final String ENTITY_TYPE = "Vendor Software Product Network"; @@ -46,14 +53,6 @@ public class NetworkEntity 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 NetworkEntity() { - // Don't delete! Default constructor is required by DataStax driver - } /** * Instantiates a new Network entity. @@ -79,34 +78,6 @@ public class NetworkEntity 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; } @@ -116,26 +87,6 @@ public class NetworkEntity 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 Network getNetworkCompositionData() { return compositionData == null ? null : JsonUtil.json2Object(compositionData, Network.class); } @@ -143,43 +94,4 @@ public class NetworkEntity implements CompositionEntity { public void setNetworkCompositionData(Network network) { this.compositionData = network == null ? null : JsonUtil.object2Json(network); } - - @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; - } - - NetworkEntity that = (NetworkEntity) 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/NicEntity.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/NicEntity.java index 9cda18f355..59e94ce62a 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/NicEntity.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/NicEntity.java @@ -21,13 +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.Nic; import org.openecomp.sdc.versioning.dao.types.Version; - +@Getter +@Setter +@EqualsAndHashCode +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_component_nic") public class NicEntity implements CompositionEntity { private static final String ENTITY_TYPE = "Vendor Software Product NIC"; @@ -50,15 +57,6 @@ public class NicEntity 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 NicEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - - /** * Instantiates a new Nic entity. * * @param vspId the vsp id @@ -85,34 +83,6 @@ public class NicEntity 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; } @@ -122,34 +92,6 @@ public class NicEntity 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 String getComponentId() { - return componentId; - } - - public void setComponentId(String componentId) { - this.componentId = componentId; - } - public Nic getNicCompositionData() { return compositionData == null ? null : JsonUtil.json2Object(compositionData, Nic.class); } @@ -157,48 +99,4 @@ public class NicEntity implements CompositionEntity { public void setNicCompositionData(Nic nic) { this.compositionData = nic == null ? null : JsonUtil.object2Json(nic); } - - @Override - public int hashCode() { - int result = vspId != null ? vspId.hashCode() : 0; - result = 31 * result + (version != null ? version.hashCode() : 0); - result = 31 * result + (componentId != null ? componentId.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; - } - - NicEntity nicEntity = (NicEntity) object; - - if (vspId != null ? !vspId.equals(nicEntity.vspId) : nicEntity.vspId != null) { - return false; - } - if (version != null ? !version.equals(nicEntity.version) : nicEntity.version != null) { - return false; - } - if (componentId != null ? !componentId.equals(nicEntity.componentId) - : nicEntity.componentId != null) { - return false; - } - if (id != null ? !id.equals(nicEntity.id) : nicEntity.id != null) { - return false; - } - if (compositionData != null ? !compositionData.equals(nicEntity.compositionData) - : nicEntity.compositionData != null) { - return false; - } - return questionnaireData != null ? questionnaireData.equals(nicEntity.questionnaireData) - : nicEntity.questionnaireData == null; - - } } |