aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxuegao <xue.gao@intl.att.com>2021-03-16 08:18:21 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-17 12:06:31 +0000
commitfd07dec6fc32c6d20a5f6ca23587ec57fa2346aa (patch)
tree5e67d877dfa4a7f367f361357e38d97e63f084fa
parent425040c807f03eaae14b3c02708533f4f546d9c6 (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
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentDependency.java71
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java19
-rw-r--r--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.java109
-rw-r--r--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.java104
-rw-r--r--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.java118
-rw-r--r--openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java15
6 files changed, 43 insertions, 393 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentDependency.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentDependency.java
index b0f3f3fa91..ab4463caea 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentDependency.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentDependency.java
@@ -20,10 +20,16 @@
package org.openecomp.sdc.be.model;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
import java.util.ArrayList;
import java.util.List;
-
+@Getter
+@Setter
+@NoArgsConstructor
public class ComponentDependency {
private String name;
private String version;
@@ -35,69 +41,6 @@ public class ComponentDependency {
private List<ComponentDependency> dependencies;
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getUniqueId() {
- return uniqueId;
- }
-
- public void setUniqueId(String uniqueId) {
- this.uniqueId = uniqueId;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public List<ComponentDependency> getDependencies() {
- return dependencies;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- public List<String> getInstanceNames() {
- return instanceNames;
- }
-
- public void setInstanceNames(List<String> instanceNames) {
- this.instanceNames = instanceNames;
- }
-
- public void setDependencies(List<ComponentDependency> dependencies) {
- this.dependencies = dependencies;
- }
public void addDependencies(List<ComponentDependency> dependencies) {
if ( this.dependencies == null ){
this.dependencies = new ArrayList<>();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java
index 2b23445452..cd132502ac 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java
@@ -20,6 +20,9 @@
package org.openecomp.sdc.be.model.tosca.constraints;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
import org.openecomp.sdc.be.model.PropertyConstraint;
import org.openecomp.sdc.be.model.tosca.ToscaType;
import org.openecomp.sdc.be.model.tosca.constraints.exception.ConstraintFunctionalException;
@@ -29,15 +32,14 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint
import javax.validation.constraints.NotNull;
+@Getter
+@Setter
+@AllArgsConstructor
public class GreaterOrEqualConstraint extends AbstractComparablePropertyConstraint {
@NotNull
private String greaterOrEqual;
- public GreaterOrEqualConstraint(String greaterOrEqual) {
- this.greaterOrEqual = greaterOrEqual;
- }
-
@Override
public void initialize(ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException {
initialize(greaterOrEqual, propertyType);
@@ -64,13 +66,4 @@ public class GreaterOrEqualConstraint extends AbstractComparablePropertyConstrai
public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) {
return getErrorMessage(toscaType, e, propertyName, "%f property value must be >= %f", greaterOrEqual);
}
-
- public String getGreaterOrEqual() {
- return greaterOrEqual;
- }
-
- public void setGreaterOrEqual(String greaterOrEqual) {
- this.greaterOrEqual = greaterOrEqual;
- }
-
}
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;
-
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
index 3026ef4798..3e443e6533 100644
--- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
+++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java
@@ -19,10 +19,15 @@
*/
package org.openecomp.sdc.versioning.types;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
/**
* @author avrahamg
* @since July 10, 2017
*/
+@Getter
+@AllArgsConstructor
public enum NotificationEventTypes {
SUBMIT("submit"),
DELETE("delete"),
@@ -30,13 +35,5 @@ public enum NotificationEventTypes {
RESTORE("restore"),
COMMIT("commit");
- private String eventName;
-
- NotificationEventTypes(String eventName) {
- this.eventName = eventName;
- }
-
- public String getEventName() {
- return eventName;
- }
+ private final String eventName;
}