diff options
author | shrek2000 <oren.kleks@amdocs.com> | 2020-02-05 15:41:59 +0200 |
---|---|---|
committer | Oren Kleks <oren.kleks@amdocs.com> | 2020-02-06 10:05:24 +0000 |
commit | 723992503b98f84da5aec904a384ade6d76a89f4 (patch) | |
tree | 9c6ea5892219452d103750dd463fa85a8e61ec8b | |
parent | 0e6b06b2abac7e7f5246e5a85fc6569f5ef8348b (diff) |
Increase code coverage
Moving to lombok. ServiceMetadataDataDefintion did not use lombok. The Equal, hashCode and toString functions were too completed to maintain.
Issue-ID: SDC-2690
Change-Id: I2e361ca790df8a271602c36bc57912ba2b7ed5fe
Signed-off-by: shrek2000 <oren.kleks@amdocs.com>
-rw-r--r-- | common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java | 210 |
1 files changed, 24 insertions, 186 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java index 483c6fcabc..cf35f5d387 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java @@ -20,218 +20,56 @@ package org.openecomp.sdc.be.datatypes.components; +import lombok.Data; +import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor; - - +@Data +@NoArgsConstructor public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition { + private static final String EMPTY_STR = ""; private String distributionStatus; - private String serviceType; - private String serviceRole; - private String instantiationType = EMPTY_STR; - private String serviceFunction; - - private Boolean ecompGeneratedNaming = true; - - private String namingPolicy = EMPTY_STR; - - private String environmentContext; - - public ServiceMetadataDataDefinition() { - super(); - serviceType = ""; - serviceRole = ""; - serviceFunction = ""; - } - public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) { - super(other); - serviceType = other.getServiceType(); - serviceRole = other.getServiceRole(); - serviceFunction = other.getServiceFunction(); - } - - public ServiceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){ - super(extractor); - serviceType = extractor.getServiceType(); - serviceRole = extractor.getServiceRole(); - serviceFunction = extractor.getServiceFunction(); - } + private String serviceType = EMPTY_STR; - public String getDistributionStatus() { - return distributionStatus; - } - public void setDistributionStatus(String distributionStatus) { - this.distributionStatus = distributionStatus; - } + private String serviceRole = EMPTY_STR; - public String getServiceType() { - return serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getServiceRole() { - return serviceRole; - } + private String instantiationType = EMPTY_STR; - public String getInstantiationType() { - return instantiationType; - } - public void setInstantiationType(String instantiationType) { - this.instantiationType = instantiationType; - } + private String serviceFunction = EMPTY_STR; - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - public Boolean isEcompGeneratedNaming() { - return ecompGeneratedNaming; - } + private Boolean ecompGeneratedNaming = true; - public Boolean getEcompGeneratedNaming() { - return ecompGeneratedNaming; - } - public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) { - this.ecompGeneratedNaming = ecompGeneratedNaming; - } + private String namingPolicy = EMPTY_STR; - public String getNamingPolicy() { - return namingPolicy; - } - public void setNamingPolicy(String namingPolicy) { - this.namingPolicy = namingPolicy; - } + private String environmentContext; - public String getEnvironmentContext() { - return environmentContext; - } - public void setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; + public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) { + super(other); + serviceType = other.getServiceType(); + serviceRole = other.getServiceRole(); + serviceFunction = other.getServiceFunction(); } - public String getServiceFunction() { - return serviceFunction; - } - - public void setServiceFunction(String serviceFunction) { - this.serviceFunction = serviceFunction; - } - - @Override - public String toString() { - return "ServiceMetadataDataDefinition{" + - "distributionStatus='" + distributionStatus + '\'' + - ", serviceType='" + serviceType + '\'' + - ", serviceRole='" + serviceRole + '\'' + - ", serviceFunction='" + serviceFunction + '\'' + - ", ecompGeneratedNaming=" + ecompGeneratedNaming + - ", namingPolicy='" + namingPolicy + '\'' + - ", environmentContext='" + environmentContext + '\'' + - ", instantiationType='" + instantiationType + '\'' + - '}'; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode()); - result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode()); - result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode()); - result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); - result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode()); - result = prime * result + ((serviceFunction == null) ? 0 : serviceFunction.hashCode()); - result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode()); - result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode()); - return result; + public ServiceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor) { + super(extractor); + serviceType = extractor.getServiceType(); + serviceRole = extractor.getServiceRole(); + serviceFunction = extractor.getServiceFunction(); } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof ComponentMetadataDataDefinition)) { - return false; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj; - if (distributionStatus == null) { - if (other.distributionStatus != null) { - return false; - } - } else if (!distributionStatus.equals(other.distributionStatus)) { - return false; - } - if (ecompGeneratedNaming == null) { - if (other.ecompGeneratedNaming != null) { - return false; - } - } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) { - return false; - } - if (namingPolicy == null) { - if (other.namingPolicy != null) { - return false; - } - } else if (!namingPolicy.equals(other.namingPolicy)) { - return false; - } - if (serviceType == null) { - if (other.serviceType != null) { - return false; - } - } else if (!serviceType.equals(other.serviceType)) { - return false; - } - if (serviceRole == null) { - if (other.serviceRole != null) { - return false; - } - } else if (!serviceRole.equals(other.serviceRole)) { - return false; - } - if (environmentContext == null) { - if (other.environmentContext != null) { - return false; - } - } else if (!environmentContext.equals(other.environmentContext)) { - return false; - } - if (instantiationType == null) { - if (other.instantiationType != null) { - return false; - } - } else if (!instantiationType.equals(other.instantiationType)) { - return false; - } - if (serviceFunction == null){ - if (other.serviceFunction != null) { - return false; - } else if (!serviceFunction.equals(other.serviceFunction)) - return false; - } - return super.equals(obj); + public Boolean isEcompGeneratedNaming() { + return getEcompGeneratedNaming(); } @Override |