Increase test coverage
Change-Id: I90606d768c55ad13aa9df62bc4d3f533206db1bc
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-2833
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java
index d29f23e..ebd3e21 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java
@@ -469,7 +469,7 @@
throw new ByResponseFormatComponentException(componentUtils.getResponseFormatByResource(componentUtils.convertFromStorageResponse(status), resource));
}
result = ModelConverter.convertFromToscaElement(certifyResourceRes.left().value());
- resource.setMetadataDefinition(result.getComponentMetadataDefinition());
+ resource.setComponentMetadataDefinition(result.getComponentMetadataDefinition());
} finally {
log.info("unlock component {}", resource.getUniqueId());
if (!inTransaction) {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
index 4408b3c..84efb81 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
@@ -43,7 +43,6 @@
import mockit.Deencapsulation;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.assertj.core.util.Lists;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -1183,7 +1182,7 @@
service.setLastUpdaterUserId(oldServiceLastUpdatedUserId);
resource.setLifecycleState(oldResourceLifeCycle);
- assertThat(result.isLeft());
+ assertThat(result.isLeft()).isFalse();
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java
index 13bc009..f54b85f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java
@@ -92,7 +92,7 @@
public void addInterfaceTypeElementToResource() {
Component component = new Resource();
component.setNormalizedName("normalizedComponentName");
- component.setMetadataDefinition(new ServiceMetadataDefinition());
+ component.setComponentMetadataDefinition(new ServiceMetadataDefinition());
component.getComponentMetadataDefinition().getMetadataDataDefinition().setName("NodeTypeName");
component.getComponentMetadataDefinition().getMetadataDataDefinition().setSystemName("NodeTypeName");
InterfaceDefinition addedInterface = new InterfaceDefinition();
@@ -118,7 +118,7 @@
public void addInterfaceTypeElementToService() {
Component component = new Service();
component.setNormalizedName("normalizedServiceComponentName");
- component.setMetadataDefinition(new ServiceMetadataDefinition());
+ component.setComponentMetadataDefinition(new ServiceMetadataDefinition());
component.getComponentMetadataDefinition().getMetadataDataDefinition().setName("NodeTypeName");
component.getComponentMetadataDefinition().getMetadataDataDefinition().setSystemName("NodeTypeName");
InterfaceDefinition addedInterface = new InterfaceDefinition();
@@ -523,7 +523,7 @@
@Test
public void testAddInterfaceTypeElementGetCorrectLocalInterfaceName() {
Service service = new Service();
- service.setMetadataDefinition(new ServiceMetadataDefinition());
+ service.setComponentMetadataDefinition(new ServiceMetadataDefinition());
service.getComponentMetadataDefinition().getMetadataDataDefinition().setName("LocalInterface");
service.getComponentMetadataDefinition().getMetadataDataDefinition().setSystemName("LocalInterface");
service.setInterfaces(Collections.singletonMap("Local", new InterfaceDefinition("Local", null, new HashMap<>())));
@@ -538,7 +538,7 @@
@Test
public void testAddInterfaceTypeElementNoTypeChangeIfNotLocal() {
Service service = new Service();
- service.setMetadataDefinition(new ServiceMetadataDefinition());
+ service.setComponentMetadataDefinition(new ServiceMetadataDefinition());
service.getComponentMetadataDefinition().getMetadataDataDefinition().setName("LocalInterface");
service.setInterfaces(Collections.singletonMap("NotLocal", new InterfaceDefinition("NotLocal", null,
new HashMap<>())));
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
index 3cea34f..38f2f36 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
@@ -36,6 +36,9 @@
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.utils.MapUtil;
@@ -52,146 +55,64 @@
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.openecomp.sdc.common.log.api.ILogConfiguration;
+@Getter
+@Setter
+@EqualsAndHashCode
public abstract class Component implements PropertiesOwner {
- private ComponentMetadataDefinition componentMetadataDefinition;
- private Map<String, ArtifactDefinition> artifacts;
- private Map<String, ArtifactDefinition> deploymentArtifacts;
- private Map<String, ArtifactDefinition> toscaArtifacts;
- private List<CategoryDefinition> categories;
- private List<ComponentInstance> componentInstances;
- private List<RequirementCapabilityRelDef> componentInstancesRelations;
- private Map<String, List<ComponentInstanceInput>> componentInstancesInputs;
- private Map<String, List<ComponentInstanceProperty>> componentInstancesProperties;
- private Map<String, List<ComponentInstanceProperty>> componentInstancesAttributes;
- private Map<String, List<CapabilityDefinition>> capabilities;
- private Map<String, List<RequirementDefinition>> requirements;
- private Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces;
- private List<InputDefinition> inputs;
- private List<GroupDefinition> groups;
- private Map<String, PolicyDefinition> policies;
- private String derivedFromGenericType;
- private String derivedFromGenericVersion;
- private String toscaType;
- protected List<AdditionalInformationDefinition> additionalInformation;
- private Map<String, CINodeFilterDataDefinition> nodeFilterComponents;
- private Map<String, List<UploadNodeFilterInfo>> nodeFilters;
- private Map<String, List<UploadNodeFilterInfo>> serviceFilters;
- protected List<PropertyDefinition> properties;
- private Map<String, InterfaceDefinition> interfaces;
+ protected List<AdditionalInformationDefinition> additionalInformation;
+ protected List<PropertyDefinition> properties;
+ private ComponentMetadataDefinition componentMetadataDefinition;
+ private Map<String, ArtifactDefinition> artifacts;
+ private Map<String, ArtifactDefinition> deploymentArtifacts;
+ private Map<String, ArtifactDefinition> toscaArtifacts;
+ private List<CategoryDefinition> categories;
+ private List<ComponentInstance> componentInstances;
+ private List<RequirementCapabilityRelDef> componentInstancesRelations;
+ private Map<String, List<ComponentInstanceInput>> componentInstancesInputs;
+ private Map<String, List<ComponentInstanceProperty>> componentInstancesProperties;
+ private Map<String, List<ComponentInstanceProperty>> componentInstancesAttributes;
+ private Map<String, List<CapabilityDefinition>> capabilities;
+ private Map<String, List<RequirementDefinition>> requirements;
+ private Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces;
+ private List<InputDefinition> inputs;
+ private List<GroupDefinition> groups;
+ private Map<String, PolicyDefinition> policies;
+ private String derivedFromGenericType;
+ private String derivedFromGenericVersion;
+ private String toscaType;
+ private Map<String, CINodeFilterDataDefinition> nodeFilterComponents;
+ private Map<String, List<UploadNodeFilterInfo>> nodeFilters;
+ private Map<String, List<UploadNodeFilterInfo>> serviceFilters;
+ private Map<String, InterfaceDefinition> interfaces;
private List<DataTypeDefinition> dataTypes;
- public List<DataTypeDefinition> getDataTypes() {
- return dataTypes;
- }
-
- public void setDataTypes(List<DataTypeDefinition> dataTypes) {
- this.dataTypes = dataTypes;
- }
-
- public Map<String, InterfaceDefinition> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
- this.interfaces = interfaces;
- }
-
public Component(ComponentMetadataDefinition componentMetadataDefinition) {
this.componentMetadataDefinition = componentMetadataDefinition;
}
- public String getDerivedFromGenericVersion() {
- return derivedFromGenericVersion;
- }
-
- public void setDerivedFromGenericVersion(String derivedFromGenericVersion) {
- this.derivedFromGenericVersion = derivedFromGenericVersion;
- }
-
- public String getDerivedFromGenericType() {
- return derivedFromGenericType;
- }
-
- public void setDerivedFromGenericType(String derivedFromGenericType) {
- this.derivedFromGenericType = derivedFromGenericType;
- }
-
-
@JsonIgnore
public ComponentMetadataDefinition getComponentMetadataDefinition() {
return componentMetadataDefinition;
}
- public Map<String, ArtifactDefinition> getArtifacts() {
- return artifacts;
+ @Override
+ public String getUniqueId() {
+ return componentMetadataDefinition.getMetadataDataDefinition().getUniqueId();
}
- public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
- this.artifacts = artifacts;
- }
-
- public Map<String, ArtifactDefinition> getToscaArtifacts() {
- return toscaArtifacts;
- }
-
- public void setToscaArtifacts(Map<String, ArtifactDefinition> toscaArtifacts) {
- this.toscaArtifacts = toscaArtifacts;
- }
-
- @Override
- public String getUniqueId() {
- return componentMetadataDefinition.getMetadataDataDefinition().getUniqueId();
- }
-
public void setUniqueId(String uniqueId) {
componentMetadataDefinition.getMetadataDataDefinition().setUniqueId(uniqueId);
}
- public void setName(String name) {
- componentMetadataDefinition.getMetadataDataDefinition().setName(name);
- }
-
- public void setVersion(String version) {
- componentMetadataDefinition.getMetadataDataDefinition().setVersion(version);
- }
-
public void setHighestVersion(Boolean isHighestVersion) {
componentMetadataDefinition.getMetadataDataDefinition().setHighestVersion(isHighestVersion);
}
- public void setCreationDate(Long creationDate) {
- componentMetadataDefinition.getMetadataDataDefinition().setCreationDate(creationDate);
- }
-
- public void setLastUpdateDate(Long lastUpdateDate) {
- componentMetadataDefinition.getMetadataDataDefinition().setLastUpdateDate(lastUpdateDate);
- }
-
- public void setDescription(String description) {
- componentMetadataDefinition.getMetadataDataDefinition().setDescription(description);
- }
-
public void setState(LifecycleStateEnum state) {
componentMetadataDefinition.getMetadataDataDefinition().setState(state.name());
}
- public void setTags(List<String> tags) {
- componentMetadataDefinition.getMetadataDataDefinition().setTags(tags);
- }
-
- public void setConformanceLevel(String conformanceLevel) {
- componentMetadataDefinition.getMetadataDataDefinition().setConformanceLevel(conformanceLevel);
- }
-
- public void setIcon(String icon) {
- componentMetadataDefinition.getMetadataDataDefinition().setIcon(icon);
- }
-
- public void setContactId(String contactId) {
- componentMetadataDefinition.getMetadataDataDefinition().setContactId(contactId);
- }
-
public String getCreatorUserId() {
return this.componentMetadataDefinition.getMetadataDataDefinition().getCreatorUserId();
}
@@ -224,15 +145,23 @@
this.componentMetadataDefinition.getMetadataDataDefinition().setLastUpdaterFullName(lastUpdaterFullName);
}
- @Override
- public String getName() {
- return componentMetadataDefinition.getMetadataDataDefinition().getName();
- }
+ @Override
+ public String getName() {
+ return componentMetadataDefinition.getMetadataDataDefinition().getName();
+ }
+
+ public void setName(String name) {
+ componentMetadataDefinition.getMetadataDataDefinition().setName(name);
+ }
public String getVersion() {
return componentMetadataDefinition.getMetadataDataDefinition().getVersion();
}
+ public void setVersion(String version) {
+ componentMetadataDefinition.getMetadataDataDefinition().setVersion(version);
+ }
+
public Boolean isHighestVersion() {
return componentMetadataDefinition.getMetadataDataDefinition().isHighestVersion();
}
@@ -241,57 +170,76 @@
return componentMetadataDefinition.getMetadataDataDefinition().getCreationDate();
}
+ public void setCreationDate(Long creationDate) {
+ componentMetadataDefinition.getMetadataDataDefinition().setCreationDate(creationDate);
+ }
+
public Long getLastUpdateDate() {
return componentMetadataDefinition.getMetadataDataDefinition().getLastUpdateDate();
}
+ public void setLastUpdateDate(Long lastUpdateDate) {
+ componentMetadataDefinition.getMetadataDataDefinition().setLastUpdateDate(lastUpdateDate);
+ }
+
public String getDescription() {
return componentMetadataDefinition.getMetadataDataDefinition().getDescription();
}
+ public void setDescription(String description) {
+ componentMetadataDefinition.getMetadataDataDefinition().setDescription(description);
+ }
+
public LifecycleStateEnum getLifecycleState() {
if (componentMetadataDefinition.getMetadataDataDefinition().getState() != null) {
return LifecycleStateEnum.valueOf(componentMetadataDefinition.getMetadataDataDefinition().getState());
- }
- else {
+ } else {
return null;
}
}
+ public void setLifecycleState(LifecycleStateEnum state) {
+ if (state != null) {
+ this.componentMetadataDefinition.getMetadataDataDefinition().setState(state.name());
+ }
+ }
+
public List<String> getTags() {
return componentMetadataDefinition.getMetadataDataDefinition().getTags();
}
+ public void setTags(List<String> tags) {
+ componentMetadataDefinition.getMetadataDataDefinition().setTags(tags);
+ }
+
public String getConformanceLevel() {
return componentMetadataDefinition.getMetadataDataDefinition().getConformanceLevel();
}
+ public void setConformanceLevel(String conformanceLevel) {
+ componentMetadataDefinition.getMetadataDataDefinition().setConformanceLevel(conformanceLevel);
+ }
+
public String getIcon() {
return componentMetadataDefinition.getMetadataDataDefinition().getIcon();
}
+ public void setIcon(String icon) {
+ componentMetadataDefinition.getMetadataDataDefinition().setIcon(icon);
+ }
+
public String getContactId() {
return componentMetadataDefinition.getMetadataDataDefinition().getContactId();
}
- public List<InputDefinition> getInputs() {
- return inputs;
+ public void setContactId(String contactId) {
+ componentMetadataDefinition.getMetadataDataDefinition().setContactId(contactId);
}
public List<InputDefinition> safeGetInputs() {
return inputs == null ? new ArrayList<>() : inputs;
}
- public void setInputs(List<InputDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public void setLifecycleState(LifecycleStateEnum state) {
- if (state != null) {
- this.componentMetadataDefinition.getMetadataDataDefinition().setState(state.name());
- }
- }
-
public String getUUID() {
return componentMetadataDefinition.getMetadataDataDefinition().getUUID();
}
@@ -300,28 +248,20 @@
componentMetadataDefinition.getMetadataDataDefinition().setUUID(uUID);
}
- public void setSystemName(String systemName) {
- componentMetadataDefinition.getMetadataDataDefinition().setSystemName(systemName);
- }
-
public String getSystemName() {
return componentMetadataDefinition.getMetadataDataDefinition().getSystemName();
}
- public void setAllVersions(Map<String, String> allVersions) {
- componentMetadataDefinition.getMetadataDataDefinition().setAllVersions(allVersions);
+ public void setSystemName(String systemName) {
+ componentMetadataDefinition.getMetadataDataDefinition().setSystemName(systemName);
}
public Map<String, String> getAllVersions() {
return componentMetadataDefinition.getMetadataDataDefinition().getAllVersions();
}
- public Map<String, ArtifactDefinition> getDeploymentArtifacts() {
- return deploymentArtifacts;
- }
-
- public void setDeploymentArtifacts(Map<String, ArtifactDefinition> deploymentArtifacts) {
- this.deploymentArtifacts = deploymentArtifacts;
+ public void setAllVersions(Map<String, String> allVersions) {
+ componentMetadataDefinition.getMetadataDataDefinition().setAllVersions(allVersions);
}
public Map<String, ArtifactDefinition> getAllArtifacts() {
@@ -331,27 +271,11 @@
return allArtifacts;
}
- Optional<ArtifactDefinition> getArtifact(String id) {
- HashMap<String, ArtifactDefinition> allArtifacts = new HashMap<>();
- allArtifacts.putAll(Optional.ofNullable(this.artifacts).orElse(emptyMap()));
- allArtifacts.putAll(Optional.ofNullable(this.deploymentArtifacts).orElse(emptyMap()));
- allArtifacts.putAll(Optional.ofNullable(this.toscaArtifacts).orElse(emptyMap()));
- return Optional.ofNullable(allArtifacts.get(id));
+ @Override
+ public String getNormalizedName() {
+ return componentMetadataDefinition.getMetadataDataDefinition().getNormalizedName();
}
- public List<CategoryDefinition> getCategories() {
- return categories;
- }
-
- public void setCategories(List<CategoryDefinition> categories) {
- this.categories = categories;
- }
-
- @Override
- public String getNormalizedName() {
- return componentMetadataDefinition.getMetadataDataDefinition().getNormalizedName();
- }
-
public void setNormalizedName(String normalizedName) {
componentMetadataDefinition.getMetadataDataDefinition().setNormalizedName(normalizedName);
}
@@ -371,28 +295,12 @@
return capabilities;
}
- public void setCapabilities(Map<String, List<CapabilityDefinition>> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, List<RequirementDefinition>> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(Map<String, List<RequirementDefinition>> requirements) {
- this.requirements = requirements;
- }
-
- public List<ComponentInstance> getComponentInstances() {
- return componentInstances;
- }
-
public List<ComponentInstance> safeGetComponentInstances() {
- if(componentInstances != null) {
- return componentInstances;
- }else {
- return emptyList();
- }
+ if (componentInstances != null) {
+ return componentInstances;
+ } else {
+ return emptyList();
+ }
}
public Optional<ComponentInstance> fetchInstanceById(String instanceId) {
@@ -401,38 +309,31 @@
public Map<String, ArtifactDefinition> safeGetComponentInstanceDeploymentArtifacts(String componentInstanceId) {
return getComponentInstanceById(componentInstanceId).map(ComponentInstance::safeGetDeploymentArtifacts)
- .orElse(emptyMap());
+ .orElse(emptyMap());
}
public Map<String, ArtifactDefinition> safeGetComponentInstanceInformationalArtifacts(String componentInstanceId) {
return getComponentInstanceById(componentInstanceId).map(ComponentInstance::safeGetInformationalArtifacts)
- .orElse(emptyMap());
+ .orElse(emptyMap());
}
public List<ArtifactDefinition> safeGetComponentInstanceHeatArtifacts(String componentInstanceId) {
return safeGetComponentInstanceDeploymentArtifacts(componentInstanceId)
- .values()
- .stream()
- .filter(artifact -> ArtifactTypeEnum.HEAT_ENV.name().equals(artifact.getArtifactType()))
- .collect(Collectors.toList());
- }
-
- public void setComponentInstances(List<ComponentInstance> resourceInstances) {
- this.componentInstances = resourceInstances;
- }
-
- public List<RequirementCapabilityRelDef> getComponentInstancesRelations() {
- return componentInstancesRelations;
- }
-
- public void setComponentInstancesRelations(List<RequirementCapabilityRelDef> resourceInstancesRelations) {
- this.componentInstancesRelations = resourceInstancesRelations;
+ .values()
+ .stream()
+ .filter(artifact -> ArtifactTypeEnum.HEAT_ENV.name().equals(artifact.getArtifactType()))
+ .collect(Collectors.toList());
}
public Map<String, List<ComponentInstanceProperty>> getComponentInstancesProperties() {
return componentInstancesProperties;
}
+ public void setComponentInstancesProperties(
+ Map<String, List<ComponentInstanceProperty>> resourceInstancesProperties) {
+ this.componentInstancesProperties = resourceInstancesProperties;
+ }
+
public Map<String, List<ComponentInstanceProperty>> safeGetComponentInstancesProperties() {
return componentInstancesProperties == null ? emptyMap() : componentInstancesProperties;
}
@@ -441,14 +342,14 @@
return componentInstancesProperties == null ? emptyMap() : findUiComponentInstancesProperties();
}
- private Map<String,List<ComponentInstanceProperty>> findUiComponentInstancesProperties() {
+ private Map<String, List<ComponentInstanceProperty>> findUiComponentInstancesProperties() {
List<String> instancesFromUi = componentInstances.stream()
- .filter(i->!i.isCreatedFromCsar())
- .map(ComponentInstance::getUniqueId)
- .collect(Collectors.toList());
+ .filter(i -> !i.isCreatedFromCsar())
+ .map(ComponentInstance::getUniqueId)
+ .collect(Collectors.toList());
return componentInstancesProperties.entrySet().stream()
- .filter(e -> instancesFromUi.contains(e.getKey()))
- .collect(Collectors.toMap(e->e.getKey(), e->e.getValue()));
+ .filter(e -> instancesFromUi.contains(e.getKey()))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
public Map<String, List<ComponentInstanceInput>> safeGetComponentInstancesInputs() {
@@ -459,14 +360,14 @@
return componentInstancesInputs == null ? emptyMap() : findUiComponentInstancesInputs();
}
- private Map<String,List<ComponentInstanceInput>> findUiComponentInstancesInputs() {
+ private Map<String, List<ComponentInstanceInput>> findUiComponentInstancesInputs() {
List<String> instancesFromUi = componentInstances.stream()
- .filter(i->!i.isCreatedFromCsar())
- .map(ComponentInstance::getUniqueId)
- .collect(Collectors.toList());
+ .filter(i -> !i.isCreatedFromCsar())
+ .map(ComponentInstance::getUniqueId)
+ .collect(Collectors.toList());
return componentInstancesInputs.entrySet().stream()
- .filter(e -> instancesFromUi.contains(e.getKey()))
- .collect(Collectors.toMap(e->e.getKey(), e->e.getValue()));
+ .filter(e -> instancesFromUi.contains(e.getKey()))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
public List<ComponentInstanceProperty> safeGetComponentInstanceProperties(String cmptInstacneId) {
@@ -477,14 +378,9 @@
return this.safeGetComponentInstanceEntity(comptInstanceId, this.componentInstancesInputs);
}
- public List<ComponentInstanceInterface> safeGetComponentInstanceInterfaces(String cmptInstacneId) {
- return this.safeGetComponentInstanceEntity(cmptInstacneId, this.componentInstancesInterfaces);
- }
-
- public void setComponentInstancesProperties(
- Map<String, List<ComponentInstanceProperty>> resourceInstancesProperties) {
- this.componentInstancesProperties = resourceInstancesProperties;
- }
+ public List<ComponentInstanceInterface> safeGetComponentInstanceInterfaces(String cmptInstacneId) {
+ return this.safeGetComponentInstanceEntity(cmptInstacneId, this.componentInstancesInterfaces);
+ }
public Boolean getIsDeleted() {
return componentMetadataDefinition.getMetadataDataDefinition().isDeleted();
@@ -549,10 +445,6 @@
return componentInstances.stream().filter(predicate).findFirst();
}
- public List<GroupDefinition> getGroups() {
- return groups;
- }
-
public List<GroupDefinition> safeGetGroups() {
return groups == null ? emptyList() : groups;
}
@@ -574,259 +466,32 @@
return Optional.empty();
}
return groups.stream()
- .filter(predicate)
- .findAny();
+ .filter(predicate)
+ .findAny();
}
- public Map<String, List<ComponentInstanceInterface>> getComponentInstancesInterfaces() {
- return componentInstancesInterfaces;
- }
-
- public void setComponentInstancesInterfaces(Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces) {
- this.componentInstancesInterfaces = componentInstancesInterfaces;
- }
-
- public void setGroups(List<GroupDefinition> groups) {
- this.groups = groups;
- }
-
- public void addGroups(List<GroupDefinition> groupsToAdd) {
- if (groups == null) {
- groups = new ArrayList<>();
- }
- groups.addAll(groupsToAdd);
- }
-
- public Map<String, PolicyDefinition> getPolicies() {
- return policies;
- }
-
- public void setPolicies(Map<String, PolicyDefinition> policies) {
- this.policies = policies;
+ public void addGroups(List<GroupDefinition> groupsToAdd) {
+ if (groups == null) {
+ groups = new ArrayList<>();
+ }
+ groups.addAll(groupsToAdd);
}
public void addPolicy(PolicyDefinition policyDefinition) {
- if(MapUtils.isEmpty(this.policies)) {
- this.policies = new HashMap<>();
+ if (MapUtils.isEmpty(this.policies)) {
+ this.policies = new HashMap<>();
}
this.policies.put(policyDefinition.getUniqueId(), policyDefinition);
}
- public Map<String, CINodeFilterDataDefinition> getNodeFilterComponents() {
- return nodeFilterComponents;
- }
-
- public void setNodeFilterComponents(Map<String, CINodeFilterDataDefinition> nodeFilter) {
- this.nodeFilterComponents = nodeFilter;
- }
-
-
-
- public Map<String, List<UploadNodeFilterInfo>> getNodeFilters() {
- return nodeFilters;
- }
-
- public void setNodeFilters(
- Map<String, List<UploadNodeFilterInfo>> nodeFilters) {
- this.nodeFilters = nodeFilters;
- }
-
- public Map<String, List<UploadNodeFilterInfo>> getServiceFilters() {
- return serviceFilters;
- }
-
- public void setServiceFilters(
- Map<String, List<UploadNodeFilterInfo>> serviceFilters) {
- this.serviceFilters = serviceFilters;
- }
-
- public List<PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(List<PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public void addProperty(PropertyDefinition propertyDefinition) {
- if(org.apache.commons.collections.CollectionUtils.isEmpty(this.properties)) {
- this.properties = new ArrayList<>();
+ public void addProperty(PropertyDefinition propertyDefinition) {
+ if (org.apache.commons.collections.CollectionUtils.isEmpty(this.properties)) {
+ this.properties = new ArrayList<>();
}
- this.properties.add(propertyDefinition);;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((artifacts == null) ? 0 : artifacts.hashCode());
- result = prime * result + ((categories == null) ? 0 : categories.hashCode());
- result = prime * result + ((componentMetadataDefinition == null) ? 0 : componentMetadataDefinition.hashCode());
- result = prime * result + ((deploymentArtifacts == null) ? 0 : deploymentArtifacts.hashCode());
- result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode());
- result = prime * result + ((requirements == null) ? 0 : requirements.hashCode());
- result = prime * result + ((componentInstances == null) ? 0 : componentInstances.hashCode());
- result = prime * result
- + ((componentInstancesProperties == null) ? 0 : componentInstancesProperties.hashCode());
- result = prime * result
- + ((componentInstancesAttributes == null) ? 0 : componentInstancesAttributes.hashCode());
- result = prime * result + ((componentInstancesInputs == null) ? 0 : componentInstancesInputs.hashCode());
- result = prime * result + ((componentInstancesRelations == null) ? 0 : componentInstancesRelations.hashCode());
- result = prime * result + ((groups == null) ? 0 : groups.hashCode());
- result = prime * result + ((policies == null) ? 0 : policies.hashCode());
- result = prime * result + ((derivedFromGenericType == null) ? 0 : derivedFromGenericType.hashCode());
- result = prime * result + ((derivedFromGenericVersion == null) ? 0 : derivedFromGenericVersion.hashCode());
- result = prime * result + ((interfaces == null) ? 0 : interfaces.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Component other = (Component) obj;
- if (artifacts == null) {
- if (other.artifacts != null) {
- return false;
- }
- }
- else if (!artifacts.equals(other.artifacts)) {
- return false;
- }
- if (categories == null) {
- if (other.categories != null) {
- return false;
- }
- }
- else if (!categories.equals(other.categories)) {
- return false;
- }
- if (componentMetadataDefinition == null) {
- if (other.componentMetadataDefinition != null) {
- return false;
- }
- }
- else if (!componentMetadataDefinition.equals(other.componentMetadataDefinition)) {
- return false;
- }
-
- if (deploymentArtifacts == null) {
- if (other.deploymentArtifacts != null) {
- return false;
- }
- }
- else if (!deploymentArtifacts.equals(other.deploymentArtifacts)) {
- return false;
- }
-
- if (componentInstances == null) {
- if (other.componentInstances != null) {
- return false;
- }
- }
- else if (!componentInstances.equals(other.componentInstances)) {
- return false;
- }
- if (componentInstancesProperties == null) {
- if (other.componentInstancesProperties != null) {
- return false;
- }
- }
- else if (!componentInstancesProperties.equals(other.componentInstancesProperties)) {
- return false;
- }
-
- if (!Objects.equals(componentInstancesAttributes, other.componentInstancesAttributes)) {
- return false;
- }
- if (!Objects.equals(componentInstancesInputs, other.componentInstancesInputs)) {
- return false;
- }
- if (componentInstancesRelations == null) {
- if (other.componentInstancesRelations != null) {
- return false;
- }
- }
- else if (!componentInstancesRelations.equals(other.componentInstancesRelations)) {
- return false;
- }
- if (requirements == null) {
- if (other.requirements != null) {
- return false;
- }
- }
- else if (!requirements.equals(other.requirements)) {
- return false;
- }
- if (capabilities == null) {
- if (other.capabilities != null) {
- return false;
- }
- }
- else if (!capabilities.equals(other.capabilities)) {
- return false;
- }
- if (groups == null) {
- if (other.groups != null) {
- return false;
- }
- }
- else if (!groups.equals(other.groups)) {
- return false;
- }
- if (policies == null) {
- if (other.policies != null) {
- return false;
- }
- }
- else if (!policies.equals(other.policies)) {
- return false;
- }
- if (derivedFromGenericType == null) {
- if (other.derivedFromGenericType != null) {
- return false;
- }
- }
- else if (!derivedFromGenericType.equals(other.derivedFromGenericType)) {
- return false;
- }
- if (derivedFromGenericVersion == null) {
- if (other.derivedFromGenericVersion != null) {
- return false;
- }
- }
- else if (!derivedFromGenericVersion.equals(other.derivedFromGenericVersion)) {
- return false;
- }
- if (interfaces == null) {
- if (other.interfaces != null) {
- return false;
- }
- }
- else if (!interfaces.equals(other.interfaces)) {
- return false;
- }
- if (properties == null) {
- if (other.properties != null) {
- return false;
- }
- }
- else if (!properties.equals(other.properties)) {
- return false;
- }
- else if (!nodeFilterComponents.equals(other.nodeFilterComponents)) {
- return false;
- }
- return true;
+ this.properties.add(propertyDefinition);
+ ;
}
public void addCategory(String category, String subCategory) {
@@ -903,27 +568,14 @@
}
}
- public Map<String, List<ComponentInstanceProperty>> getComponentInstancesAttributes() {
- return componentInstancesAttributes;
- }
-
- public void setComponentInstancesAttributes(
- Map<String, List<ComponentInstanceProperty>> componentInstancesAttributes) {
- this.componentInstancesAttributes = componentInstancesAttributes;
- }
-
- public Map<String, List<ComponentInstanceInput>> getComponentInstancesInputs() {
- return componentInstancesInputs;
- }
-
public Map<String, List<PropertyDataDefinition>> safeGetGroupsProperties() {
if (isEmpty(groups)) {
return emptyMap();
}
return groups.stream()
- .filter(gr -> Objects.nonNull(gr.getProperties()))
- .collect(toMap(GroupDataDefinition::getUniqueId,
- GroupDataDefinition::getProperties));
+ .filter(gr -> Objects.nonNull(gr.getProperties()))
+ .collect(toMap(GroupDataDefinition::getUniqueId,
+ GroupDataDefinition::getProperties));
}
public Map<String, List<PropertyDataDefinition>> safeGetPolicyProperties() {
@@ -931,10 +583,10 @@
return emptyMap();
}
return policies.values()
- .stream()
- .filter(policy -> Objects.nonNull(policy.getProperties()))
- .collect(toMap(PolicyDataDefinition::getUniqueId,
- PolicyDataDefinition::getProperties));
+ .stream()
+ .filter(policy -> Objects.nonNull(policy.getProperties()))
+ .collect(toMap(PolicyDataDefinition::getUniqueId,
+ PolicyDataDefinition::getProperties));
}
public List<ComponentInstanceInput> safeGetComponentInstanceInputsByName(String cmptInstanceName) {
@@ -943,11 +595,11 @@
return emptyPropsList;
}
return this.componentInstances.stream()
- .filter(ci -> ci.getName().equals(cmptInstanceName))
- .map(ComponentInstance::getUniqueId)
- .map(instanceId -> safeGetComponentInstanceEntity(instanceId, this.componentInstancesInputs))
- .findAny()
- .orElse(emptyPropsList);
+ .filter(ci -> ci.getName().equals(cmptInstanceName))
+ .map(ComponentInstance::getUniqueId)
+ .map(instanceId -> safeGetComponentInstanceEntity(instanceId, this.componentInstancesInputs))
+ .findAny()
+ .orElse(emptyPropsList);
}
private <T> List<T> safeGetComponentInstanceEntity(String cmptInstanceId, Map<String, List<T>> instanceEntities) {
@@ -959,25 +611,16 @@
return cmptInstanceProps == null ? emptyPropsList : cmptInstanceProps;
}
-
- public void setComponentInstancesInputs(Map<String, List<ComponentInstanceInput>> componentInstancesInputs) {
- this.componentInstancesInputs = componentInstancesInputs;
- }
-
public void setSpecificComponetTypeArtifacts(Map<String, ArtifactDefinition> specificComponentTypeArtifacts) {
// Implement where needed
}
- public void setMetadataDefinition(ComponentMetadataDefinition metadataDefinition) {
- this.componentMetadataDefinition = metadataDefinition;
- }
-
public String fetchGenericTypeToscaNameFromConfig() {
// Implement where needed
return ConfigurationManager.getConfigurationManager()
- .getConfiguration()
- .getGenericAssetNodeTypes()
- .get(this.assetType());
+ .getConfiguration()
+ .getGenericAssetNodeTypes()
+ .get(this.assetType());
}
public String assetType() {
@@ -1004,22 +647,6 @@
return ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue().equals(toscaType);
}
- public String getToscaType() {
- return toscaType;
- }
-
- public void setToscaType(String toscaType) {
- this.toscaType = toscaType;
- }
-
- public List<AdditionalInformationDefinition> getAdditionalInformation() {
- return additionalInformation;
- }
-
- public void setAdditionalInformation(List<AdditionalInformationDefinition> additionalInformation) {
- this.additionalInformation = additionalInformation;
- }
-
public PolicyDefinition getPolicyById(String id) {
return policies != null ? policies.get(id) : null;
}
@@ -1041,8 +668,8 @@
return emptyList();
}
return policies.values().stream()
- .filter(policyPredicate)
- .collect(Collectors.toList());
+ .filter(policyPredicate)
+ .collect(Collectors.toList());
}
public List<GroupDefinition> resolveGroupsByMember(String instanceId) {
@@ -1050,36 +677,47 @@
return emptyList();
}
return groups.stream()
- .filter(group -> group.containsInstanceAsMember(instanceId))
- .collect(Collectors.toList());
+ .filter(group -> group.containsInstanceAsMember(instanceId))
+ .collect(Collectors.toList());
}
public String getActualComponentType() {
return componentMetadataDefinition.getMetadataDataDefinition().getActualComponentType();
}
- public Boolean isArchived() { return componentMetadataDefinition.getMetadataDataDefinition().isArchived(); }
-
- public void setArchived(Boolean archived) { componentMetadataDefinition.getMetadataDataDefinition().setArchived(archived); }
-
- public Long getArchiveTime() { return componentMetadataDefinition.getMetadataDataDefinition().getArchiveTime(); }
-
- public void setArchiveTime(Long archiveTime) { componentMetadataDefinition.getMetadataDataDefinition().setArchiveTime(archiveTime); }
-
- public Boolean isVspArchived() { return componentMetadataDefinition.getMetadataDataDefinition().isVspArchived(); }
-
- public void setVspArchived(Boolean vspArchived) { componentMetadataDefinition.getMetadataDataDefinition().setVspArchived(vspArchived); }
-
- //supportability log method return map of component metadata teddy.h
- public Map<String,String> getComponentMetadataForSupportLog(){
- Map<String,String>componentMetadata=new HashMap<>();
- componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME,this.getName());
- componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION,this.getVersion());
- componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID,this.getUUID());
- componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID,this.getCsarUUID());
- componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION,this.getCsarVersion());
- return componentMetadata;
+ public Boolean isArchived() {
+ return componentMetadataDefinition.getMetadataDataDefinition().isArchived();
}
+ public void setArchived(Boolean archived) {
+ componentMetadataDefinition.getMetadataDataDefinition().setArchived(archived);
+ }
+
+ public Long getArchiveTime() {
+ return componentMetadataDefinition.getMetadataDataDefinition().getArchiveTime();
+ }
+
+ public void setArchiveTime(Long archiveTime) {
+ componentMetadataDefinition.getMetadataDataDefinition().setArchiveTime(archiveTime);
+ }
+
+ public Boolean isVspArchived() {
+ return componentMetadataDefinition.getMetadataDataDefinition().isVspArchived();
+ }
+
+ public void setVspArchived(Boolean vspArchived) {
+ componentMetadataDefinition.getMetadataDataDefinition().setVspArchived(vspArchived);
+ }
+
+ //supportability log method return map of component metadata teddy.h
+ public Map<String, String> getComponentMetadataForSupportLog() {
+ Map<String, String> componentMetadata = new HashMap<>();
+ componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_NAME, this.getName());
+ componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_VERSION, this.getVersion());
+ componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_COMPONENT_UUID, this.getUUID());
+ componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_UUID, this.getCsarUUID());
+ componentMetadata.put(ILogConfiguration.MDC_SUPPORTABLITY_CSAR_VERSION, this.getCsarVersion());
+ return componentMetadata;
+ }
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Product.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Product.java
index 66062cf..b08df77 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Product.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Product.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,11 +20,10 @@
package org.openecomp.sdc.be.model;
+import java.util.List;
import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
-import java.util.List;
-
public class Product extends Component {
public Product() {
@@ -45,10 +44,12 @@
getProductMetadataDefinition().setFullName(fullName);
}
+ @Override
public String getInvariantUUID() {
return getProductMetadataDefinition().getInvariantUUID();
}
+ @Override
public void setInvariantUUID(String invariantUUID) {
getProductMetadataDefinition().setInvariantUUID(invariantUUID);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/RequirementDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/RequirementDefinition.java
index d2400a7..acc7452 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/RequirementDefinition.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/RequirementDefinition.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,7 +27,7 @@
*/
public class RequirementDefinition extends RequirementDataDefinition {
- public RequirementDefinition(){
+ public RequirementDefinition() {
super();
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java
index e5122aa..1338fb1 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Service.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,159 +20,153 @@
package org.openecomp.sdc.be.model;
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
import java.util.HashMap;
import java.util.Map;
-
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.InstantiationTypes;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElementTypeEnum;
+@Getter
+@Setter
+@EqualsAndHashCode
public class Service extends Component {
+ private Map<String, ArtifactDefinition> serviceApiArtifacts;
+ private Map<String, ForwardingPathDataDefinition> forwardingPaths;
+
public Service() {
super(new ServiceMetadataDefinition());
this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.SERVICE);
this.setToscaType(ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue());
}
- public Service(ComponentMetadataDefinition serviceMetadataDefinition) {
- super(serviceMetadataDefinition);
- ComponentMetadataDataDefinition metadataDataDefinition = this.getComponentMetadataDefinition().getMetadataDataDefinition();
- if(metadataDataDefinition != null) {
- metadataDataDefinition.setComponentType(ComponentTypeEnum.SERVICE);
- }
- this.setToscaType(ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue());
- }
+ public Service(ComponentMetadataDefinition serviceMetadataDefinition) {
+ super(serviceMetadataDefinition);
+ ComponentMetadataDataDefinition metadataDataDefinition = this.getComponentMetadataDefinition()
+ .getMetadataDataDefinition();
+ if (metadataDataDefinition != null) {
+ metadataDataDefinition.setComponentType(ComponentTypeEnum.SERVICE);
+ }
+ this.setToscaType(ToscaElementTypeEnum.TOPOLOGY_TEMPLATE.getValue());
+ }
- private Map<String, ArtifactDefinition> serviceApiArtifacts;
- private Map<String, ForwardingPathDataDefinition> forwardingPaths;
+ @Override
+ public String getProjectCode() {
+ return getServiceMetadataDefinition().getProjectCode();
+ }
- public Map<String, ArtifactDefinition> getServiceApiArtifacts() {
- return serviceApiArtifacts;
- }
+ @Override
+ public void setProjectCode(String projectName) {
+ getServiceMetadataDefinition().setProjectCode(projectName);
+ }
- public void setServiceApiArtifacts(Map<String, ArtifactDefinition> serviceApiArtifacts) {
- this.serviceApiArtifacts = serviceApiArtifacts;
- }
+ public ForwardingPathDataDefinition addForwardingPath(ForwardingPathDataDefinition forwardingPathDataDefinition) {
+ if (forwardingPaths == null) {
+ forwardingPaths = new HashMap<>();
+ }
+ return forwardingPaths.put(forwardingPathDataDefinition.getUniqueId(), forwardingPathDataDefinition);
+ }
- public String getProjectCode() {
- return getServiceMetadataDefinition().getProjectCode();
- }
+ public DistributionStatusEnum getDistributionStatus() {
+ String distributionStatus = getServiceMetadataDefinition().getDistributionStatus();
+ if (distributionStatus != null) {
+ return DistributionStatusEnum.valueOf(distributionStatus);
+ } else {
+ return null;
+ }
+ }
- public Map<String, ForwardingPathDataDefinition> getForwardingPaths() {
- return forwardingPaths;
- }
+ public void setDistributionStatus(DistributionStatusEnum distributionStatus) {
+ if (distributionStatus != null) {
+ getServiceMetadataDefinition().setDistributionStatus(distributionStatus.name());
+ }
+ }
- public void setForwardingPaths(Map<String, ForwardingPathDataDefinition> forwardingPaths) {
- this.forwardingPaths = forwardingPaths;
- }
+ public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
+ getServiceMetadataDefinition().setEcompGeneratedNaming(ecompGeneratedNaming);
+ }
- public ForwardingPathDataDefinition addForwardingPath(ForwardingPathDataDefinition forwardingPathDataDefinition){
- if(forwardingPaths == null){
- forwardingPaths = new HashMap<>();
- }
- return forwardingPaths.put(forwardingPathDataDefinition.getUniqueId(),forwardingPathDataDefinition);
- }
+ public Boolean isEcompGeneratedNaming() {
+ return getServiceMetadataDefinition().isEcompGeneratedNaming();
+ }
- public void setProjectCode(String projectName) {
- getServiceMetadataDefinition().setProjectCode(projectName);
- }
+ public String getNamingPolicy() {
+ return getServiceMetadataDefinition().getNamingPolicy();
+ }
- public DistributionStatusEnum getDistributionStatus() {
- String distributionStatus = getServiceMetadataDefinition().getDistributionStatus();
- if (distributionStatus != null) {
- return DistributionStatusEnum.valueOf(distributionStatus);
- } else {
- return null;
- }
- }
+ public void setNamingPolicy(String namingPolicy) {
+ getServiceMetadataDefinition().setNamingPolicy(namingPolicy);
+ }
- public void setDistributionStatus(DistributionStatusEnum distributionStatus) {
- if (distributionStatus != null)
- getServiceMetadataDefinition().setDistributionStatus(distributionStatus.name());
- }
+ public String getEnvironmentContext() {
+ return getServiceMetadataDefinition().getEnvironmentContext();
+ }
- public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
- getServiceMetadataDefinition().setEcompGeneratedNaming(ecompGeneratedNaming);
- }
+ public void setEnvironmentContext(String environmentContext) {
+ getServiceMetadataDefinition().setEnvironmentContext(environmentContext);
+ }
- public Boolean isEcompGeneratedNaming() {
- return getServiceMetadataDefinition().isEcompGeneratedNaming();
- }
+ public String getServiceType() {
+ return getServiceMetadataDefinition().getServiceType();
+ }
- public void setNamingPolicy(String namingPolicy) {
- getServiceMetadataDefinition().setNamingPolicy(namingPolicy);
- }
-
- public String getNamingPolicy() {
- return getServiceMetadataDefinition().getNamingPolicy();
- }
+ public void setServiceType(String serviceType) {
+ getServiceMetadataDefinition().setServiceType(serviceType);
+ }
- public String getEnvironmentContext() { return getServiceMetadataDefinition().getEnvironmentContext(); }
+ public String getServiceRole() {
+ return getServiceMetadataDefinition().getServiceRole();
+ }
- public void setEnvironmentContext(String environmentContext) {
- getServiceMetadataDefinition().setEnvironmentContext(environmentContext);
- }
+ public void setServiceRole(String serviceRole) {
+ getServiceMetadataDefinition().setServiceRole(serviceRole);
+ }
- public void setServiceType(String serviceType){
- getServiceMetadataDefinition().setServiceType(serviceType);
- }
-
- public String getServiceType(){
- return getServiceMetadataDefinition().getServiceType();
- }
-
- public void setServiceRole(String serviceRole){
- getServiceMetadataDefinition().setServiceRole(serviceRole);
- }
-
- public String getServiceRole(){
- return getServiceMetadataDefinition().getServiceRole();
- }
+ public String getInstantiationType() {
+ return getServiceMetadataDefinition().getInstantiationType();
+ }
- public void setInstantiationType(String instantiationType){
- getServiceMetadataDefinition().setInstantiationType(instantiationType);
- }
+ public void setInstantiationType(String instantiationType) {
+ getServiceMetadataDefinition().setInstantiationType(instantiationType);
+ }
- public String getInstantiationType(){
- return getServiceMetadataDefinition().getInstantiationType();
- }
+ private ServiceMetadataDataDefinition getServiceMetadataDefinition() {
+ return (ServiceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition();
+ }
- private ServiceMetadataDataDefinition getServiceMetadataDefinition() {
- return (ServiceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition();
- }
+ public String getServiceFunction() {
+ return getServiceMetadataDefinition().getServiceFunction();
+ }
- public void setServiceFunction(String serviceFunction){
- getServiceMetadataDefinition().setServiceFunction(serviceFunction);
- }
+ public void setServiceFunction(String serviceFunction) {
+ getServiceMetadataDefinition().setServiceFunction(serviceFunction);
+ }
- public String getServiceFunction(){
- return getServiceMetadataDefinition().getServiceFunction();
- }
+ public void validateAndSetInstantiationType() {
+ if (this.getInstantiationType().equals(StringUtils.EMPTY)) {
+ this.setInstantiationType(InstantiationTypes.A_LA_CARTE.getValue());
+ }
+ }
- public void validateAndSetInstantiationType() {
- if (this.getInstantiationType().equals(StringUtils.EMPTY)) {
- this.setInstantiationType(InstantiationTypes.A_LA_CARTE.getValue());
- }
- }
+ @Override
+ public String toString() {
+ return "Service [componentMetadataDefinition=" + getComponentMetadataDefinition()
+ // + ", resourceInstances=" + resourceInstances + ",
+ // resourceInstancesRelations=" + resourceInstancesRelations + ",
+ // resourceInstancesRelations="
+ // + resourceInstancesRelations
+ + " ]";
+ }
-
- @Override
- public String toString() {
- return "Service [componentMetadataDefinition=" + getComponentMetadataDefinition()
- // + ", resourceInstances=" + resourceInstances + ",
- // resourceInstancesRelations=" + resourceInstancesRelations + ",
- // resourceInstancesRelations="
- // + resourceInstancesRelations
- + " ]";
- }
-
- @Override
- public void setSpecificComponetTypeArtifacts(Map<String, ArtifactDefinition> specificComponentTypeArtifacts) {
- setServiceApiArtifacts(specificComponentTypeArtifacts);
- }
+ @Override
+ public void setSpecificComponetTypeArtifacts(Map<String, ArtifactDefinition> specificComponentTypeArtifacts) {
+ setServiceApiArtifacts(specificComponentTypeArtifacts);
+ }
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/RequirementDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/RequirementDefinitionTest.java
new file mode 100644
index 0000000..9d3f4a9
--- /dev/null
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/RequirementDefinitionTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020, Nordix Foundation. 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=========================================================
+ */
+
+package org.openecomp.sdc.be.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
+
+public class RequirementDefinitionTest {
+
+ @Test
+ public void testRequirementDefinition() {
+ final RequirementDefinition testSubject = new RequirementDefinition();
+ assertThat(testSubject).isNotNull().isInstanceOf(RequirementDefinition.class);
+ }
+
+ @Test
+ public void testRequirementDefinition_clone() {
+ final RequirementDefinition testSubject = new RequirementDefinition(new RequirementDefinition());
+ assertThat(testSubject).isNotNull().isInstanceOf(RequirementDefinition.class);
+ }
+
+ @Test
+ public void testRequirementDefinition_fromRequirementDataDefinition() {
+ final RequirementDefinition testSubject = new RequirementDefinition(new RequirementDataDefinition());
+ assertThat(testSubject).isNotNull().isInstanceOf(RequirementDefinition.class);
+ }
+}