aboutsummaryrefslogtreecommitdiffstats
path: root/common/onap-tosca-datatype
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-28 14:39:05 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-29 07:15:14 +0000
commit4014cbcbe3a61391fa5f7de9f42ec247ca493979 (patch)
tree88435c882896b582c81b964ce98e160f00c8baf2 /common/onap-tosca-datatype
parent04c236567737c965545f64c9542a7d75ed6f9046 (diff)
Improve test coverage (common)
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3428 Change-Id: I60862879fc09a81369d6e5fdf9f3c985994b163e
Diffstat (limited to 'common/onap-tosca-datatype')
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java70
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java42
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java45
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java53
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java78
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java12
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java86
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java37
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java125
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java77
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java33
-rw-r--r--common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java25
-rw-r--r--common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinitionTest.java72
-rw-r--r--common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java65
14 files changed, 198 insertions, 622 deletions
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
index 73b5d77599..c3c0cc0f80 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
@@ -17,8 +17,14 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.List;
import java.util.Objects;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
+@Getter
+@Setter
+@NoArgsConstructor
public class DefinitionOfDataType implements Cloneable {
private String type;
@@ -30,70 +36,6 @@ public class DefinitionOfDataType implements Cloneable {
private List<Constraint> constraints;
private EntrySchema entry_schema;
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- public Boolean getRequired() {
- return required;
- }
-
- public void setRequired(Boolean required) {
- this.required = required;
- }
-
- public Object get_default() {
- return _default;
- }
-
- public void set_default(Object _default) {
- this._default = _default;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public List<Constraint> getConstraints() {
- return constraints;
- }
-
- public void setConstraints(List<Constraint> constraints) {
- this.constraints = constraints;
- }
-
- public EntrySchema getEntry_schema() {
- return entry_schema;
- }
-
- public void setEntry_schema(EntrySchema entry_schema) {
- this.entry_schema = entry_schema;
- }
-
@Override
public DefinitionOfDataType clone() {
DefinitionOfDataType definitionOfDataType = new DefinitionOfDataType();
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
index 6e05e39c18..63ce0630f5 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
@@ -17,47 +17,21 @@
package org.onap.sdc.tosca.datatypes.model;
import java.util.List;
-import java.util.Objects;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
+@Getter
+@Setter
+@NoArgsConstructor
+@EqualsAndHashCode
public class Implementation implements Cloneable {
private String primary;
private List<String> dependencies;
- public String getPrimary() {
- return primary;
- }
-
- public void setPrimary(String primary) {
- this.primary = primary;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof Implementation)) {
- return false;
- }
- Implementation that = (Implementation) o;
- return Objects.equals(primary, that.primary) && Objects.equals(dependencies, that.dependencies);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(primary, dependencies);
- }
-
@Override
public Implementation clone() {
Implementation implementation = new Implementation();
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
index 5e86c29ed2..2d35bf6fc1 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
@@ -17,19 +17,23 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
import java.util.Optional;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
+@Getter
+@Setter
+@NoArgsConstructor
+@EqualsAndHashCode
public class InterfaceDefinitionTemplate extends InterfaceDefinition {
private Map<String, Object> inputs;
private Map<String, OperationDefinitionTemplate> operations;
- public InterfaceDefinitionTemplate() {
- }
-
public InterfaceDefinitionTemplate(Object toscaInterfaceDefTemplateObj) {
InterfaceDefinitionTemplate interfaceDefinitionTemplate = (InterfaceDefinitionTemplate) convertObjToInterfaceDefinition(
toscaInterfaceDefTemplateObj);
@@ -37,39 +41,6 @@ public class InterfaceDefinitionTemplate extends InterfaceDefinition {
this.setOperations(DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionTemplate.getOperations()));
}
- public Map<String, Object> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, Object> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, OperationDefinitionTemplate> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationDefinitionTemplate> operations) {
- this.operations = operations;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(inputs, operations);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof InterfaceDefinitionTemplate)) {
- return false;
- }
- InterfaceDefinitionTemplate that = (InterfaceDefinitionTemplate) o;
- return Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations);
- }
-
@Override
public void addOperation(String operationName, OperationDefinition operationDefinition) {
addOperation(operationName, (OperationDefinitionTemplate) operationDefinition);
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
index b0fb06974b..be65ee57ae 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
@@ -17,20 +17,24 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
import java.util.Optional;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
+@Getter
+@Setter
+@NoArgsConstructor
+@EqualsAndHashCode
public class InterfaceDefinitionType extends InterfaceDefinition {
private String type;
private Map<String, PropertyDefinition> inputs;
private Map<String, OperationDefinitionType> operations;
- public InterfaceDefinitionType() {
- }
-
public InterfaceDefinitionType(Object toscaInterfaceDefinitionType) {
InterfaceDefinitionType interfaceDefinitionType = (InterfaceDefinitionType) convertObjToInterfaceDefinition(toscaInterfaceDefinitionType);
this.setType(interfaceDefinitionType.getType());
@@ -38,47 +42,6 @@ public class InterfaceDefinitionType extends InterfaceDefinition {
this.setOperations(DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionType.getOperations()));
}
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, PropertyDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, PropertyDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, OperationDefinitionType> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationDefinitionType> operations) {
- this.operations = operations;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- InterfaceDefinitionType that = (InterfaceDefinitionType) o;
- return Objects.equals(type, that.type) && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type, inputs, operations);
- }
-
@Override
public void addOperation(String operationName, OperationDefinition operationDefinition) {
addOperation(operationName, (OperationDefinitionType) operationDefinition);
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
index ffd9212701..f9f3c3d877 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
@@ -21,14 +21,21 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.tosca.error.ToscaRuntimeException;
import org.onap.sdc.tosca.services.CommonUtil;
import org.onap.sdc.tosca.services.DataModelCloneUtil;
+@Getter
+@Setter
+@NoArgsConstructor
+@EqualsAndHashCode
public class InterfaceType extends Interface {
protected static final String CONVERT_INTERFACE_TYPE_OBJECT_ERROR = "Could not create InterfaceType from input object, input object - ";
@@ -39,9 +46,6 @@ public class InterfaceType extends Interface {
private Map<String, PropertyDefinition> inputs;
private Map<String, OperationDefinition> operations;
- public InterfaceType() {
- }
-
public InterfaceType(Object toscaInterfaceTypeObj) {
InterfaceType interfaceType = convertObjToInterfaceType(toscaInterfaceTypeObj);
this.setDerived_from(interfaceType.getDerived_from());
@@ -75,54 +79,6 @@ public class InterfaceType extends Interface {
}
}
- public String getDerived_from() {
- return derived_from;
- }
-
- public void setDerived_from(String derivedFrom) {
- this.derived_from = derivedFrom;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Map<String, PropertyDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, PropertyDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, OperationDefinition> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationDefinition> operations) {
- this.operations = operations;
- }
-
public void addOperation(String operationName, OperationDefinition operationDefinition) {
if (MapUtils.isEmpty(this.operations)) {
this.operations = new HashMap<>();
@@ -130,24 +86,6 @@ public class InterfaceType extends Interface {
this.operations.put(operationName, operationDefinition);
}
- @Override
- public int hashCode() {
- return Objects.hash(derived_from, version, metadata, description, inputs, operations);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof InterfaceType)) {
- return false;
- }
- InterfaceType that = (InterfaceType) o;
- return Objects.equals(derived_from, that.derived_from) && Objects.equals(version, that.version) && Objects.equals(metadata, that.metadata)
- && Objects.equals(description, that.description) && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations);
- }
-
public Optional<Object> convertInterfaceTypeToToscaObj() {
return convertInterfaceToToscaInterfaceObj(this);
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
index 014eb620d5..d21b9514e8 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
@@ -17,25 +17,21 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.List;
import java.util.Map;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
import org.onap.sdc.tosca.services.DataModelNormalizeUtil;
+@Getter
+@NoArgsConstructor
public class NodeFilter {
private List<Map<String, List<Constraint>>> properties;
private List<Map<String, CapabilityFilter>> capabilities;
- public List<Map<String, CapabilityFilter>> getCapabilities() {
- return capabilities;
- }
-
public void setCapabilities(List<Map<String, CapabilityFilter>> capabilities) {
this.capabilities = DataModelNormalizeUtil.getNormalizeCapabilitiesFilter(capabilities);
}
- public List<Map<String, List<Constraint>>> getProperties() {
- return properties;
- }
-
public void setProperties(List<Map<String, List<Constraint>>> properties) {
this.properties = DataModelNormalizeUtil.getNormalizePropertiesFilter(properties);
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
index eca056fa7a..f8a151de1c 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
@@ -22,8 +22,14 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.apache.commons.collections4.MapUtils;
+@Getter
+@Setter
+@NoArgsConstructor
public class NodeType implements Cloneable {
private String derived_from;
@@ -37,70 +43,6 @@ public class NodeType implements Cloneable {
private Map<String, Object> interfaces;
private Map<String, ArtifactDefinition> artifacts;
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Map<String, CapabilityDefinition> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
- this.capabilities = capabilities;
- }
-
- public String getDerived_from() {
- return derived_from;
- }
-
- public void setDerived_from(String derivedFrom) {
- this.derived_from = derivedFrom;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public List<Map<String, RequirementDefinition>> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(List<Map<String, RequirementDefinition>> requirements) {
- this.requirements = requirements;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, AttributeDefinition> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Map<String, AttributeDefinition> attributes) {
- this.attributes = attributes;
- }
-
- public Map<String, Object> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(Map<String, Object> interfaces) {
- this.interfaces = interfaces;
- }
-
public Map<String, InterfaceDefinitionType> getNormalizeInterfaces() {
if (MapUtils.isEmpty(interfaces)) {
return new HashMap<>();
@@ -113,22 +55,6 @@ public class NodeType implements Cloneable {
return normativeInterfaceDefinition;
}
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Map<String, ArtifactDefinition> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
- this.artifacts = artifacts;
- }
-
@Override
public NodeType clone() {
NodeType clone = new NodeType();
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
index ae99f9325e..9882bd7464 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
@@ -19,6 +19,11 @@
*/
package org.onap.sdc.tosca.datatypes.model;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
public class RequirementDefinition implements Cloneable {
private String capability;
@@ -35,38 +40,6 @@ public class RequirementDefinition implements Cloneable {
occurrences[1] = 1;
}
- public String getCapability() {
- return capability;
- }
-
- public void setCapability(String capability) {
- this.capability = capability;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public String getRelationship() {
- return relationship;
- }
-
- public void setRelationship(String relationship) {
- this.relationship = relationship;
- }
-
- public Object[] getOccurrences() {
- return occurrences;
- }
-
- public void setOccurrences(Object[] occurrences) {
- this.occurrences = occurrences;
- }
-
@Override
public RequirementDefinition clone() {
RequirementDefinition requirementDefinition = new RequirementDefinition();
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
index 758786dad5..f250f77b7e 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
@@ -21,10 +21,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.apache.commons.collections4.MapUtils;
import org.onap.sdc.tosca.datatypes.model.heatextend.AnnotationType;
import org.onap.sdc.tosca.error.ToscaRuntimeException;
+@Getter
+@Setter
+@NoArgsConstructor
public class ServiceTemplate implements Template {
private String tosca_definitions_version;
@@ -44,46 +50,6 @@ public class ServiceTemplate implements Template {
private Map<String, AnnotationType> annotation_types;
private TopologyTemplate topology_template;
- public String getTosca_definitions_version() {
- return tosca_definitions_version;
- }
-
- public void setTosca_definitions_version(String toscaDefinitionsVersion) {
- this.tosca_definitions_version = toscaDefinitionsVersion;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Object getDsl_definitions() {
- return dsl_definitions;
- }
-
- public void setDsl_definitions(Object dslDefinitions) {
- this.dsl_definitions = dslDefinitions;
- }
-
- public Map<String, Repository> getRepositories() {
- return repositories;
- }
-
- public void setRepositories(Map<String, Repository> repositories) {
- this.repositories = repositories;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
public List getImports() {
return imports;
}
@@ -92,62 +58,6 @@ public class ServiceTemplate implements Template {
this.imports = convertToscaImports(imports);
}
- public Map<String, ArtifactType> getArtifact_types() {
- return artifact_types;
- }
-
- public void setArtifact_types(Map<String, ArtifactType> artifactTypes) {
- this.artifact_types = artifactTypes;
- }
-
- public Map<String, DataType> getData_types() {
- return data_types;
- }
-
- public void setData_types(Map<String, DataType> dataTypes) {
- this.data_types = dataTypes;
- }
-
- public Map<String, CapabilityType> getCapability_types() {
- return capability_types;
- }
-
- public void setCapability_types(Map<String, CapabilityType> capabilityTypes) {
- this.capability_types = capabilityTypes;
- }
-
- public Map<String, RelationshipType> getRelationship_types() {
- return relationship_types;
- }
-
- public void setRelationship_types(Map<String, RelationshipType> relationshipTypes) {
- this.relationship_types = relationshipTypes;
- }
-
- public Map<String, NodeType> getNode_types() {
- return node_types;
- }
-
- public void setNode_types(Map<String, NodeType> nodeTypes) {
- this.node_types = nodeTypes;
- }
-
- public Map<String, GroupType> getGroup_types() {
- return group_types;
- }
-
- public void setGroup_types(Map<String, GroupType> groupTypes) {
- this.group_types = groupTypes;
- }
-
- public Map<String, Object> getInterface_types() {
- return interface_types;
- }
-
- public void setInterface_types(Map<String, Object> interfaceTypes) {
- this.interface_types = interfaceTypes;
- }
-
public Map<String, InterfaceType> getNormalizeInterfaceTypes() {
if (MapUtils.isEmpty(interface_types)) {
return new HashMap<>();
@@ -174,27 +84,4 @@ public class ServiceTemplate implements Template {
this.interface_types.put(interfaceKey, toscaInterfaceObj.get());
}
- public Map<String, PolicyType> getPolicy_types() {
- return policy_types;
- }
-
- public void setPolicy_types(Map<String, PolicyType> policyTypes) {
- this.policy_types = policyTypes;
- }
-
- public TopologyTemplate getTopology_template() {
- return topology_template;
- }
-
- public void setTopology_template(TopologyTemplate topologyTemplate) {
- this.topology_template = topologyTemplate;
- }
-
- public Map<String, AnnotationType> getAnnotation_types() {
- return annotation_types;
- }
-
- public void setAnnotation_types(Map<String, AnnotationType> annotationTypes) {
- this.annotation_types = annotationTypes;
- }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
index b0e5e3eaa9..5b1365c992 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
@@ -23,7 +23,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+@Getter
+@Setter
+@NoArgsConstructor
public class TopologyTemplate {
private String description;
@@ -36,46 +42,6 @@ public class TopologyTemplate {
private Map<String, PolicyDefinition> policies;
private List<WorkflowDefinition> workflows;
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, ParameterDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, ParameterDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, NodeTemplate> getNode_templates() {
- return node_templates;
- }
-
- public void setNode_templates(Map<String, NodeTemplate> node_templates) {
- this.node_templates = node_templates;
- }
-
- public Map<String, RelationshipTemplate> getRelationship_templates() {
- return relationship_templates;
- }
-
- public void setRelationship_templates(Map<String, RelationshipTemplate> relationship_templates) {
- this.relationship_templates = relationship_templates;
- }
-
- public Map<String, GroupDefinition> getGroups() {
- return groups;
- }
-
- public void setGroups(Map<String, GroupDefinition> groups) {
- this.groups = groups;
- }
-
/**
* Add group.
*
@@ -89,35 +55,4 @@ public class TopologyTemplate {
this.groups.put(groupKey, groupDefinition);
}
- public Map<String, ParameterDefinition> getOutputs() {
- return outputs;
- }
-
- public void setOutputs(Map<String, ParameterDefinition> outputs) {
- this.outputs = outputs;
- }
-
- public SubstitutionMapping getSubstitution_mappings() {
- return substitution_mappings;
- }
-
- public void setSubstitution_mappings(SubstitutionMapping substitution_mappings) {
- this.substitution_mappings = substitution_mappings;
- }
-
- public Map<String, PolicyDefinition> getPolicies() {
- return policies;
- }
-
- public void setPolicies(Map<String, PolicyDefinition> policies) {
- this.policies = policies;
- }
-
- public List<WorkflowDefinition> getWorkflows() {
- return workflows;
- }
-
- public void setWorkflows(List<WorkflowDefinition> workflows) {
- this.workflows = workflows;
- }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
index be1d1d9a7c..09bf699111 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
@@ -15,34 +15,17 @@
*/
package org.onap.sdc.tosca.datatypes.model.extension;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.onap.sdc.tosca.datatypes.model.NodeFilter;
+@Getter
+@Setter
+@NoArgsConstructor
+@EqualsAndHashCode
public class ServiceFilter extends NodeFilter {
private Object tosca_id;
-
- public Object getTosca_id() {
- return tosca_id;
- }
-
- public void setTosca_id(Object toscaId) {
- this.tosca_id = toscaId;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof ServiceFilter)) {
- return false;
- }
- ServiceFilter that = (ServiceFilter) o;
- return getTosca_id() != null ? getTosca_id().equals(that.getTosca_id()) : that.getTosca_id() == null;
- }
-
- @Override
- public int hashCode() {
- return getTosca_id() != null ? getTosca_id().hashCode() : 0;
- }
}
diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java
index 93ec20dc5a..c3d39a4ea2 100644
--- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java
+++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java
@@ -20,26 +20,37 @@
package org.onap.sdc.tosca.datatypes.model;
-import org.junit.Test;
import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+
+class ImplementationTest {
-public class ImplementationTest {
@Test
- public void shouldHaveValidGettersAndSetters() {
+ void shouldHaveValidGettersAndSetters() {
assertThat(Implementation.class, hasValidGettersAndSetters());
}
@Test
- public void shouldHaveValidEquals() {
+ void shouldHaveValidEquals() {
assertThat(Implementation.class, hasValidBeanEquals());
}
@Test
- public void shouldHaveValidHashCode() {
+ void shouldHaveValidHashCode() {
assertThat(Implementation.class, hasValidBeanHashCode());
}
-} \ No newline at end of file
+
+ @Test
+ void cloneTest() {
+ final Implementation clone = new Implementation().clone();
+ assertNotNull(clone);
+ assertTrue(clone instanceof Implementation);
+ }
+}
diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinitionTest.java
new file mode 100644
index 0000000000..d33f6eeabb
--- /dev/null
+++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinitionTest.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
+
+package org.onap.sdc.tosca.datatypes.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+import org.onap.sdc.tosca.services.YamlUtil;
+
+/**
+ * @author shiria
+ * @since September 07, 2016.
+ */
+public class RequirementDefinitionTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(RequirementDefinition.class, hasValidGettersAndSetters());
+ }
+
+ @Test
+ public void cloneTest() {
+ RequirementDefinition reqDef1 = new RequirementDefinition();
+ reqDef1.setNode("node1");
+ reqDef1.setRelationship("my Relationship");
+ reqDef1.setCapability("capabilities");
+ reqDef1.setOccurrences(new Object[]{1, 1});
+
+ RequirementDefinition reqDef2 = reqDef1.clone();
+ NodeType nodeType = new NodeType();
+
+ List<Map<String, RequirementDefinition>> requirements = new ArrayList<>();
+ Map<String, RequirementDefinition> reqMap1 = new HashMap<>();
+ reqMap1.put("req1", reqDef1);
+ requirements.add(reqMap1);
+ Map<String, RequirementDefinition> reqMap2 = new HashMap<>();
+ reqMap2.put("req2", reqDef2);
+ requirements.add(reqMap2);
+ nodeType.setRequirements(requirements);
+
+ String yamlString = new YamlUtil().objectToYaml(nodeType);
+ Boolean passResult = !yamlString.contains("&") && !yamlString.contains("*");
+ assertEquals(true, passResult);
+ }
+
+}
diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java
index 70f93649ab..b44435c9ea 100644
--- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java
+++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java
@@ -18,58 +18,63 @@
package org.onap.sdc.tosca.datatypes.model;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.IOException;
-
import java.io.InputStream;
import java.util.Map;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class ServiceTemplateTest {
+class ServiceTemplateTest {
private static final String INTERFACE_NO_OPER = "amdocs.interfaces.interfaceNoOper";
private static final String LIFECYCLE_STANDARD = "tosca.interfaces.node.lifecycle.Standard";
private static final String INTERFACE_WITH_OPER = "amdocs.interfaces.interfaceWithOper";
- public static final String NORMALIZE_INTERFACE_TYPE = "/mock/serviceTemplate/normalizeInterfaceType.yaml";
- public static final String NEW_OPER_1 = "newOper1";
- public static final String NEW_OPER_2 = "newOper2";
+ private static final String NORMALIZE_INTERFACE_TYPE = "/mock/serviceTemplate/normalizeInterfaceType.yaml";
+ private static final String NEW_OPER_1 = "newOper1";
+ private static final String NEW_OPER_2 = "newOper2";
@Test
- public void getNormalizeInterfaceTypesTest() throws IOException {
- ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
- try (InputStream yamlFile = toscaExtensionYamlUtil
- .loadYamlFileIs(NORMALIZE_INTERFACE_TYPE)) {
+ void getNormalizeInterfaceTypesTest() throws IOException {
+ final ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ try (final InputStream yamlFile = toscaExtensionYamlUtil.loadYamlFileIs(NORMALIZE_INTERFACE_TYPE)) {
- ServiceTemplate serviceTemplateFromYaml =
- toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+ ServiceTemplate serviceTemplateFromYaml = toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
Map<String, InterfaceType> normalizeInterfaceTypes = serviceTemplateFromYaml.getNormalizeInterfaceTypes();
- Assert.assertNotNull(normalizeInterfaceTypes);
+ assertNotNull(normalizeInterfaceTypes);
InterfaceType interfaceNoOper = normalizeInterfaceTypes.get(INTERFACE_NO_OPER);
- Assert.assertNotNull(interfaceNoOper);
- Assert.assertEquals(LIFECYCLE_STANDARD, interfaceNoOper.getDerived_from());
- Assert.assertNull(interfaceNoOper.getOperations());
+ assertNotNull(interfaceNoOper);
+ assertEquals(LIFECYCLE_STANDARD, interfaceNoOper.getDerived_from());
+ assertNull(interfaceNoOper.getOperations());
InterfaceType interfaceWithOper = normalizeInterfaceTypes.get(INTERFACE_WITH_OPER);
- Assert.assertNotNull(interfaceWithOper);
- Assert.assertEquals(LIFECYCLE_STANDARD, interfaceWithOper.getDerived_from());
- Assert.assertNotNull(interfaceWithOper.getOperations());
- Assert.assertEquals(2, interfaceWithOper.getOperations().size());
- Assert.assertNull(interfaceWithOper.getOperations().get(NEW_OPER_1));
- Assert.assertNotNull(interfaceWithOper.getOperations().get(NEW_OPER_2));
- Assert.assertNotNull(interfaceWithOper.getOperations().get(NEW_OPER_2).getDescription());
+ assertNotNull(interfaceWithOper);
+ assertEquals(LIFECYCLE_STANDARD, interfaceWithOper.getDerived_from());
+ assertNotNull(interfaceWithOper.getOperations());
+ assertEquals(2, interfaceWithOper.getOperations().size());
+ assertNull(interfaceWithOper.getOperations().get(NEW_OPER_1));
+ assertNotNull(interfaceWithOper.getOperations().get(NEW_OPER_2));
+ assertNotNull(interfaceWithOper.getOperations().get(NEW_OPER_2).getDescription());
}
+ }
+ @Test
+ void shouldHaveValidGettersAndSetters() {
+ assertThat(ServiceTemplate.class, hasValidGettersAndSettersExcluding("imports", "normalizeInterfaceTypes"));
}
@Test
- public void shouldHaveValidGettersAndSetters() {
- assertThat(ServiceTemplate.class,
- hasValidGettersAndSettersExcluding("imports", "normalizeInterfaceTypes"));
+ void addInterfaceTypeTest() {
+ final ServiceTemplate serviceTemplateFromYaml = new ServiceTemplate();
+ serviceTemplateFromYaml.addInterfaceType("mock", new InterfaceType());
+ assertEquals(1, serviceTemplateFromYaml.getInterface_types().size());
+ serviceTemplateFromYaml.addInterfaceType("mock", new InterfaceType());
+ assertEquals(1, serviceTemplateFromYaml.getInterface_types().size());
}
}