Improve test coverage 70/119370/4
authorxuegao <xue.gao@intl.att.com>
Tue, 16 Mar 2021 07:18:21 +0000 (08:18 +0100)
committerChristophe Closset <christophe.closset@intl.att.com>
Wed, 17 Mar 2021 12:06:31 +0000 (12:06 +0000)
Use Lombok annotations to improve test coverage.

Issue-ID: SDC-3428
Signed-off-by: xuegao <xue.gao@intl.att.com>
Change-Id: I3701c1ae8f8a1648c17227095071a7a581eb8ac1

catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentDependency.java
catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java
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
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
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
openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/types/NotificationEventTypes.java

index b0f3f3f..ab4463c 100644 (file)
 
 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<>();
index 2b23445..cd13250 100644 (file)
@@ -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;
-    }
-
 }
index e4e4a94..b85fd6c 100644 (file)
 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 {
 
@@ -49,15 +57,6 @@ public class ImageEntity 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 ImageEntity() {
-    // Don't delete! Default constructor is required by DataStax driver
-  }
-
   /**
    * Instantiates a new Image entity.
    *
@@ -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;
-
-  }
 }
index 68bfe82..4c02fd4 100644 (file)
 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.
@@ -78,34 +77,6 @@ public class NetworkEntity implements CompositionEntity {
     return new CompositionEntityId(getId(), 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;
-  }
-
   @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;
-
-  }
 }
index 9cda18f..59e94ce 100644 (file)
 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";
@@ -49,15 +56,6 @@ public class NicEntity 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 NicEntity() {
-    // Don't delete! Default constructor is required by DataStax driver
-  }
-
   /**
    * Instantiates a new Nic entity.
    *
@@ -84,34 +82,6 @@ public class NicEntity 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;
-  }
-
   @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;
-
-  }
 }
index 3026ef4..3e443e6 100644 (file)
  */
 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;
 }