diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-06-06 13:56:56 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-06-06 11:35:44 +0000 |
commit | e849acfa8d05d86d5f57a3e45f1e2acaf023cb93 (patch) | |
tree | 859b816fcc03a9f03203b40244a17d965ad42f34 | |
parent | 97093972d5eb21b5529a40be9ad9fcbe043d5576 (diff) |
new unit tests for sdc-dao
Change-Id: Id7ba81e71502db771f7243f526d46eb0865f16f2
Issue-ID: SDC-1333
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
66 files changed, 1198 insertions, 190 deletions
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml index c93d2c524b..718674211a 100644 --- a/catalog-dao/pom.xml +++ b/catalog-dao/pom.xml @@ -116,7 +116,6 @@ <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> - <version>${jmockit.version}</version> <scope>test</scope> </dependency> diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml index 7910052dc1..08697a23c6 100644 --- a/catalog-model/pom.xml +++ b/catalog-model/pom.xml @@ -180,7 +180,13 @@ <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> - + + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> 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 956a94048a..a9543d240f 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 @@ -20,20 +20,27 @@ package org.openecomp.sdc.be.model; -import com.fasterxml.jackson.annotation.JsonIgnore; +import static java.util.Collections.emptyList; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; - -import static java.util.Collections.emptyList; -import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import java.io.Serializable; -import java.util.*; -import java.util.stream.Collectors; +import com.fasterxml.jackson.annotation.JsonIgnore; public abstract class Component implements Serializable { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java index 19653e3847..3db3131fb0 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java @@ -20,13 +20,13 @@ package org.openecomp.sdc.be.model; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.tuple.Pair; - import java.io.Serializable; import java.util.List; import java.util.Map; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.tuple.Pair; + public class ComponentInstInputsMap implements Serializable { /** diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java index a45e3d2bd7..e80f306faf 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java @@ -20,15 +20,15 @@ package org.openecomp.sdc.be.model; -import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; - import java.io.Serializable; import java.util.Collections; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; + public class ComponentInstance extends ComponentInstanceDataDefinition implements Serializable, PropertiesOwner { /** diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java index 9bd66006e7..769aa8aac3 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java @@ -20,12 +20,12 @@ package org.openecomp.sdc.be.model; +import java.util.List; + import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import java.util.List; - public class ComponentParametersView { boolean ignoreUsers = false; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java index 4ffa843463..e9efa8f2e4 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java @@ -71,15 +71,21 @@ public class GroupInstance extends GroupInstanceDataDefinition implements Serial private void removeArtifactsDuplicates() { List<String> artifacts = getArtifacts(); Set<String> artifactsSet = new HashSet<>(); - artifactsSet.addAll(artifacts); - artifacts.clear(); - artifacts.addAll(artifactsSet); + + if (artifacts != null && !artifacts.isEmpty()) { + artifactsSet.addAll(artifacts); + artifacts.clear(); + artifacts.addAll(artifactsSet); + } List<String> giArtifacts = getGroupInstanceArtifacts(); Set<String> giArtifactsSet = new HashSet<>(); - giArtifactsSet.addAll(giArtifacts); - giArtifacts.clear(); - giArtifacts.addAll(giArtifactsSet); + + if (giArtifacts != null && !giArtifacts.isEmpty()) { + giArtifactsSet.addAll(giArtifacts); + giArtifacts.clear(); + giArtifacts.addAll(giArtifactsSet); + } } private void clearArtifactsUuid() { @@ -104,7 +110,7 @@ public class GroupInstance extends GroupInstanceDataDefinition implements Serial */ public void alignArtifactsUuid(Map<String, ArtifactDefinition> deploymentArtifacts) { List<String> artifactIds = getArtifacts(); - if(CollectionUtils.isNotEmpty(artifactIds)){ + if(CollectionUtils.isNotEmpty(artifactIds) && deploymentArtifacts != null){ removeArtifactsDuplicates(); clearArtifactsUuid(); List<String> artifactUuids = getArtifactsUuid(); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java index d5dfbc28e3..e1a648cbcf 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java @@ -20,14 +20,15 @@ package org.openecomp.sdc.be.model; -import com.fasterxml.jackson.annotation.JsonIgnore; -import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; - import java.io.Serializable; import java.util.Map; import java.util.stream.Collectors; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; + +import com.fasterxml.jackson.annotation.JsonIgnore; + /** * Definition of the operations that can be performed on (instances of) a Node * Type. @@ -59,7 +60,6 @@ public class InterfaceDefinition extends InterfaceDataDefinition implements IOpe @Override public boolean isDefinition() { - // TODO Auto-generated method stub return false; } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java index 681fc4e33b..22d69cd61b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java @@ -1,13 +1,13 @@ package org.openecomp.sdc.be.model; -import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; - import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; + +import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; /** * public class representing the component policy */ diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyTypeDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyTypeDefinition.java index 0cfdf196e1..9483d5c9da 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyTypeDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyTypeDefinition.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.be.model; -import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; - import java.util.List; +import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; + /** * Specifies the policy type that the Node Type exposes. */ diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java index 8e38beb2c6..917678380b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java @@ -43,6 +43,9 @@ public class Resource extends Component implements Serializable { public Resource(ComponentMetadataDefinition componentMetadataDefinition) { super(componentMetadataDefinition); + if(this.getComponentMetadataDefinition().getMetadataDataDefinition() == null) { + this.getComponentMetadataDefinition().componentMetadataDataDefinition = new ResourceMetadataDataDefinition(); + } this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.RESOURCE); } 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 c3852e060b..259083303b 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 @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.model; import java.util.HashMap; import java.util.Map; +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; @@ -40,7 +41,10 @@ public class Service extends Component { public Service(ComponentMetadataDefinition serviceMetadataDefinition) { super(serviceMetadataDefinition); - this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.SERVICE); + ComponentMetadataDataDefinition metadataDataDefinition = this.getComponentMetadataDefinition().getMetadataDataDefinition(); + if(metadataDataDefinition != null) { + metadataDataDefinition.setComponentType(ComponentTypeEnum.SERVICE); + } this.setToscaType(ToscaElementTypeEnum.TopologyTemplate.getValue()); } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java index f969bbd18f..eb33a50e0b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/cache/ComponentCache.java @@ -20,7 +20,22 @@ package org.openecomp.sdc.be.model.cache; -import fj.data.Either; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -50,20 +65,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.PostConstruct; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.function.Function; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component("component-cache") public class ComponentCache { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java index 8912efdca9..567258d0d5 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java @@ -20,14 +20,29 @@ package org.openecomp.sdc.be.model.jsontitan.datamodel; +import java.util.HashMap; +import java.util.Map; + import org.apache.commons.collections.MapUtils; -import org.openecomp.sdc.be.datatypes.elements.*; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; +import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs; +import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum; -import java.util.HashMap; -import java.util.Map; - public class TopologyTemplate extends ToscaElement{ public TopologyTemplate() { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java index 76fb0a9151..2b35699289 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ExternalReferencesOperation.java @@ -1,6 +1,11 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; @@ -14,7 +19,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import fj.data.Either; /** * Created by yavivi on 26/01/2018. diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java index ad4c1fb4f3..ed06704a68 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ForwardingPathOperation.java @@ -20,7 +20,12 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.UUID; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -35,11 +40,7 @@ import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.UUID; +import fj.data.Either; @org.springframework.stereotype.Component("forwarding-paths-operations") public class ForwardingPathOperation extends BaseOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java index 0cde1dc9f4..ea2f8bc1f7 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java @@ -16,12 +16,12 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.UUID; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -36,6 +36,8 @@ import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fj.data.Either; + @org.springframework.stereotype.Component("interfaces-operation") public class InterfaceOperation extends BaseOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java index 3dc39b3a99..561a95b693 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java @@ -28,11 +28,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.BiConsumer; -import java.util.function.BiPredicate; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.function.BiPredicate; import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; @@ -69,7 +69,22 @@ import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.RelationshipImpl; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java index 06770318aa..d775f44bdb 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/PolicyOperation.java @@ -1,5 +1,9 @@ package org.openecomp.sdc.be.model.jsontitan.operations; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -12,10 +16,6 @@ import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - @org.springframework.stereotype.Component public class PolicyOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java index 355a6e28a5..d109439cc1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java @@ -20,8 +20,15 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import com.google.gson.reflect.TypeToken; -import fj.data.Either; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Collectors; + import org.apache.commons.collections.MapUtils; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; @@ -69,14 +76,9 @@ import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; +import com.google.gson.reflect.TypeToken; + +import fj.data.Either; @org.springframework.stereotype.Component("topology-template-operation") public class TopologyTemplateOperation extends ToscaElementOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java index b1b886bc62..0ae3532169 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java @@ -20,7 +20,21 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.function.BiPredicate; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -31,13 +45,44 @@ import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.*; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.PolicyDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.catalog.CatalogComponent; import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; @@ -53,10 +98,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.*; -import java.util.Map.Entry; -import java.util.function.BiPredicate; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component("tosca-operation-facade") public class ToscaOperationFacade { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java index 8c9d025a7b..37c21e812f 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapper.java @@ -1,5 +1,8 @@ package org.openecomp.sdc.be.model.jsontitan.utils; +import java.util.Map; +import java.util.Optional; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; @@ -9,9 +12,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.Map; -import java.util.Optional; - /** * Created by yavivi on 12/02/2018. */ diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtils.java index df9702949a..6b22413d56 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtils.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtils.java @@ -15,6 +15,15 @@ */ package org.openecomp.sdc.be.model.jsontitan.utils; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Formatter; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.datatypes.elements.InputDataDefinition; @@ -25,15 +34,6 @@ import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.Resource; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Formatter; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - public class InterfaceUtils { public static final String INTERFACE_TOSCA_RESOURCE_NAME = "org.openecomp.interfaces.node.lifecycle.%s"; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java index 9fecbe7fba..bbe607b58c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java @@ -40,6 +40,7 @@ import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; @@ -84,7 +85,6 @@ import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum; -import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.ProductMetadataData; import org.openecomp.sdc.be.resources.data.ResourceMetadataData; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/DerivedFromOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/DerivedFromOperation.java index 0dc03ad363..73abef3efb 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/DerivedFromOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/DerivedFromOperation.java @@ -1,10 +1,11 @@ package org.openecomp.sdc.be.model.operations.api; -import fj.data.Either; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import fj.data.Either; + public interface DerivedFromOperation { /** diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPolicyTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPolicyTypeOperation.java index 526cbd282d..46a6aefa05 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPolicyTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPolicyTypeOperation.java @@ -20,12 +20,13 @@ package org.openecomp.sdc.be.model.operations.api; -import fj.data.Either; -import org.openecomp.sdc.be.model.PolicyTypeDefinition; - import java.util.List; import java.util.Set; +import org.openecomp.sdc.be.model.PolicyTypeDefinition; + +import fj.data.Either; + public interface IPolicyTypeOperation { Either<PolicyTypeDefinition, StorageOperationStatus> getLatestPolicyTypeByType(String policyTypeName); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPropertyOperation.java index d1a51677fe..c3218e666c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPropertyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IPropertyOperation.java @@ -20,14 +20,15 @@ package org.openecomp.sdc.be.model.operations.api; -import fj.data.Either; +import java.util.Map; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.IComplexDefaultValue; import org.openecomp.sdc.be.model.PropertyDefinition; -import java.util.Map; +import fj.data.Either; public interface IPropertyOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java index 65abcd4d4f..8f34b3207e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java @@ -51,7 +51,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import com.thinkaurelius.titan.core.TitanTransaction; import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java index 5b9af033ea..88edb1fd9e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java @@ -27,6 +27,7 @@ import java.nio.file.Files; import java.util.Map; import javax.annotation.PostConstruct; + import org.apache.commons.io.filefilter.WildcardFileFilter; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java index fc78ada054..2e5da8ddda 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/DefaultDerivedFromOperation.java @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.model.operations.impl; -import fj.data.Either; import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; @@ -15,6 +14,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import fj.data.Either; + @Component public class DefaultDerivedFromOperation implements DerivedFromOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java index 3b7b5def2e..0b13fe1962 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java @@ -42,7 +42,6 @@ import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -63,7 +62,6 @@ import org.openecomp.sdc.be.resources.data.PropertyData; import org.openecomp.sdc.be.resources.data.PropertyValueData; import org.openecomp.sdc.be.resources.data.UniqueIdData; import org.openecomp.sdc.common.datastructure.Wrapper; -import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java index e9236fc9af..b17bab3d04 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupTypeOperation.java @@ -20,9 +20,18 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.google.common.base.Strings; -import com.thinkaurelius.titan.graphdb.query.TitanPredicate; -import fj.data.Either; +import static org.openecomp.sdc.be.dao.titan.TitanUtils.buildNotInPredicate; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Edge; @@ -50,16 +59,10 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; +import com.google.common.base.Strings; +import com.thinkaurelius.titan.graphdb.query.TitanPredicate; -import static org.openecomp.sdc.be.dao.titan.TitanUtils.buildNotInPredicate; +import fj.data.Either; @Component("group-type-operation") public class GroupTypeOperation extends AbstractOperation implements IGroupTypeOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java index c6abe8a849..7b7ead5a19 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java @@ -47,8 +47,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import com.google.gson.Gson; - import fj.data.Either; @Component("heat-parameter-operation") diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java index 4e9506f8db..53a7f39001 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java @@ -50,8 +50,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import com.thinkaurelius.titan.core.TitanVertex; - import fj.data.Either; @Component("interface-operation") diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java index 799c01692d..11355f3387 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PolicyTypeOperation.java @@ -20,8 +20,15 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.thinkaurelius.titan.graphdb.query.TitanPredicate; -import fj.data.Either; +import static org.openecomp.sdc.be.dao.titan.TitanUtils.buildNotInPredicate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; @@ -40,14 +47,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; +import com.thinkaurelius.titan.graphdb.query.TitanPredicate; -import static org.openecomp.sdc.be.dao.titan.TitanUtils.buildNotInPredicate; +import fj.data.Either; @Component("policy-type-operation") public class PolicyTypeOperation extends AbstractOperation implements IPolicyTypeOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java index f0d0b514ab..86e5b1b466 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java @@ -20,20 +20,22 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Edge; @@ -80,22 +82,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.StringJoiner; -import java.util.function.Consumer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; @Component("property-operation") public class PropertyOperation extends AbstractOperation implements IPropertyOperation { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java index 31cec74f0d..ed58bc221b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java @@ -29,13 +29,11 @@ import java.util.Set; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java index d4331937c8..8eb784029b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java @@ -20,10 +20,8 @@ package org.openecomp.sdc.be.model.tosca.validators; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; +import java.util.Map; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; @@ -31,7 +29,10 @@ import org.openecomp.sdc.common.util.JsonUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Map; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; public class ListValidator implements PropertyTypeValidator { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java index f324cf83ad..eaf887b003 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java @@ -20,13 +20,23 @@ package org.openecomp.sdc.be.ui.model; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.*; -import org.openecomp.sdc.be.model.category.CategoryDefinition; - import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.AdditionalInformationDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.PolicyDefinition; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.category.CategoryDefinition; + public class UiComponentDataTransfer { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransfer.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransfer.java index c784a598ab..197f3883b2 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransfer.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceDataTransfer.java @@ -20,10 +20,10 @@ package org.openecomp.sdc.be.ui.model; +import java.util.Map; + import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; - -import java.util.Map; public class UiServiceDataTransfer extends UiComponentDataTransfer { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java index f7ebf75b3c..f8f116539f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/AdditionalInformationDefinitionTest.java @@ -1,6 +1,9 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; + import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; public class AdditionalInformationDefinitionTest { @@ -9,6 +12,12 @@ public class AdditionalInformationDefinitionTest { return new AdditionalInformationDefinition(); } + @Test + public void testCtor() throws Exception { + new AdditionalInformationDefinition(new AdditionalInformationDefinition()); + new AdditionalInformationDefinition(new AdditionalInfoParameterDataDefinition()); + new AdditionalInformationDefinition(new AdditionalInformationDefinition(), "mock", new LinkedList<>()); + } @Test public void testGetParentUniqueId() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java index 49e35363d6..3c0034aa3b 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactDefinitionTest.java @@ -1,8 +1,11 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; public class ArtifactDefinitionTest { @@ -11,6 +14,13 @@ public class ArtifactDefinitionTest { return new ArtifactDefinition(); } + @Test + public void testCtor() throws Exception { + new ArtifactDefinition(new ArtifactDefinition()); + new ArtifactDefinition(new ArtifactDataDefinition()); + new ArtifactDefinition(new HashMap<>()); + new ArtifactDefinition(new ArtifactDataDefinition(), "mock"); + } @Test public void testGetPayloadData() throws Exception { @@ -59,6 +69,8 @@ public class ArtifactDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.getListHeatParameters(); + testSubject.setHeatParameters(new LinkedList<>()); + result = testSubject.getListHeatParameters(); } @@ -69,7 +81,8 @@ public class ArtifactDefinitionTest { // test 1 testSubject = createTestSubject(); - properties = null; + testSubject.setListHeatParameters(properties); + properties = new LinkedList<>(); testSubject.setListHeatParameters(properties); } @@ -82,6 +95,8 @@ public class ArtifactDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.checkEsIdExist(); + testSubject.setEsId("mock"); + result = testSubject.checkEsIdExist(); } @@ -99,11 +114,13 @@ public class ArtifactDefinitionTest { @Test public void testEquals() throws Exception { ArtifactDefinition testSubject; - Object obj = null; boolean result; // default test testSubject = createTestSubject(); - result = testSubject.equals(obj); + result = testSubject.equals(null); + result = testSubject.equals(testSubject); + result = testSubject.equals(new Object()); + result = testSubject.equals(createTestSubject()); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactTypeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactTypeTest.java new file mode 100644 index 0000000000..cb870b752e --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ArtifactTypeTest.java @@ -0,0 +1,67 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; + +public class ArtifactTypeTest { + + private ArtifactType createTestSubject() { + return new ArtifactType(); + } + + @Test + public void testGetName() throws Exception { + ArtifactType testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + ArtifactType testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testHashCode() throws Exception { + ArtifactType testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + ArtifactType testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + result = testSubject.equals(obj); + obj = new Object(); + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + testSubject.setName("mock"); + ArtifactType createTestSubject = createTestSubject(); + createTestSubject.setName("mock"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(true, result); + createTestSubject.setName("mock2"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(false, result); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java index 7714d43c68..6c7e879a9e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapReqDefTest.java @@ -1,5 +1,6 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,6 +13,10 @@ public class CapReqDefTest { return new CapReqDef(); } + @Test + public void testCtor() throws Exception { + new CapReqDef(new HashMap<>(), new HashMap<>()); + } @Test public void testGetCapabilities() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java index d1c734383d..ffe0a829bb 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityDefinitionTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; public class CapabilityDefinitionTest { @@ -11,6 +13,14 @@ public class CapabilityDefinitionTest { return new CapabilityDefinition(); } + @Test + public void testCtor() throws Exception { + CapabilityDefinition other = new CapabilityDefinition(); + new CapabilityDefinition(other); + other.setProperties(new LinkedList<>()); + new CapabilityDefinition(other); + new CapabilityDefinition(new CapabilityDataDefinition()); + } @Test public void testHashCode() throws Exception { @@ -32,6 +42,14 @@ public class CapabilityDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.equals(obj); + result = testSubject.equals(new Object()); + result = testSubject.equals(testSubject); + CapabilityDefinition createTestSubject = createTestSubject(); + result = testSubject.equals(createTestSubject); + createTestSubject.setProperties(new LinkedList<>()); + result = testSubject.equals(createTestSubject); + testSubject.setProperties(new LinkedList<>()); + result = testSubject.equals(createTestSubject); } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityRequirementRelationshipTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityRequirementRelationshipTest.java new file mode 100644 index 0000000000..85cbef6958 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityRequirementRelationshipTest.java @@ -0,0 +1,80 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; + +public class CapabilityRequirementRelationshipTest { + + private CapabilityRequirementRelationship createTestSubject() { + return new CapabilityRequirementRelationship(); + } + + @Test + public void testGetRelation() throws Exception { + CapabilityRequirementRelationship testSubject; + RelationshipInfo result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRelation(); + } + + @Test + public void testSetRelation() throws Exception { + CapabilityRequirementRelationship testSubject; + RelationshipInfo relation = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRelation(relation); + } + + @Test + public void testGetCapability() throws Exception { + CapabilityRequirementRelationship testSubject; + CapabilityDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapability(); + } + + @Test + public void testSetCapability() throws Exception { + CapabilityRequirementRelationship testSubject; + CapabilityDataDefinition capability = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapability(capability); + } + + @Test + public void testGetRequirement() throws Exception { + CapabilityRequirementRelationship testSubject; + RequirementDataDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirement(); + } + + @Test + public void testSetRequirement() throws Exception { + CapabilityRequirementRelationship testSubject; + RequirementDataDefinition requirement = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirement(requirement); + } + + @Test + public void testGetSerialversionuid() throws Exception { + long result; + + // default test + result = CapabilityRequirementRelationship.getSerialversionuid(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java index f05a302fdb..dde80598e7 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabilityTypeDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.Map; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; public class CapabilityTypeDefinitionTest { @@ -11,6 +12,10 @@ public class CapabilityTypeDefinitionTest { return new CapabilityTypeDefinition(); } + @Test + public void testCtor() throws Exception { + new CapabilityTypeDefinition(new CapabilityTypeDataDefinition()); + } @Test public void testGetDerivedFrom() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabiltyInstanceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabiltyInstanceTest.java new file mode 100644 index 0000000000..ff13a6ce04 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CapabiltyInstanceTest.java @@ -0,0 +1,62 @@ +package org.openecomp.sdc.be.model; + +import java.util.Map; + +import org.junit.Test; + +public class CapabiltyInstanceTest { + + private CapabiltyInstance createTestSubject() { + return new CapabiltyInstance(); + } + + @Test + public void testGetUniqueId() throws Exception { + CapabiltyInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getUniqueId(); + } + + @Test + public void testSetUniqueId() throws Exception { + CapabiltyInstance testSubject; + String uniqueId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setUniqueId(uniqueId); + } + + @Test + public void testGetProperties() throws Exception { + CapabiltyInstance testSubject; + Map<String, String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getProperties(); + } + + @Test + public void testSetProperties() throws Exception { + CapabiltyInstance testSubject; + Map<String, String> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.setProperties(properties); + } + + @Test + public void testToString() throws Exception { + CapabiltyInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/CategoryTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CategoryTest.java new file mode 100644 index 0000000000..1f8b116325 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/CategoryTest.java @@ -0,0 +1,75 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Assert; +import org.junit.Test; + +public class CategoryTest { + + private Category createTestSubject() { + return new Category(); + } + + @Test + public void testGetName() throws Exception { + Category testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getName(); + } + + @Test + public void testSetName() throws Exception { + Category testSubject; + String name = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setName(name); + } + + @Test + public void testHashCode() throws Exception { + Category testSubject; + int result; + + // default test + testSubject = createTestSubject(); + result = testSubject.hashCode(); + } + + @Test + public void testEquals() throws Exception { + Category testSubject; + Object obj = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + obj = null; + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(new Object()); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + Category createTestSubject = createTestSubject(); + createTestSubject.setName("mock"); + testSubject.setName("mock2"); + result = testSubject.equals(createTestSubject); + Assert.assertEquals(false, result); + } + + @Test + public void testToString() throws Exception { + Category testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.toString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java index 90eb99504f..006d4fc7ad 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstInputsMapTest.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -11,7 +13,6 @@ public class ComponentInstInputsMapTest { return new ComponentInstInputsMap(); } - @Test public void testGetComponentInstanceInputsMap() throws Exception { ComponentInstInputsMap testSubject; @@ -22,7 +23,6 @@ public class ComponentInstInputsMapTest { result = testSubject.getComponentInstanceInputsMap(); } - @Test public void testSetComponentInstanceInputsMap() throws Exception { ComponentInstInputsMap testSubject; @@ -33,7 +33,6 @@ public class ComponentInstInputsMapTest { testSubject.setComponentInstanceInputsMap(componentInstanceInputsMap); } - @Test public void testGetComponentInstanceProperties() throws Exception { ComponentInstInputsMap testSubject; @@ -44,7 +43,6 @@ public class ComponentInstInputsMapTest { result = testSubject.getComponentInstanceProperties(); } - @Test public void testSetComponentInstancePropInput() throws Exception { ComponentInstInputsMap testSubject; @@ -54,4 +52,48 @@ public class ComponentInstInputsMapTest { testSubject = createTestSubject(); testSubject.setComponentInstancePropInput(componentInstanceProperties); } + + @Test + public void testResolvePropertiesToDeclareEmpty() throws Exception { + ComponentInstInputsMap testSubject; + Map<String, List<ComponentInstancePropInput>> componentInstanceProperties = null; + + // default test + testSubject = createTestSubject(); + try { + testSubject.resolvePropertiesToDeclare(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void testResolvePropertiesToDeclare() throws Exception { + ComponentInstInputsMap testSubject; + Map<String, List<ComponentInstancePropInput>> componentInstanceProperties = null; + + Map<String, List<ComponentInstancePropInput>> inputs = new HashMap<>(); + inputs.put("mock", new LinkedList<>()); + // default test + testSubject = createTestSubject(); + testSubject.setComponentInstanceInputsMap(inputs); + testSubject.resolvePropertiesToDeclare(); + testSubject = createTestSubject(); + testSubject.setComponentInstancePropInput(inputs); + testSubject.resolvePropertiesToDeclare(); + testSubject = createTestSubject(); + testSubject.setPolicyProperties(inputs); + testSubject.resolvePropertiesToDeclare(); + } + + @Test + public void testGetPolicyProperties() throws Exception { + ComponentInstInputsMap testSubject; + Map<String, List<ComponentInstancePropInput>> componentInstanceProperties = null; + + // default test + testSubject = createTestSubject(); + testSubject.getPolicyProperties(); + } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java index 56e34678f9..d02b05fac5 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceInputTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -12,6 +13,12 @@ public class ComponentInstanceInputTest { return new ComponentInstanceInput(); } + @Test + public void testCtor() throws Exception { + new ComponentInstanceInput(new PropertyDataDefinition()); + new ComponentInstanceInput(new InputDefinition(), "mock", "mock"); + new ComponentInstanceInput(new PropertyDataDefinition(), "mock", "mock", "mock"); + } @Test public void testGetComponentInstanceName() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java index 2d53b31905..2d35a170b8 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropInputTest.java @@ -9,6 +9,10 @@ public class ComponentInstancePropInputTest { return new ComponentInstancePropInput(); } + @Test + public void testCtor() throws Exception { + new ComponentInstancePropInput(new ComponentInstanceProperty()); + } @Test public void testGetPropertiesName() throws Exception { @@ -62,5 +66,7 @@ public class ComponentInstancePropInputTest { // default test testSubject = createTestSubject(); result = testSubject.getParsedPropNames(); + testSubject.setPropertiesName("mock"); + result = testSubject.getParsedPropNames(); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java index b888e95d64..a734722f2a 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstancePropertyTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -12,6 +13,13 @@ public class ComponentInstancePropertyTest { return new ComponentInstanceProperty(); } + @Test + public void testCtor() throws Exception { + new ComponentInstanceProperty(new PropertyDataDefinition()); + new ComponentInstanceProperty(new PropertyDefinition()); + new ComponentInstanceProperty(false, new PropertyDefinition(), "mock"); + new ComponentInstanceProperty(new PropertyDefinition(), "mock", "mock"); + } @Test public void testGetComponentInstanceName() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceTest.java new file mode 100644 index 0000000000..fd533122d8 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentInstanceTest.java @@ -0,0 +1,172 @@ +package org.openecomp.sdc.be.model; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; + +public class ComponentInstanceTest { + + private ComponentInstance createTestSubject() { + return new ComponentInstance(); + } + + @Test + public void testCtor() throws Exception { + new ComponentInstance(new ComponentInstanceDataDefinition()); + } + + @Test + public void testGetCapabilities() throws Exception { + ComponentInstance testSubject; + Map<String, List<CapabilityDefinition>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCapabilities(); + } + + @Test + public void testSetCapabilities() throws Exception { + ComponentInstance testSubject; + Map<String, List<CapabilityDefinition>> capabilities = null; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilities(capabilities); + } + + @Test + public void testGetRequirements() throws Exception { + ComponentInstance testSubject; + Map<String, List<RequirementDefinition>> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getRequirements(); + } + + @Test + public void testSetRequirements() throws Exception { + ComponentInstance testSubject; + Map<String, List<RequirementDefinition>> requirements = null; + + // default test + testSubject = createTestSubject(); + testSubject.setRequirements(requirements); + } + + @Test + public void testGetDeploymentArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDeploymentArtifacts(); + } + + @Test + public void testSafeGetDeploymentArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.safeGetDeploymentArtifacts(); + } + + @Test + public void testSafeGetInformationalArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.safeGetInformationalArtifacts(); + } + + @Test + public void testSetDeploymentArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> deploymentArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setDeploymentArtifacts(deploymentArtifacts); + } + + @Test + public void testGetArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getArtifacts(); + } + + @Test + public void testSafeGetArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.safeGetArtifacts(); + } + + @Test + public void testSetArtifacts() throws Exception { + ComponentInstance testSubject; + Map<String, ArtifactDefinition> artifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.setArtifacts(artifacts); + } + + @Test + public void testGetGroupInstances() throws Exception { + ComponentInstance testSubject; + List<GroupInstance> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupInstances(); + } + + @Test + public void testSetGroupInstances() throws Exception { + ComponentInstance testSubject; + List<GroupInstance> groupInstances = null; + + // default test + testSubject = createTestSubject(); + testSubject.setGroupInstances(groupInstances); + } + + @Test + public void testGetActualComponentUid() throws Exception { + ComponentInstance testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getActualComponentUid(); + } + + @Test + public void testIsArtifactExists() throws Exception { + ComponentInstance testSubject; + ArtifactGroupTypeEnum groupType = null; + String artifactLabel = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isArtifactExists(groupType, artifactLabel); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java index 1642f517c2..a8425e100b 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentMetadataDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; +import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; public class ComponentMetadataDefinitionTest { @@ -10,7 +11,11 @@ public class ComponentMetadataDefinitionTest { private ComponentMetadataDefinition createTestSubject() { return new ComponentMetadataDefinition(); } - + + @Test + public void testCtor() throws Exception { + new ComponentMetadataDefinition(new ResourceMetadataDataDefinition()); + } @Test public void testGetMetadataDataDefinition() throws Exception { @@ -42,8 +47,21 @@ public class ComponentMetadataDefinitionTest { // test 1 testSubject = createTestSubject(); - obj = null; result = testSubject.equals(obj); Assert.assertEquals(false, result); + obj = new Object(); + result = testSubject.equals(obj); + Assert.assertEquals(false, result); + result = testSubject.equals(testSubject); + Assert.assertEquals(true, result); + result = testSubject.equals(createTestSubject()); + Assert.assertEquals(true, result); + ComponentMetadataDefinition testSubject2 = createTestSubject(); + testSubject.componentMetadataDataDefinition = new ResourceMetadataDataDefinition(); + result = testSubject.equals(testSubject2); + Assert.assertEquals(false, result); + testSubject2.componentMetadataDataDefinition = new ResourceMetadataDataDefinition(); + result = testSubject.equals(testSubject2); + Assert.assertEquals(true, result); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java index 57de2189e9..8dd2d0da3f 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java @@ -1,7 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; + import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; public class ComponentParametersViewTest { @@ -10,6 +13,16 @@ public class ComponentParametersViewTest { return new ComponentParametersView(); } + @Test + public void testCtor() throws Exception { + new ComponentParametersView(true); + + LinkedList<String> linkedList = new LinkedList<>(); + for (ComponentFieldsEnum iterable_element : ComponentFieldsEnum.values()) { + linkedList.add(iterable_element.getValue()); + } + new ComponentParametersView(linkedList); + } @Test public void testFilter() throws Exception { @@ -21,6 +34,8 @@ public class ComponentParametersViewTest { // default test testSubject = createTestSubject(); result = testSubject.filter(component, componentType); + testSubject.disableAll(); + result = testSubject.filter(new Resource(), componentType); } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java index 7cd50ce418..1b5abb8a1c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DataTypeDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition; public class DataTypeDefinitionTest { @@ -11,6 +12,11 @@ public class DataTypeDefinitionTest { return new DataTypeDefinition(); } + @Test + public void testCtor() throws Exception { + new DataTypeDefinition(new DataTypeDefinition()); + new DataTypeDefinition(new DataTypeDataDefinition()); + } @Test public void testGetConstraints() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionStatusEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionStatusEnumTest.java new file mode 100644 index 0000000000..26e15ab783 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionStatusEnumTest.java @@ -0,0 +1,30 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; + +public class DistributionStatusEnumTest { + + private DistributionStatusEnum createTestSubject() { + return DistributionStatusEnum.DISTRIBUTED; + } + + @Test + public void testGetValue() throws Exception { + DistributionStatusEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getValue(); + } + + @Test + public void testFindState() throws Exception { + String state = ""; + DistributionStatusEnum result; + + // default test + result = DistributionStatusEnum.findState(state); + DistributionStatusEnum.findState(DistributionStatusEnum.DISTRIBUTED.getValue()); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionTransitionEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionTransitionEnumTest.java new file mode 100644 index 0000000000..c292996595 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/DistributionTransitionEnumTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; + +public class DistributionTransitionEnumTest { + + private DistributionTransitionEnum createTestSubject() { + return DistributionTransitionEnum.APPROVE; + } + + @Test + public void testGetDisplayName() throws Exception { + DistributionTransitionEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDisplayName(); + } + + @Test + public void testGetFromDisplayName() throws Exception { + String name = ""; + DistributionTransitionEnum result; + + // default test + result = DistributionTransitionEnum.getFromDisplayName(name); + result = DistributionTransitionEnum.getFromDisplayName(DistributionTransitionEnum.APPROVE.getDisplayName()); + } + + @Test + public void testValuesAsString() throws Exception { + String result; + + // default test + result = DistributionTransitionEnum.valuesAsString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java index db97b1e809..58709aa889 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupDefinitionTest.java @@ -1,8 +1,11 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class GroupDefinitionTest { @@ -11,6 +14,11 @@ public class GroupDefinitionTest { return new GroupDefinition(); } + @Test + public void testCtor() throws Exception { + new GroupDefinition(new GroupDefinition()); + new GroupDefinition(new GroupDataDefinition()); + } @Test public void testConvertToGroupProperties() throws Exception { @@ -20,6 +28,10 @@ public class GroupDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.convertToGroupProperties(); + List<PropertyDataDefinition> properties = new LinkedList<>(); + properties.add(new PropertyDataDefinition()); + testSubject.setProperties(properties); + result = testSubject.convertToGroupProperties(); } @@ -30,7 +42,9 @@ public class GroupDefinitionTest { // test 1 testSubject = createTestSubject(); - properties = null; + testSubject.convertFromGroupProperties(properties); + properties = new LinkedList<>(); + properties.add(new GroupProperty()); testSubject.convertFromGroupProperties(properties); } @@ -44,5 +58,7 @@ public class GroupDefinitionTest { // default test testSubject = createTestSubject(); result = testSubject.isSamePrefix(resourceName); + testSubject.setName("mock"); + result = testSubject.isSamePrefix("mock"); } }
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstancePropertyTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstancePropertyTest.java new file mode 100644 index 0000000000..a0484cca01 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstancePropertyTest.java @@ -0,0 +1,38 @@ +package org.openecomp.sdc.be.model; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + +public class GroupInstancePropertyTest { + + private GroupInstanceProperty createTestSubject() { + return new GroupInstanceProperty(); + } + + @Test + public void testCtor() throws Exception { + new GroupInstanceProperty(new GroupInstanceProperty()); + new GroupInstanceProperty(new PropertyDataDefinition()); + new GroupInstanceProperty(new GroupInstanceProperty(), "mock"); + } + + @Test + public void testGetParentValue() throws Exception { + GroupInstanceProperty testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getParentValue(); + } + + @Test + public void testSetParentValue() throws Exception { + GroupInstanceProperty testSubject; + String parentValue = ""; + + // default test + testSubject = createTestSubject(); + testSubject.setParentValue(parentValue); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstanceTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstanceTest.java new file mode 100644 index 0000000000..84acf9dac8 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupInstanceTest.java @@ -0,0 +1,107 @@ +package org.openecomp.sdc.be.model; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + +import mockit.Deencapsulation; + +public class GroupInstanceTest { + + private GroupInstance createTestSubject() { + return new GroupInstance(); + } + + @Test + public void testCtor() throws Exception { + new GroupInstance(new GroupInstanceDataDefinition()); + } + + @Test + public void testConvertToGroupInstancesProperties() throws Exception { + GroupInstance testSubject; + List<GroupInstanceProperty> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertToGroupInstancesProperties(); + List<PropertyDataDefinition> properties = new LinkedList<>(); + properties.add(new PropertyDataDefinition()); + testSubject.setProperties(properties); + result = testSubject.convertToGroupInstancesProperties(); + } + + @Test + public void testConvertFromGroupInstancesProperties() throws Exception { + GroupInstance testSubject; + List<GroupInstanceProperty> groupInstancesProperties = null; + + // test 1 + testSubject = createTestSubject(); + groupInstancesProperties = null; + testSubject.convertFromGroupInstancesProperties(groupInstancesProperties); + groupInstancesProperties = new LinkedList<>(); + groupInstancesProperties.add(new GroupInstanceProperty()); + testSubject.convertFromGroupInstancesProperties(groupInstancesProperties); + } + + @Test + public void testRemoveArtifactsDuplicates() throws Exception { + GroupInstance testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "removeArtifactsDuplicates"); + LinkedList<String> artifacts = new LinkedList<>(); + artifacts.add("mock"); + testSubject.setArtifacts(artifacts); + LinkedList<String> groupInstanceArtifacts = new LinkedList<>(); + groupInstanceArtifacts.add("mock"); + testSubject.setGroupInstanceArtifacts(groupInstanceArtifacts); + Deencapsulation.invoke(testSubject, "removeArtifactsDuplicates"); + } + + @Test + public void testClearArtifactsUuid() throws Exception { + GroupInstance testSubject; + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "clearArtifactsUuid"); + } + + @Test + public void testAlignArtifactsUuid() throws Exception { + GroupInstance testSubject; + Map<String, ArtifactDefinition> deploymentArtifacts = null; + + // default test + testSubject = createTestSubject(); + testSubject.alignArtifactsUuid(deploymentArtifacts); + LinkedList<String> artifacts = new LinkedList<>(); + artifacts.add("mock"); + testSubject.setArtifacts(artifacts); + testSubject.alignArtifactsUuid(deploymentArtifacts); + deploymentArtifacts = new HashMap<>(); + deploymentArtifacts.put("mock", new ArtifactDefinition()); + testSubject.alignArtifactsUuid(deploymentArtifacts); + } + + @Test + public void testAddArtifactsIdToCollection() throws Exception { + GroupInstance testSubject; + List<String> artifactUuids = new LinkedList<>(); + ArtifactDefinition artifact = new ArtifactDefinition(); + + // default test + testSubject = createTestSubject(); + Deencapsulation.invoke(testSubject, "addArtifactsIdToCollection", artifactUuids, artifact); + artifact.setArtifactUUID("mock"); + Deencapsulation.invoke(testSubject, "addArtifactsIdToCollection", artifactUuids, artifact); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java index ffec81e6ea..0353fe42fb 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupPropertyTest.java @@ -1,6 +1,7 @@ package org.openecomp.sdc.be.model; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class GroupPropertyTest { @@ -9,6 +10,12 @@ public class GroupPropertyTest { return new GroupProperty(); } + @Test + public void testCtor() throws Exception { + new GroupProperty(new GroupProperty()); + new GroupProperty(new PropertyDataDefinition()); + new GroupProperty(new PropertyDefinition(), "mock", "mock"); + } @Test public void testGetValueUniqueUid() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java index f84ec7c750..47e11e1d29 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/GroupTypeDefinitionTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.LinkedList; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; public class GroupTypeDefinitionTest { @@ -11,6 +13,10 @@ public class GroupTypeDefinitionTest { return new GroupTypeDefinition(); } + @Test + public void testCtor() throws Exception { + new GroupTypeDefinition(new GroupTypeDataDefinition()); + } @Test public void testGetProperties() throws Exception { @@ -33,6 +39,24 @@ public class GroupTypeDefinitionTest { testSubject.setProperties(properties); } + @Test + public void testGetCapabilityTypes() throws Exception { + GroupTypeDefinition testSubject; + List<PropertyDefinition> properties = null; + + // default test + testSubject = createTestSubject(); + testSubject.getCapabilityTypes(); + } + + @Test + public void testSetCapabilityTypes() throws Exception { + GroupTypeDefinition testSubject; + + // default test + testSubject = createTestSubject(); + testSubject.setCapabilityTypes(new LinkedList<>()); + } @Test public void testToString() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java index 65732607d1..e865f4e81e 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InputDefinitionTest.java @@ -3,6 +3,7 @@ package org.openecomp.sdc.be.model; import java.util.List; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class InputDefinitionTest { @@ -11,6 +12,11 @@ public class InputDefinitionTest { return new InputDefinition(); } + @Test + public void testCtor() throws Exception { + new InputDefinition(new PropertyDefinition()); + new InputDefinition(new PropertyDataDefinition()); + } @Test public void testGetInputs() throws Exception { diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java index 3f5b218097..5a8e155056 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/InterfaceDefinitionTest.java @@ -1,8 +1,10 @@ package org.openecomp.sdc.be.model; +import java.util.HashMap; import java.util.Map; import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; public class InterfaceDefinitionTest { @@ -12,6 +14,12 @@ public class InterfaceDefinitionTest { } @Test + public void testCtor() throws Exception { + new InterfaceDefinition(new InterfaceDataDefinition()); + new InterfaceDefinition("mock", "mock", new HashMap<>()); + } + + @Test public void testIsDefinition() throws Exception { InterfaceDefinition testSubject; boolean result; |