diff options
author | Dmitry Puzikov <d.puzikov2@partner.samsung.com> | 2020-03-25 16:31:43 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-30 04:58:35 +0000 |
commit | 8d82a514707fb0853d6a2c6d8f7408a872e727ca (patch) | |
tree | f6fdb7a55c310987678d2cd5b3333eafd558f6b1 | |
parent | 4819f02aa3b628294196340a119cd6976a159757 (diff) |
Fix unit tests
Added asserts where required, add tests.
Replaced getters-setters with Lombok annotations.
Fixed incorect SUT in the tests.
Removed default constructors used only for tests.
Change-Id: I9be29d9c0d891039952178a3c3e1c3a2062d1382
Issue-ID: SDC-2856
Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
41 files changed, 206 insertions, 902 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfo.java index dcb5f428a8..d800f35367 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfo.java @@ -22,8 +22,12 @@ package org.openecomp.sdc.be.info; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.model.ArtifactDefinition; +@Getter +@Setter public class ArtifactDefinitionInfo { private String uniqueId; @@ -33,9 +37,6 @@ public class ArtifactDefinitionInfo { private String artifactVersion; private String artifactUUID; - ArtifactDefinitionInfo() { - } - public ArtifactDefinitionInfo(ArtifactDefinition artifactDefinition) { uniqueId = artifactDefinition.getUniqueId(); artifactName = artifactDefinition.getArtifactName(); @@ -43,45 +44,4 @@ public class ArtifactDefinitionInfo { artifactVersion = artifactDefinition.getArtifactVersion(); artifactUUID = artifactDefinition.getArtifactUUID(); } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getArtifactName() { - return artifactName; - } - - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - public String getArtifactDisplayName() { - return artifactDisplayName; - } - - public void setArtifactDisplayName(String artifactDisplayName) { - this.artifactDisplayName = artifactDisplayName; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public void setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - } - - public String getArtifactUUID() { - return artifactUUID; - } - - public void setArtifactUUID(String artifactUUID) { - this.artifactUUID = artifactUUID; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java index 6f07cbf98e..ccb6960c08 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTemplateInfo.java @@ -23,6 +23,10 @@ package org.openecomp.sdc.be.info; import com.google.gson.Gson; import com.google.gson.JsonObject; import fj.data.Either; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import lombok.Setter; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -40,6 +44,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +@Getter +@Setter +@NoArgsConstructor public class ArtifactTemplateInfo { private static final Logger log = Logger.getLogger(ArtifactTemplateInfo.class); private static final Gson gson = new Gson(); @@ -58,14 +65,12 @@ public class ArtifactTemplateInfo { private String type; private String fileName; private String env; - private boolean isBase; + private boolean base; private String groupName; private String description; private List<ArtifactTemplateInfo> relatedArtifactsInfo; - public ArtifactTemplateInfo() {} - public ArtifactTemplateInfo(String type, String fileName, String env, List<ArtifactTemplateInfo> relatedArtifactsInfo) { this.type = type; this.fileName = fileName; @@ -73,67 +78,6 @@ public class ArtifactTemplateInfo { this.relatedArtifactsInfo = relatedArtifactsInfo; } - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public String getEnv() { - return env; - } - - public void setEnv(String env) { - this.env = env; - } - - public List<ArtifactTemplateInfo> getRelatedArtifactsInfo() { - return relatedArtifactsInfo; - } - - public void setRelatedArtifactsInfo(List<ArtifactTemplateInfo> relatedArtifactsInfo) { - this.relatedArtifactsInfo = relatedArtifactsInfo; - } - - public String getGroupName() { - return groupName; - } - - public void setGroupName(String groupName) { - this.groupName = groupName; - } - - public boolean isBase() { - return isBase; - } - - public void setBase(boolean isBase) { - this.isBase = isBase; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public String toString() { - return "ArtifactTemplateInfo [type=" + type + ", fileName=" + fileName + ", env=" + env + ", isBase=" + isBase + ", groupName=" + groupName + ", description=" + description + ", relatedArtifactsInfo=" + relatedArtifactsInfo + "]"; - } - public static Either<ArtifactTemplateInfo, ResponseFormat> createArtifactTemplateInfoFromJson(ComponentsUtils componentsUtils, String type, Map<String, Object> o, List<ArtifactTemplateInfo> createdArtifactTemplateInfoList, ArtifactTemplateInfo parentArtifact) { String content = gson.toJson(o); @@ -361,7 +305,6 @@ public class ArtifactTemplateInfo { } public static int compareByGroupName(ArtifactTemplateInfo art1, ArtifactTemplateInfo art2) { - return art1.isBase ? (art2.isBase ? 0 : -1) : (art2.isBase ? 1 : 0); + return art1.isBase() ? (art2.isBase() ? 0 : -1) : (art2.isBase() ? 1 : 0); } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java index 5d635f05ff..7ef74a18ca 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactTypesInfo.java @@ -20,29 +20,15 @@ package org.openecomp.sdc.be.info; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.model.ArtifactType; import java.util.List; +@Getter +@Setter public class ArtifactTypesInfo { - - Integer heatDefaultTimeout = 60; - List<ArtifactType> artifactTypes; - - public List<ArtifactType> getArtifactTypes() { - return artifactTypes; - } - - public void setArtifactTypes(List<ArtifactType> artifactTypes) { - this.artifactTypes = artifactTypes; - } - - public Integer getHeatDefaultTimeout() { - return heatDefaultTimeout; - } - - public void setHeatDefaultTimeout(Integer heatDefaultTimeout) { - this.heatDefaultTimeout = heatDefaultTimeout; - } - + private Integer heatDefaultTimeout = 60; + private List<ArtifactType> artifactTypes; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfo.java index b3a986306d..02e1238e33 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfo.java @@ -22,34 +22,16 @@ package org.openecomp.sdc.be.info; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +@Getter +@Setter +@AllArgsConstructor public class CreateAndAssotiateInfo { private ComponentInstance node; private RequirementCapabilityRelDef associate; - - CreateAndAssotiateInfo() {} - - public CreateAndAssotiateInfo(ComponentInstance node, RequirementCapabilityRelDef associate) { - this.node = node; - this.associate = associate; - } - - public ComponentInstance getNode() { - return node; - } - - public void setNode(ComponentInstance node) { - this.node = node; - } - - public RequirementCapabilityRelDef getAssociate() { - return associate; - } - - public void setAssociate(RequirementCapabilityRelDef associate) { - this.associate = associate; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java index b7b3b4ed0a..0850be8806 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java @@ -22,11 +22,15 @@ package org.openecomp.sdc.be.info; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.openecomp.sdc.common.log.wrappers.Logger; import java.util.Arrays; import java.util.Optional; +@Getter +@AllArgsConstructor public enum DistributionStatus { DEPLOYED("Deployed", "DEPLOYED"); @@ -35,19 +39,6 @@ public enum DistributionStatus { private static final Logger log = Logger.getLogger(DistributionStatus.class); - DistributionStatus(String name, String auditingStatus) { - this.name = name; - this.auditingStatus = auditingStatus; - } - - public String getName() { - return name; - } - - public String getAuditingStatus() { - return auditingStatus; - } - public static DistributionStatus getStatusByAuditingStatusName(String auditingStatus) { Optional<DistributionStatus> distributionStatus = Arrays.stream(values()) .filter(value -> value.getAuditingStatus().equals(auditingStatus)).findAny(); @@ -57,5 +48,4 @@ public enum DistributionStatus { // it should be replaced by some exception handling. Keeping it only for the purpose of backward compatibility return distributionStatus.orElse(null); } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusInfo.java index 7162778636..9fc747680f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusInfo.java @@ -22,9 +22,13 @@ package org.openecomp.sdc.be.info; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; +@Getter +@Setter public class DistributionStatusInfo { private String omfComponentID; @@ -33,9 +37,6 @@ public class DistributionStatusInfo { private String status; private String errorReason; - DistributionStatusInfo() { - } - public DistributionStatusInfo(AuditingGenericEvent distributionStatusEvent) { super(); omfComponentID = String.valueOf(distributionStatusEvent.getFields().get(AuditingFieldsKey.AUDIT_DISTRIBUTION_CONSUMER_ID.getDisplayName())); @@ -51,45 +52,4 @@ public class DistributionStatusInfo { this.url = url; this.status = status; } - - public String getOmfComponentID() { - return omfComponentID; - } - - public void setOmfComponentID(String omfComponentID) { - this.omfComponentID = omfComponentID; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getErrorReason() { - return errorReason; - } - - public void setErrorReason(String errorReason) { - this.errorReason = errorReason; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusListResponse.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusListResponse.java index 1f3fb90f78..d57437fc76 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusListResponse.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusListResponse.java @@ -21,17 +21,11 @@ package org.openecomp.sdc.be.info; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class DistributionStatusListResponse { - - private List<DistributionStatusInfo> distribStatusInfoList; - - public List<DistributionStatusInfo> getDistributionStatusList() { - return distribStatusInfoList; - } - - public void setDistributionStatusList(List<DistributionStatusInfo> distribStatusInfoList) { - this.distribStatusInfoList = distribStatusInfoList; - } - + private List<DistributionStatusInfo> distributionStatusList; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfo.java index 1f98a26334..f7bb1ea64c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfo.java @@ -22,52 +22,18 @@ package org.openecomp.sdc.be.info; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor public class DistributionStatusOfServiceInfo { private String distributionID; private String timestamp; private String userId; private String deployementStatus; - - public DistributionStatusOfServiceInfo() {} - - public DistributionStatusOfServiceInfo(String distributionID, String timestamp, String userId, String deploymentStatus) { - super(); - this.distributionID = distributionID; - this.timestamp = timestamp; - this.userId = userId; - this.deployementStatus = deploymentStatus; - } - - public String getDistributionID() { - return distributionID; - } - - public void setDistributionID(String distributionID) { - this.distributionID = distributionID; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getDeployementStatus() { - return deployementStatus; - } - - public void setDeployementStatus(String deployementStatus) { - this.deployementStatus = deployementStatus; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponce.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponce.java index 023645fa2d..23a71c6c9d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponce.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponce.java @@ -21,17 +21,11 @@ package org.openecomp.sdc.be.info; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class DistributionStatusOfServiceListResponce { - - private List<DistributionStatusOfServiceInfo> distribStatusOfServiceInfoList; - - public List<DistributionStatusOfServiceInfo> getDistributionStatusOfServiceList() { - return distribStatusOfServiceInfoList; - } - - public void setDistributionStatusOfServiceList(List<DistributionStatusOfServiceInfo> distribStatusOfServiceInfoList) { - this.distribStatusOfServiceInfoList = distribStatusOfServiceInfoList; - } - + private List<DistributionStatusOfServiceInfo> distributionStatusOfServiceList; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfo.java index 66a85d7ccd..9a1a7ecb52 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfo.java @@ -21,43 +21,15 @@ package org.openecomp.sdc.be.info; import java.util.Set; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter +@AllArgsConstructor public class GenericArtifactQueryInfo { - private Set<String> fields; private String parentId; private String artifactUniqueId; - - public GenericArtifactQueryInfo() { - } - - public GenericArtifactQueryInfo(Set<String> fields, String parentId, String artifactUniqueId) { - this.fields = fields; - this.parentId = parentId; - this.artifactUniqueId = artifactUniqueId; - } - - public void setFields(Set<String> fields) { - this.fields = fields; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public void setArtifactUniqueId(String artifactUniqueId) { - this.artifactUniqueId = artifactUniqueId; - } - - public Set<String> getFields() { - return fields; - } - - public String getParentId() { - return parentId; - } - - public String getArtifactUniqueId() { - return artifactUniqueId; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java index d20df93737..54920ea475 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java @@ -21,6 +21,9 @@ */ package org.openecomp.sdc.be.info; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupProperty; @@ -29,6 +32,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +@Getter +@Setter public class GroupDefinitionInfo { private String name; @@ -57,14 +62,16 @@ public class GroupDefinitionInfo { // artifacts - list of artifact uid. All artifacts in the group must already // be uploaded to the VF + @Getter(AccessLevel.NONE) + @Setter(AccessLevel.NONE) private List<ArtifactDefinitionInfo> artifacts; private Map<String, String> members; + @Getter(AccessLevel.NONE) + @Setter(AccessLevel.NONE) private List<? extends GroupProperty> properties; - public GroupDefinitionInfo() {} - public GroupDefinitionInfo(GroupDefinition other) { this.setName(other.getName()); this.setDescription(other.getDescription()); @@ -90,105 +97,24 @@ public class GroupDefinitionInfo { this.setProperties(other.convertToGroupInstancesProperties()); } - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getGroupUUID() { - return groupUUID; - } - - public void setGroupUUID(String groupUUID) { - this.groupUUID = groupUUID; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getCustomizationUUID() { - return customizationUUID; - } - - public void setCustomizationUUID(String customizationUUID) { - this.customizationUUID = customizationUUID; - } - - public Boolean getIsBase() { - return isBase; - } - - public void setIsBase(Boolean isBase) { - this.isBase = isBase; - } - public List<ArtifactDefinitionInfo> getArtifacts() { return (artifacts==null) ? null : new ArrayList<>(artifacts); } - public void setArtifacts(List<ArtifactDefinitionInfo> artifacts) { - this.artifacts = (artifacts==null) ? null : new ArrayList<>(artifacts); - } - public List<GroupProperty> getProperties() { return (properties==null) ? null : new ArrayList<>(properties); } - public void setProperties(List<? extends GroupProperty> properties) { - this.properties = (properties==null) ? null : new ArrayList<>(properties); - } - - public String getGroupInstanceUniqueId() { - return groupInstanceUniqueId; - } - - public void setGroupInstanceUniqueId(String groupInstanceUniqueId) { - this.groupInstanceUniqueId = groupInstanceUniqueId; - } - - public Map<String, String> getMembers() { - return members; + public void setArtifacts(List<ArtifactDefinitionInfo> artifacts) { + this.artifacts = (artifacts==null) ? null : new ArrayList<>(artifacts); } - public void setMembers(Map<String, String> members) { - this.members = members; + public void setProperties(List<? extends GroupProperty> properties) { + this.properties = (properties==null) ? null : new ArrayList<>(properties); } @Override public String toString() { return "GroupDefinitionInfo [" + super.toString() + ", isBase=" + isBase + ", artifacts=" + artifacts + "]"; } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java index 3ae0dcdf62..ddee613dd5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java @@ -20,35 +20,13 @@ package org.openecomp.sdc.be.info; -public class GroupTemplateInfo { - String groupName; - boolean isBase; - ArtifactTemplateInfo artifactTemplateInfo; - - public GroupTemplateInfo() {} - - public String getGroupName() { - return groupName; - } - - public void setGroupName(String groupName) { - this.groupName = groupName; - } - - public boolean isBase() { - return isBase; - } - - public void setBase(boolean isBase) { - this.isBase = isBase; - } - - public ArtifactTemplateInfo getArtifactTemplateInfo() { - return artifactTemplateInfo; - } - - public void setArtifactTemplateInfo(ArtifactTemplateInfo artifactTemplateInfo) { - this.artifactTemplateInfo = artifactTemplateInfo; - } +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter +public class GroupTemplateInfo { + private String groupName; + private boolean base; + private ArtifactTemplateInfo artifactTemplateInfo; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java index 0b39bdcb4b..4ae38f9f80 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/MergedArtifactInfo.java @@ -20,6 +20,9 @@ package org.openecomp.sdc.be.info; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -31,32 +34,22 @@ import java.util.Set; public class MergedArtifactInfo { + @Getter @Setter(AccessLevel.NONE) private List<ArtifactDefinition> createdArtifact; + @Getter @Setter private ArtifactTemplateInfo jsonArtifactTemplate; - private Set<String> parsetArtifactsNames; - - public List<ArtifactDefinition> getCreatedArtifact() { - return createdArtifact; - } + private Set<String> parsedArtifactsNames; public void setCreatedArtifact(List<ArtifactDefinition> createdArtifact) { this.createdArtifact = createdArtifact; - parsetArtifactsNames = new HashSet<>(); - parsetArtifactsNames.add(jsonArtifactTemplate.getFileName()); + parsedArtifactsNames = new HashSet<>(); + parsedArtifactsNames.add(jsonArtifactTemplate.getFileName()); List<ArtifactTemplateInfo> relatedGroupTemplateList = jsonArtifactTemplate.getRelatedArtifactsInfo(); if (relatedGroupTemplateList != null && !relatedGroupTemplateList.isEmpty()) { - this.createArtifactsGroupSet(relatedGroupTemplateList, parsetArtifactsNames); + this.createArtifactsGroupSet(relatedGroupTemplateList, parsedArtifactsNames); } } - public ArtifactTemplateInfo getJsonArtifactTemplate() { - return jsonArtifactTemplate; - } - - public void setJsonArtifactTemplate(ArtifactTemplateInfo jsonArtifactTemplate) { - this.jsonArtifactTemplate = jsonArtifactTemplate; - } - public List<ArtifactTemplateInfo> getListToAssociateArtifactToGroup() { List<ArtifactTemplateInfo> resList = new ArrayList<>(); List<ArtifactTemplateInfo> relatedArtifacts = jsonArtifactTemplate.getRelatedArtifactsInfo(); @@ -70,14 +63,14 @@ public class MergedArtifactInfo { List<ArtifactDefinition> resList = new ArrayList<>(); for (ArtifactDefinition artifactDefinition : createdArtifact) { boolean isDissotiate = true; - if(parsetArtifactsNames.contains(artifactDefinition.getArtifactName())){ + if(parsedArtifactsNames.contains(artifactDefinition.getArtifactName())){ isDissotiate = false; }else{ if (artifactDefinition.getGeneratedFromId() != null && !artifactDefinition.getGeneratedFromId().isEmpty()){ Optional<ArtifactDefinition> op = createdArtifact.stream().filter(p -> p.getUniqueId().equals(artifactDefinition.getGeneratedFromId())).findAny(); if(op.isPresent()){ ArtifactDefinition generatedFromArt = op.get(); - if(parsetArtifactsNames.contains(generatedFromArt.getArtifactName())){ + if(parsedArtifactsNames.contains(generatedFromArt.getArtifactName())){ isDissotiate = false; } } @@ -164,5 +157,4 @@ public class MergedArtifactInfo { } } } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java index 9ab0bd7f27..a4d7db2e78 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java @@ -21,6 +21,9 @@ */ package org.openecomp.sdc.be.info; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -28,36 +31,10 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; +@Getter +@Setter +@AllArgsConstructor public class NodeTypeInfoToUpdateArtifacts { - private String nodeName; private Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle; - - NodeTypeInfoToUpdateArtifacts() {} - - public NodeTypeInfoToUpdateArtifacts(String nodeName, - Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle) { - super(); - this.nodeName = nodeName; - this.nodeTypesArtifactsToHandle = nodeTypesArtifactsToHandle; - } - - public String getNodeName() { - return nodeName; - } - - public void setNodeName(String nodeName) { - this.nodeName = nodeName; - } - - public Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> getNodeTypesArtifactsToHandle() { - return nodeTypesArtifactsToHandle; - } - - public void setNodeTypesArtifactsToHandle( - Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle) { - this.nodeTypesArtifactsToHandle = nodeTypesArtifactsToHandle; - } - - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java index e5313a7108..daeea5e18a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/OperationalEnvInfo.java @@ -24,11 +24,15 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.common.log.wrappers.Logger; import java.io.IOException; +@Getter +@Setter public final class OperationalEnvInfo { @JsonIgnore private static ObjectMapper objectMapper = new ObjectMapper(); @@ -60,70 +64,6 @@ public final class OperationalEnvInfo { @JsonProperty("relationship-list") private RelationshipList relationships; - public String getOperationalEnvId() { - return operationalEnvId; - } - - public void setOperationalEnvId(String operationalEnvId) { - this.operationalEnvId = operationalEnvId; - } - - public String getOperationalEnvName() { - return operationalEnvName; - } - - public void setOperationalEnvName(String operationalEnvName) { - this.operationalEnvName = operationalEnvName; - } - - public String getOperationalEnvType() { - return operationalEnvType; - } - - public void setOperationalEnvType(String operationalEnvType) { - this.operationalEnvType = operationalEnvType; - } - - public String getOperationalEnvStatus() { - return operationalEnvStatus; - } - - public void setOperationalEnvStatus(String operationalEnvStatus) { - this.operationalEnvStatus = operationalEnvStatus; - } - - public String getTenantContext() { - return tenantContext; - } - - public void setTenantContext(String tenantContext) { - this.tenantContext = tenantContext; - } - - public String getWorkloadContext() { - return workloadContext; - } - - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public RelationshipList getRelationships() { - return relationships; - } - - public void setRelationships(RelationshipList relationships) { - this.relationships = relationships; - } - @Override public String toString() { try { @@ -138,5 +78,4 @@ public final class OperationalEnvInfo { public static OperationalEnvInfo createFromJson(String json) throws IOException { return objectMapper.readValue(json, OperationalEnvInfo.class); } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelatedToProperty.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelatedToProperty.java index 047d74c876..abea08353b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelatedToProperty.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelatedToProperty.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.info; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public final class RelatedToProperty { @JsonProperty("property-key") @@ -29,20 +33,4 @@ public final class RelatedToProperty { @JsonProperty("property-value") private String propertyValue; - - public String getPropertyKey() { - return propertyKey; - } - - public void setPropertyKey(String propertyKey) { - this.propertyKey = propertyKey; - } - - public String getPropertyValue() { - return propertyValue; - } - - public void setPropertyValue(String propertyValue) { - this.propertyValue = propertyValue; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java index 8238e9121d..3c5f1e2ec3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/Relationship.java @@ -24,7 +24,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public final class Relationship { @JsonProperty("related-to") @@ -37,27 +42,13 @@ public final class Relationship { private String relatedLink; @JsonProperty("relationship-data") + @Getter(AccessLevel.NONE) private List<RelationshipData> relationshipData; @JsonProperty("related-to-property") + @Getter(AccessLevel.NONE) private List<RelatedToProperty> relatedToProperty; - public String getRelatedTo() { - return relatedTo; - } - - public void setRelatedTo(String relatedTo) { - this.relatedTo = relatedTo; - } - - public String getRelatedLink() { - return relatedLink; - } - - public void setRelatedLink(String relatedLink) { - this.relatedLink = relatedLink; - } - public List<RelationshipData> getRelationshipData() { if(relationshipData == null) { relationshipData = new ArrayList<>(); @@ -65,26 +56,10 @@ public final class Relationship { return relationshipData; } - public void setRelationshipData(List<RelationshipData> relationshipData) { - this.relationshipData = relationshipData; - } - - public String getRelationshipLabel() { - return relationshipLabel; - } - - public void setRelationshipLabel(String relationshipLabel) { - this.relationshipLabel = relationshipLabel; - } - public List<RelatedToProperty> getRelatedToProperty() { if(relatedToProperty == null) { relatedToProperty = new ArrayList<>(); } return relatedToProperty; } - - public void setRelatedToProperty(List<RelatedToProperty> relatedToProperty) { - this.relatedToProperty = relatedToProperty; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipData.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipData.java index a1516573bc..fd8d6609c2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipData.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipData.java @@ -20,7 +20,11 @@ package org.openecomp.sdc.be.info; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public final class RelationshipData { @JsonProperty("relationship-key") @@ -28,20 +32,4 @@ public final class RelationshipData { @JsonProperty("relationship-value") private String relationshipValue; - - public void setRelationshipKey(String relationshipKey) { - this.relationshipKey = relationshipKey; - } - - public String getRelationshipKey() { - return this.relationshipKey; - } - - public void setRelationshipValue(String relationshipValue) { - this.relationshipValue = relationshipValue; - } - - public String getRelationshipValue() { - return this.relationshipValue; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipList.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipList.java index 54df733a7b..f143e01a58 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipList.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/RelationshipList.java @@ -22,7 +22,9 @@ package org.openecomp.sdc.be.info; import java.util.ArrayList; import java.util.List; +import lombok.Setter; +@Setter public class RelationshipList { private List<Relationship> relationship; @@ -32,9 +34,4 @@ public class RelationshipList { } return relationship; } - - public void setRelationship(List<Relationship> relationship) { - this.relationship = relationship; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceInfo.java index e21c2a5e19..3ad6728de8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceInfo.java @@ -20,38 +20,15 @@ package org.openecomp.sdc.be.info; -import com.google.common.annotations.VisibleForTesting; - import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter +@AllArgsConstructor public class ServiceInfo { - private String name; private List<ServiceVersionInfo> versions; - - @VisibleForTesting - ServiceInfo() { - } - - public ServiceInfo(String serviceName, List<ServiceVersionInfo> list) { - this.name = serviceName; - this.versions = list; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List<ServiceVersionInfo> getVersions() { - return versions; - } - - public void setVersions(List<ServiceVersionInfo> versions) { - this.versions = versions; - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java index fc4cb895da..185c1a474e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java @@ -20,16 +20,15 @@ package org.openecomp.sdc.be.info; -import com.google.common.annotations.VisibleForTesting; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ServiceVersionInfo { - private String version; private String url; - @VisibleForTesting - ServiceVersionInfo() {} - public ServiceVersionInfo(String serviceName, String serviceVersion, String context) { super(); this.version = serviceVersion; @@ -37,20 +36,4 @@ public class ServiceVersionInfo { sb.append("services/").append(serviceName).append("/").append(serviceVersion); url = sb.toString(); } - - public String getVersion() { - return version; - } - - public void setVersion(String serviceVersion) { - this.version = serviceVersion; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServicesWrapper.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServicesWrapper.java index 00f41ad434..1a438e57d1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServicesWrapper.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServicesWrapper.java @@ -21,15 +21,11 @@ package org.openecomp.sdc.be.info; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ServicesWrapper { private List<ServiceInfo> services; - - public List<ServiceInfo> getServices() { - return services; - } - - public void setServices(List<ServiceInfo> services) { - this.services = services; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServletJsonResponse.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServletJsonResponse.java index ae2032eb43..1c0944403a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServletJsonResponse.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServletJsonResponse.java @@ -20,25 +20,12 @@ package org.openecomp.sdc.be.info; -public class ServletJsonResponse { - - String source; - String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter +public class ServletJsonResponse { + private String source; + private String description; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfo.java index 031477cfe9..8df81c1727 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfo.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.info; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ToscaNodeTypeInfo { private String nodeName; @@ -29,41 +33,8 @@ public class ToscaNodeTypeInfo { private List<ToscaNodeTypeInterface> interfaces; private String iconPath; - public String getNodeName() { - return nodeName; - } - - public void setNodeName(String nodeName) { - this.nodeName = nodeName; - } - - public String getTemplateVersion() { - return templateVersion; - } - - public void setTemplateVersion(String templateVersion) { - this.templateVersion = templateVersion; - } - - public List<ToscaNodeTypeInterface> getInterfaces() { - return interfaces; - } - - public void setInterfaces(List<ToscaNodeTypeInterface> interfaces) { - this.interfaces = interfaces; - } - - public String getIconPath() { - return iconPath; - } - - public void setIconPath(String iconPath) { - this.iconPath = iconPath; - } - @Override public String toString() { return "ToscaNodeTypeInfo [nodeName=" + nodeName + ", templateVersion=" + templateVersion + ", interfaces=" + interfaces + ", iconPath=" + iconPath + "]"; } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterface.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterface.java index 05fa3193c1..19ed017de8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterface.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterface.java @@ -21,17 +21,11 @@ package org.openecomp.sdc.be.info; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ToscaNodeTypeInterface { - - List<String> scripts; - - public List<String> getScripts() { - return scripts; - } - - public void setScripts(List<String> scripts) { - this.scripts = scripts; - } - + private List<String> scripts; } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java index 725c95c569..9d3cc69006 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactDefinitionInfoTest.java @@ -28,7 +28,6 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.model.ArtifactDefinition; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -45,11 +44,6 @@ public class ArtifactDefinitionInfoTest { private static final String NAME = "Name"; @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ArtifactDefinitionInfo.class, hasValidGettersAndSetters()); - } - - @Test public void testCtor() { Mockito.when(artifactDefinition.getPayloadData()).thenReturn(PAYLOAD_DATA); Mockito.when(artifactDefinition.getArtifactName()).thenReturn(NAME); @@ -64,6 +58,4 @@ public class ArtifactDefinitionInfoTest { assertThat(artifactDefinitionInfo.getArtifactUUID(), is(UUID)); } - - }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java index 721e929791..4cfb75a859 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java @@ -56,5 +56,4 @@ public class ArtifactTemplateInfoTest { assertThat(artifactTemplateInfo.getEnv(), is(ENV)); assertThat(artifactTemplateInfo.getRelatedArtifactsInfo(), is(artifactsInfo)); } - }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java index 4435dc8f4c..81b8171042 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/CreateAndAssotiateInfoTest.java @@ -26,17 +26,9 @@ import org.junit.Test; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; public class CreateAndAssotiateInfoTest { - - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(CreateAndAssotiateInfo.class, hasValidGettersAndSetters()); - } - @Test public void shouldTestWhetherTheDefaultConstructorCorrectlySetAllFields() { ComponentInstance componentInstance = new ComponentInstance(); @@ -45,6 +37,4 @@ public class CreateAndAssotiateInfoTest { Assert.assertThat(createAndAssociateInfo.getAssociate(), is(requirementCapabilityRelDef)); Assert.assertThat(createAndAssociateInfo.getNode(), is(componentInstance)); } - - }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java index 46dce6ad61..202a1c1203 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusInfoTest.java @@ -29,9 +29,7 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; import java.util.HashMap; import java.util.Map; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; public class DistributionStatusInfoTest { @@ -43,11 +41,6 @@ public class DistributionStatusInfoTest { private static final String AUDIT_DESC = "AUDIT_DESC"; @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(DistributionStatusInfo.class, hasValidGettersAndSetters()); - } - - @Test public void testCtorWithAuditingGenericEvent() { AuditingGenericEvent distributionStatusEvent = createAuditingGenericEvent(); DistributionStatusInfo distributionStatusInfo = new DistributionStatusInfo(distributionStatusEvent); @@ -78,5 +71,4 @@ public class DistributionStatusInfoTest { distributionStatusEvent.setFields(fields); return distributionStatusEvent; } - }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java index 01040bce2c..f71e41b635 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java @@ -40,100 +40,6 @@ public class DistributionStatusOfServiceInfoTest { } @Test - public void testCtor() throws Exception { - new DistributionStatusOfServiceInfo("","","",""); - } - - - @Test - public void testGetDistributionID() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDistributionID(); - } - - - @Test - public void testSetDistributionID() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String distributionID = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDistributionID(distributionID); - } - - - @Test - public void testGetTimestamp() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getTimestamp(); - } - - - @Test - public void testSetTimestamp() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String timestamp = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setTimestamp(timestamp); - } - - - @Test - public void testGetUserId() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUserId(); - } - - - @Test - public void testSetUserId() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String userId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUserId(userId); - } - - - @Test - public void testGetDeployementStatus() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getDeployementStatus(); - } - - - @Test - public void testSetDeployementStatus() throws Exception { - DistributionStatusOfServiceInfo testSubject; - String deployementStatus = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setDeployementStatus(deployementStatus); - } - - - @Test public void shouldHaveValidDefaultConstructor() { assertThat(DistributionStatusOfServiceInfo.class, hasValidBeanConstructor()); } @@ -152,6 +58,4 @@ public class DistributionStatusOfServiceInfoTest { assertThat(distributionStatusOfServiceInfo.getUserId(), is(USER_ID)); assertThat(distributionStatusOfServiceInfo.getDeployementStatus(), is(STATUS)); } - - }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java index dce3e16145..befcc8ced6 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GenericArtifactQueryInfoTest.java @@ -24,8 +24,6 @@ import org.junit.Test; import java.util.Collections; import java.util.Set; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -36,16 +34,6 @@ public class GenericArtifactQueryInfoTest { private static final Set<String> FIELDS = Collections.emptySet(); @Test - public void shouldHaveValidDefaultConstructor() { - assertThat(GenericArtifactQueryInfo.class, hasValidBeanConstructor()); - } - - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(GenericArtifactQueryInfo.class, hasValidGettersAndSetters()); - } - - @Test public void shouldTestConstructorCorrectlySetFields(){ GenericArtifactQueryInfo genericArtifactQueryInfo = new GenericArtifactQueryInfo(FIELDS, PARENT_ID, ARTIFACT_UNIQUE_ID); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java index 3c68e9ec89..a6b9af8b0c 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java @@ -21,18 +21,21 @@ */ package org.openecomp.sdc.be.info; -import com.google.code.beanmatchers.BeanMatchers; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; import java.util.ArrayList; import java.util.List; +import org.openecomp.sdc.be.model.GroupProperty; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.CoreMatchers.sameInstance; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.matchesPattern; @@ -49,11 +52,6 @@ public class GroupDefinitionInfoTest { private static final String NAME = "NAME"; @Test - public void shouldHaveValidDefaultConstructor() { - assertThat(GroupDefinitionInfo.class, hasValidBeanConstructor()); - } - - @Test public void testShouldConstructObjectFromGroupDefinition() { GroupDefinition groupDefinition = createGroupDefinition(); GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(groupDefinition); @@ -79,15 +77,36 @@ public class GroupDefinitionInfoTest { } @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(GroupDefinitionInfo.class, BeanMatchers.hasValidGettersAndSettersExcluding("artifacts", "properties")); + public void testValidGetterSetterArtifacts() { + GroupDefinition groupDefinition = new GroupDefinition(); + GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(groupDefinition); + groupDefinitionInfo.setArtifacts(null); + assertThat(groupDefinitionInfo.getArtifacts(), nullValue()); + + List<ArtifactDefinitionInfo> artifacts = new ArrayList<>(); + groupDefinitionInfo.setArtifacts(artifacts); + assertThat(groupDefinitionInfo.getArtifacts(), not(sameInstance(artifacts))); + } + + @Test + public void testValidGetterSetterProperties() { + GroupDefinition groupDefinition = new GroupDefinition(); + GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(groupDefinition); + groupDefinitionInfo.setProperties(null); + assertThat(groupDefinitionInfo.getProperties(), nullValue()); + + List<GroupProperty> properties = new ArrayList<>(); + groupDefinitionInfo.setProperties(properties); + assertThat(groupDefinitionInfo.getProperties(), not(sameInstance(properties))); } @Test public void testToString() { - GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(); + GroupDefinition groupDefinition = new GroupDefinition(); + ArtifactDefinition artifactDefinition = new ArtifactDefinition(); + GroupDefinitionInfo groupDefinitionInfo = new GroupDefinitionInfo(groupDefinition); List<ArtifactDefinitionInfo> artifacts = new ArrayList<>(); - ArtifactDefinitionInfo artifactDefinitionInfo = new ArtifactDefinitionInfo(); + ArtifactDefinitionInfo artifactDefinitionInfo = new ArtifactDefinitionInfo(artifactDefinition); artifactDefinitionInfo.setArtifactName(ARTIFACT_NAME); artifacts.add(artifactDefinitionInfo); groupDefinitionInfo.setArtifacts(artifacts); @@ -116,5 +135,4 @@ public class GroupDefinitionInfoTest { groupInstanceDataDefinition.setGroupUUID(GROUP_UUID); return groupInstanceDataDefinition; } - }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java index dcce6fdb9b..fc9743e4c1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java @@ -31,7 +31,7 @@ public class GroupTemplateInfoTest { @Test public void shouldHaveValidDefaultConstructor() { - assertThat(DistributionStatusOfServiceListResponce.class, hasValidBeanConstructor()); + assertThat(GroupTemplateInfo.class, hasValidBeanConstructor()); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifactsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifactsTest.java index 987563276d..2980a1e549 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifactsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifactsTest.java @@ -30,7 +30,6 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -41,11 +40,6 @@ public class NodeTypeInfoToUpdateArtifactsTest { .emptyMap(); @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(NodeTypeInfoToUpdateArtifacts.class, hasValidGettersAndSetters()); - } - - @Test public void shouldConstructCorrectObject() { NodeTypeInfoToUpdateArtifacts nodeTypeInfoToUpdateArtifacts = new NodeTypeInfoToUpdateArtifacts(NAME, NODE_TYPES_ARTIFACTS_TO_HANDLE); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java index 0444e1f689..2af5e83f34 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipListTest.java @@ -19,10 +19,13 @@ */ package org.openecomp.sdc.be.info; +import java.util.List; import org.junit.Test; import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; public class RelationshipListTest { @@ -37,4 +40,10 @@ public class RelationshipListTest { assertThat(RelationshipList.class, hasValidGettersAndSetters()); } + @Test + public void testNonDefaultGetter() { + RelationshipList relationshipList = new RelationshipList(); + assertThat(relationshipList.getRelationship(), notNullValue()); + assertThat(relationshipList.getRelationship(), instanceOf(List.class)); + } }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipTest.java index e2326d49cd..a2b4d72c99 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/RelationshipTest.java @@ -21,10 +21,13 @@ */ package org.openecomp.sdc.be.info; +import java.util.List; import org.junit.Test; import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; public class RelationshipTest { @@ -39,4 +42,17 @@ public class RelationshipTest { assertThat(Relationship.class, hasValidBeanConstructor()); } + @Test + public void testNonDefaultPropertyGetter() { + Relationship relationship = new Relationship(); + assertThat(relationship.getRelatedToProperty(), notNullValue()); + assertThat(relationship.getRelatedToProperty(), instanceOf(List.class)); + } + + @Test + public void testNonDefaultRelationshipDataGetter() { + Relationship relationship = new Relationship(); + assertThat(relationship.getRelationshipData(), notNullValue()); + assertThat(relationship.getRelationshipData(), instanceOf(List.class)); + } }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java index 25021a985c..e7f3f5544a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceInfoTest.java @@ -26,7 +26,6 @@ import org.junit.Test; import java.util.Collections; import java.util.List; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -36,11 +35,6 @@ public class ServiceInfoTest { private static final List<ServiceVersionInfo> SERVICE_VERSION_INFOS = Collections.emptyList(); @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ServiceInfo.class, hasValidGettersAndSetters()); - } - - @Test public void shouldConstructCorrectObject() { ServiceInfo serviceInfo = new ServiceInfo(NAME, SERVICE_VERSION_INFOS); assertThat(serviceInfo.getName(), is(NAME)); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java index d7c9815da9..a800f817e3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServiceVersionInfoTest.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.info; import org.junit.Test; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -35,11 +34,6 @@ public class ServiceVersionInfoTest { private static final String URL = "http://localhost:1000/services/NAME/VERSION"; @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ServiceVersionInfo.class, hasValidGettersAndSetters()); - } - - @Test public void shouldConstructCorrectObject() { ServiceVersionInfo serviceVersionInfo = new ServiceVersionInfo(NAME, VERSION, CONTEXT); assertThat(serviceVersionInfo.getUrl(), is(URL)); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java index 8e96ead0fd..dcb77b29dd 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java @@ -36,7 +36,7 @@ public class ServicesWrapperTest { @Test public void shouldHaveValidDefaultConstructor() { - assertThat(ServiceInfo.class, hasValidBeanConstructor()); + assertThat(ServicesWrapper.class, hasValidBeanConstructor()); } }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java index c3e76af97d..e603591cb8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java @@ -36,7 +36,7 @@ public class ServletJsonResponseTest { @Test public void shouldHaveValidDefaultConstructor() { - assertThat(ServiceInfo.class, hasValidBeanConstructor()); + assertThat(ServletJsonResponse.class, hasValidBeanConstructor()); } }
\ No newline at end of file diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java index e3f68835e5..8c75285fed 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java @@ -31,7 +31,7 @@ public class ToscaNodeTypeInfoTest { @Test public void shouldHaveValidDefaultConstructor() { - assertThat(ServiceInfo.class, hasValidBeanConstructor()); + assertThat(ToscaNodeTypeInfo.class, hasValidBeanConstructor()); } @Test @@ -43,5 +43,4 @@ public class ToscaNodeTypeInfoTest { public void allPropertiesShouldBeRepresentedInToStringOutput() { assertThat(ToscaNodeTypeInfo.class, BeanMatchers.hasValidBeanToString()); } - }
\ No newline at end of file |