diff options
Diffstat (limited to 'catalog-model/src/test/java')
13 files changed, 1907 insertions, 62 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java new file mode 100644 index 0000000000..43fac12509 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java @@ -0,0 +1,42 @@ +package org.openecomp.sdc.be.model; + +import javax.annotation.Generated; + +import org.junit.Test; + +public class LifeCycleTransitionEnumTest { + + private LifeCycleTransitionEnum createTestSubject() { + return LifeCycleTransitionEnum.CERTIFY; + } + + + @Test + public void testGetDisplayName() throws Exception { + LifeCycleTransitionEnum testSubject; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDisplayName(); + } + + + @Test + public void testGetFromDisplayName() throws Exception { + String name = LifeCycleTransitionEnum.CHECKIN.getDisplayName() ; + LifeCycleTransitionEnum result; + + // default test + result = LifeCycleTransitionEnum.getFromDisplayName(name); + } + + + @Test + public void testValuesAsString() throws Exception { + String result; + + // default test + result = LifeCycleTransitionEnum.valuesAsString(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java index c8917763a8..b6c081afd3 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java @@ -37,6 +37,7 @@ public class ModelTestBase { configurationManager = new ConfigurationManager(configurationSource); Configuration configuration = new Configuration(); + configuration.setTitanInMemoryGraph(true); configurationManager.setConfiguration(configuration); diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java index 71d54bca73..971ebcca2b 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java @@ -5,8 +5,13 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.function.BiPredicate; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; @@ -14,22 +19,47 @@ import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; 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.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.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.RequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; 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.ModelTestBase; 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.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; +import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; + import com.google.common.collect.Lists; import fj.data.Either; -public class NodeTemplateOperationTest extends ModelTestBase{ +public class NodeTemplateOperationTest extends ModelTestBase { private final static String COMPONENT_ID = "componentId"; private final static String TO_INSTANCE_ID = "toInstanceId"; @@ -42,16 +72,16 @@ public class NodeTemplateOperationTest extends ModelTestBase{ private final static String REQUIREMENT_UID = "requirementUid"; private final static String REQUIREMENT_NAME = "requirementName"; private final static String RELATIONSHIP_TYPE = "relationshipType"; - + private static Map<String, MapListCapabiltyDataDefinition> fulfilledCapability; private static Map<String, MapListRequirementDataDefinition> fulfilledRequirement; private static CapabilityDataDefinition capability; private static RequirementDataDefinition requirement; private static RequirementCapabilityRelDef relation; - + private static TitanDao titanDao; private static NodeTemplateOperation operation; - + @BeforeClass public static void setup() { init(); @@ -60,7 +90,7 @@ public class NodeTemplateOperationTest extends ModelTestBase{ operation.setTitanDao(titanDao); buildDataDefinition(); } - + private static void buildDataDefinition() { buildCapabiltyDataDefinition(); buildRequirementDataDefinition(); @@ -68,68 +98,76 @@ public class NodeTemplateOperationTest extends ModelTestBase{ } @Test - public void testGetFulfilledCapabilityByRelationSuccess(){ + public void testGetFulfilledCapabilityByRelationSuccess() { GraphVertex vertex = Mockito.mock(GraphVertex.class); Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); - + GraphVertex dataVertex = new GraphVertex(); dataVertex.setJson(fulfilledCapability); Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.left(dataVertex); - when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); - Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation(COMPONENT_ID, TO_INSTANCE_ID, relation, (rel, cap)->isBelongingCapability(rel, cap)); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), + eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation( + COMPONENT_ID, TO_INSTANCE_ID, relation, (rel, cap) -> isBelongingCapability(rel, cap)); assertTrue(result.isLeft()); assertTrue(result.left().value().equals(capability)); } - + @Test - public void testGetFulfilledRequirementByRelationSuccess(){ + public void testGetFulfilledRequirementByRelationSuccess() { GraphVertex vertex = Mockito.mock(GraphVertex.class); Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); - + GraphVertex dataVertex = new GraphVertex(); dataVertex.setJson(fulfilledRequirement); Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.left(dataVertex); - when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); - Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation(COMPONENT_ID, FROM_INSTANCE_ID, relation, (rel, req)->isBelongingRequirement(rel, req)); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), + eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation( + COMPONENT_ID, FROM_INSTANCE_ID, relation, (rel, req) -> isBelongingRequirement(rel, req)); assertTrue(result.isLeft()); assertTrue(result.left().value().equals(requirement)); } - + @Test - public void testGetFulfilledCapabilityByRelationNotFoundFailure(){ + public void testGetFulfilledCapabilityByRelationNotFoundFailure() { GraphVertex vertex = Mockito.mock(GraphVertex.class); Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); - + Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.right(TitanOperationStatus.NOT_FOUND); - when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); - Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation(COMPONENT_ID, TO_INSTANCE_ID, relation, (rel, cap)->isBelongingCapability(rel, cap)); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), + eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation( + COMPONENT_ID, TO_INSTANCE_ID, relation, (rel, cap) -> isBelongingCapability(rel, cap)); assertTrue(result.isRight()); assertTrue(result.right().value() == StorageOperationStatus.NOT_FOUND); } - + @Test - public void testGetFulfilledRequirementByRelationNotFoundFailure(){ + public void testGetFulfilledRequirementByRelationNotFoundFailure() { GraphVertex vertex = Mockito.mock(GraphVertex.class); Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); - + Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.right(TitanOperationStatus.NOT_FOUND); - when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); - Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation(COMPONENT_ID, FROM_INSTANCE_ID, relation,(rel, req)->isBelongingRequirement(rel, req)); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), + eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation( + COMPONENT_ID, FROM_INSTANCE_ID, relation, (rel, req) -> isBelongingRequirement(rel, req)); assertTrue(result.isRight()); assertTrue(result.right().value() == StorageOperationStatus.NOT_FOUND); } - + private static void buildRequirementDataDefinition() { buildRequirement(); fulfilledRequirement = new HashMap<>(); MapListRequirementDataDefinition mapListRequirementDataDefinition = new MapListRequirementDataDefinition(); mapListRequirementDataDefinition.add(requirement.getCapability(), requirement); fulfilledRequirement.put(FROM_INSTANCE_ID, mapListRequirementDataDefinition); - + } private static void buildRequirement() { @@ -154,40 +192,157 @@ public class NodeTemplateOperationTest extends ModelTestBase{ capability.setUniqueId(CAPABILITY_UID); capability.setName(CAPABILITY_NAME); } - + private static void buildRelation() { - + relation = new RequirementCapabilityRelDef(); CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship(); RelationshipInfo relationInfo = new RelationshipInfo(); relationInfo.setId(RELATION_ID); relationship.setRelation(relationInfo); - + relation.setRelationships(Lists.newArrayList(relationship)); relation.setToNode(TO_INSTANCE_ID); relation.setFromNode(FROM_INSTANCE_ID); - + relationInfo.setCapabilityOwnerId(CAPABILITY_OWNER_ID); relationInfo.setCapabilityUid(CAPABILITY_UID); relationInfo.setCapability(CAPABILITY_NAME); relationInfo.setRequirementOwnerId(REQUIREMENT_OWNER_ID); relationInfo.setRequirementUid(REQUIREMENT_UID); relationInfo.setRequirement(REQUIREMENT_NAME); - RelationshipImpl relationshipImpl = new RelationshipImpl(); + RelationshipImpl relationshipImpl = new RelationshipImpl(); relationshipImpl.setType(RELATIONSHIP_TYPE); relationInfo.setRelationships(relationshipImpl); } - + private boolean isBelongingRequirement(RelationshipInfo relationshipInfo, RequirementDataDefinition req) { - return req.getRelationship().equals(relationshipInfo.getRelationship().getType()) && - req.getName().equals(relationshipInfo.getRequirement()) && - req.getUniqueId().equals(relationshipInfo.getRequirementUid()) && - req.getOwnerId().equals(relationshipInfo.getRequirementOwnerId()); + return req.getRelationship().equals(relationshipInfo.getRelationship().getType()) + && req.getName().equals(relationshipInfo.getRequirement()) + && req.getUniqueId().equals(relationshipInfo.getRequirementUid()) + && req.getOwnerId().equals(relationshipInfo.getRequirementOwnerId()); } - + private boolean isBelongingCapability(RelationshipInfo relationshipInfo, CapabilityDataDefinition cap) { - return cap.getName().equals(relationshipInfo.getCapability()) && - cap.getUniqueId().equals(relationshipInfo.getCapabilityUid()) && - cap.getOwnerId().equals(relationshipInfo.getCapabilityOwnerId()); + return cap.getName().equals(relationshipInfo.getCapability()) + && cap.getUniqueId().equals(relationshipInfo.getCapabilityUid()) + && cap.getOwnerId().equals(relationshipInfo.getCapabilityOwnerId()); + } + + private NodeTemplateOperation createTestSubject() { + return operation; + } + + + @Test + public void testGetDefaultHeatTimeout() throws Exception { + Integer result; + + // default test + result = NodeTemplateOperation.getDefaultHeatTimeout(); } + + + + + + + + + + + + + @Test + public void testPrepareInstDeploymentArtifactPerInstance() throws Exception { + NodeTemplateOperation testSubject; + Map<String, ArtifactDataDefinition> deploymentArtifacts = null; + String componentInstanceId = ""; + User user = null; + String envType = ""; + MapArtifactDataDefinition result; + + // test 1 + testSubject = createTestSubject(); + deploymentArtifacts = null; + result = testSubject.prepareInstDeploymentArtifactPerInstance(deploymentArtifacts, componentInstanceId, user, + envType); + Assert.assertEquals(null, result); + } + + + + @Test + public void testCreateCapPropertyKey() throws Exception { + String key = ""; + String instanceId = ""; + String result; + + // default test + result = NodeTemplateOperation.createCapPropertyKey(key, instanceId); + } + + + @Test + public void testPrepareCalculatedCapabiltyForNodeType() throws Exception { + NodeTemplateOperation testSubject; + Map<String, ListCapabilityDataDefinition> capabilities = null; + ComponentInstanceDataDefinition componentInstance = null; + MapListCapabiltyDataDefinition result; + + // test 1 + testSubject = createTestSubject(); + capabilities = null; + result = testSubject.prepareCalculatedCapabiltyForNodeType(capabilities, componentInstance); + Assert.assertEquals(null, result); + } + + + @Test + public void testPrepareCalculatedRequirementForNodeType() throws Exception { + NodeTemplateOperation testSubject; + Map<String, ListRequirementDataDefinition> requirements = null; + ComponentInstanceDataDefinition componentInstance = null; + MapListRequirementDataDefinition result; + + // test 1 + testSubject = createTestSubject(); + requirements = null; + result = testSubject.prepareCalculatedRequirementForNodeType(requirements, componentInstance); + Assert.assertEquals(null, result); + } + + + @Test + public void testAddGroupInstancesToComponentInstance() throws Exception { + NodeTemplateOperation testSubject; + Component containerComponent = null; + ComponentInstanceDataDefinition componentInstance = null; + List<GroupDefinition> groups = null; + Map<String, List<ArtifactDefinition>> groupInstancesArtifacts = null; + StorageOperationStatus result; + + // test 1 + testSubject = createTestSubject(); + groupInstancesArtifacts = null; + result = testSubject.addGroupInstancesToComponentInstance(containerComponent, componentInstance, groups, + groupInstancesArtifacts); + Assert.assertEquals(StorageOperationStatus.OK, result); + } + + @Test + public void testGenerateCustomizationUUIDOnInstanceGroup() throws Exception { + NodeTemplateOperation testSubject; + String componentId = ""; + String instanceId = ""; + List<String> groupInstances = null; + StorageOperationStatus result; + + // test 1 + testSubject = createTestSubject(); + groupInstances = null; + result = testSubject.generateCustomizationUUIDOnInstanceGroup(componentId, instanceId, groupInstances); + Assert.assertEquals(StorageOperationStatus.OK, result); + } + } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java new file mode 100644 index 0000000000..3429f1ea49 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java @@ -0,0 +1,39 @@ +package org.openecomp.sdc.be.model.jsontitan.utils; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; + +public class IdMapperTest { + + private IdMapper createTestSubject() { + return new IdMapper(); + } + + + @Test + public void testMapComponentNameToUniqueId() throws Exception { + IdMapper testSubject; + String componentInstanceName = ""; + GraphVertex serviceVertex = null; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.mapComponentNameToUniqueId(componentInstanceName, serviceVertex); + } + + + @Test + public void testMapUniqueIdToComponentNameTo() throws Exception { + IdMapper testSubject; + String compUniqueId = ""; + GraphVertex serviceVertex = null; + String result; + + // default test + testSubject = createTestSubject(); + result = testSubject.mapUniqueIdToComponentNameTo(compUniqueId, serviceVertex); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java new file mode 100644 index 0000000000..64c4cd792b --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java @@ -0,0 +1,72 @@ +package org.openecomp.sdc.be.model.jsontitan.utils; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.junit.Test; +import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.InterfaceDefinition; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.be.model.Resource; + +public class InterfaceUtilsTest { + + private InterfaceUtils createTestSubject() { + return new InterfaceUtils(); + } + + + @Test + public void testGetInterfaceDefinitionFromToscaName() throws Exception { + Collection<InterfaceDefinition> interfaces = null; + String resourceName = ""; + Optional<InterfaceDefinition> result; + + // default test + result = InterfaceUtils.getInterfaceDefinitionFromToscaName(interfaces, resourceName); + } + + + @Test + public void testGetInterfaceDefinitionListFromToscaName() throws Exception { + Collection<InterfaceDefinition> interfaces = null; + String resourceName = ""; + Collection<InterfaceDefinition> result; + + // default test + result = InterfaceUtils.getInterfaceDefinitionListFromToscaName(interfaces, resourceName); + } + + + @Test + public void testCreateInterfaceToscaResourceName() throws Exception { + String resourceName = ""; + String result; + + // default test + result = InterfaceUtils.createInterfaceToscaResourceName(resourceName); + } + + + @Test + public void testGetInterfaceOperationsFromInterfaces() throws Exception { + Map<String, InterfaceDefinition> interfaces = null; + Resource resource = null; + Map<String, Operation> result; + + // default test + result = InterfaceUtils.getInterfaceOperationsFromInterfaces(interfaces, resource); + } + + @Test + public void testGetOperationsFromInterface() throws Exception { + Map<String, InterfaceDefinition> interfaces = null; + List<Operation> result; + + // default test + result = InterfaceUtils.getOperationsFromInterface(interfaces); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java new file mode 100644 index 0000000000..bfefd00994 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java @@ -0,0 +1,89 @@ +package org.openecomp.sdc.be.model.operations.impl; + +import static org.junit.Assert.*; +import java.util.*; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +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.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.resources.data.AttributeData; +import org.openecomp.sdc.be.resources.data.AttributeValueData; +import org.openecomp.sdc.be.resources.data.ComponentInstanceData; + +import fj.data.Either; + +public class ComponentInstanceOperationTest { + + private ComponentInstanceOperation createTestSubject() { + return new ComponentInstanceOperation(); + } + + + @Test + public void testSetTitanGenericDao() throws Exception { + ComponentInstanceOperation testSubject; + TitanGenericDao titanGenericDao = null; + + // default test + testSubject = createTestSubject(); + testSubject.setTitanGenericDao(titanGenericDao); + } + + + + + + +// @Test +// public void testValidateElementExistInGraph() throws Exception { +// ComponentInstanceOperation testSubject; +// String elementUniqueId = ""; +// NodeTypeEnum elementNodeType = null; +// Supplier<Class<ElementData>> elementClassGen = null; +// Wrapper<ElementData> elementDataWrapper = null; +// Wrapper<TitanOperationStatus> errorWrapper = null; +// +// // default test +// testSubject = createTestSubject(); +// testSubject.validateElementExistInGraph(elementUniqueId, elementNodeType, elementClassGen, elementDataWrapper, +// errorWrapper); +// } + + + + + + + + + + + + + + + + @Test + public void testUpdateInputValueInResourceInstance() throws Exception { + ComponentInstanceOperation testSubject; + ComponentInstanceInput input = null; + String resourceInstanceId = ""; + boolean b = false; + Either<ComponentInstanceInput, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updateInputValueInResourceInstance(input, resourceInstanceId, b); + } + + + + + + +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java index e03349d9ab..1e493a74f4 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java @@ -20,26 +20,39 @@ package org.openecomp.sdc.be.model.operations.impl; +import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ArtifactType; import org.openecomp.sdc.be.model.ModelTestBase; +import org.openecomp.sdc.be.model.PropertyScope; +import org.openecomp.sdc.be.model.Tag; import org.openecomp.sdc.be.model.category.CategoryDefinition; +import org.openecomp.sdc.be.model.category.GroupingDefinition; +import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil; +import org.openecomp.sdc.be.resources.data.category.CategoryData; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import fj.data.Either; +import java.util.*; + +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Assert; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") @@ -87,11 +100,27 @@ public class ElementOperationTest extends ModelTestBase { artifactTypesCfg.add("type5"); } + @Test + public void testAllDeploymentArtifactTypes() { + + List<String> artifactTypesCfg = new ArrayList<String>(); + artifactTypesCfg.add("type1"); + artifactTypesCfg.add("type2"); + artifactTypesCfg.add("type3"); + configurationManager.getConfiguration().setArtifactTypes(artifactTypesCfg); + Either<Map<String, Object>, ActionStatus> allDeploymentArtifactTypes = elementOperation + .getAllDeploymentArtifactTypes(); + assertTrue(allDeploymentArtifactTypes.isLeft()); + assertEquals(artifactTypesCfg.size(), allDeploymentArtifactTypes.left().value().size()); + + } + // @Test public void testGetResourceAndServiceCategoty() { String id = OperationTestsUtil.deleteAndCreateResourceCategory(CATEGORY, SUBCATEGORY, titanDao); - Either<CategoryDefinition, ActionStatus> res = elementOperation.getCategory(NodeTypeEnum.ResourceNewCategory, id); + Either<CategoryDefinition, ActionStatus> res = elementOperation.getCategory(NodeTypeEnum.ResourceNewCategory, + id); assertTrue(res.isLeft()); CategoryDefinition categoryDefinition = (CategoryDefinition) res.left().value(); assertEquals(CATEGORY, categoryDefinition.getName()); @@ -104,4 +133,372 @@ public class ElementOperationTest extends ModelTestBase { categoryDefinition = (CategoryDefinition) res.left().value(); assertEquals(CATEGORY, categoryDefinition.getName()); } + + private ElementOperation createTestSubject() { + return new ElementOperation(new TitanGenericDao(new TitanGraphClient())); + } + + + @Test + public void testGetAllServiceCategories() throws Exception { + ElementOperation testSubject; + Either<List<CategoryDefinition>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllServiceCategories(); + } + + + @Test + public void testGetAllResourceCategories() throws Exception { + ElementOperation testSubject; + Either<List<CategoryDefinition>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllResourceCategories(); + } + + + @Test + public void testGetAllProductCategories() throws Exception { + ElementOperation testSubject; + Either<List<CategoryDefinition>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllProductCategories(); + } + + + @Test + public void testCreateCategory() throws Exception { + ElementOperation testSubject; + CategoryDefinition category = new CategoryDefinition(); + NodeTypeEnum nodeType = NodeTypeEnum.AdditionalInfoParameters; + Either<CategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createCategory(category, nodeType); + } + + + @Test + public void testCreateCategory_1() throws Exception { + ElementOperation testSubject; + CategoryDefinition category = new CategoryDefinition(); + NodeTypeEnum nodeType = NodeTypeEnum.ArtifactRef; + boolean inTransaction = false; + Either<CategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createCategory(category, nodeType, inTransaction); + } + + + @Test + public void testCreateSubCategory() throws Exception { + ElementOperation testSubject; + String categoryId = ""; + SubCategoryDefinition subCategory = null; + NodeTypeEnum nodeType = null; + Either<SubCategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createSubCategory(categoryId, subCategory, nodeType); + } + + + @Test + public void testCreateSubCategory_1() throws Exception { + ElementOperation testSubject; + String categoryId = ""; + SubCategoryDefinition subCategory = null; + NodeTypeEnum nodeType = null; + boolean inTransaction = false; + Either<SubCategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createSubCategory(categoryId, subCategory, nodeType, inTransaction); + } + + + @Test + public void testCreateGrouping() throws Exception { + ElementOperation testSubject; + String subCategoryId = ""; + GroupingDefinition grouping = null; + NodeTypeEnum nodeType = null; + Either<GroupingDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.createGrouping(subCategoryId, grouping, nodeType); + } + + + @Test + public void testGetAllCategories() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = NodeTypeEnum.Capability; + boolean inTransaction = false; + Either<List<CategoryDefinition>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllCategories(nodeType, inTransaction); + } + + + + + + + + + + @Test + public void testGetCategory() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = NodeTypeEnum.CapabilityType; + String categoryId = ""; + Either<CategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getCategory(nodeType, categoryId); + } + + + @Test + public void testGetSubCategory() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = NodeTypeEnum.Group; + String subCategoryId = ""; + Either<SubCategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategory(nodeType, subCategoryId); + } + + + @Test + public void testDeleteCategory() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = NodeTypeEnum.getByName("resource"); + String categoryId = ""; + Either<CategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteCategory(nodeType, categoryId); + } + + + @Test + public void testDeleteSubCategory() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = NodeTypeEnum.Attribute; + String subCategoryId = ""; + Either<SubCategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteSubCategory(nodeType, subCategoryId); + } + + + @Test + public void testDeleteGrouping() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = NodeTypeEnum.DataType; + String groupingId = ""; + Either<GroupingDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteGrouping(nodeType, groupingId); + } + + + @Test + public void testIsCategoryUniqueForType() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = null; + String normalizedName = ""; + Either<Boolean, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isCategoryUniqueForType(nodeType, normalizedName); + } + + + @Test + public void testIsSubCategoryUniqueForCategory() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = null; + String subCategoryNormName = ""; + String parentCategoryId = ""; + Either<Boolean, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isSubCategoryUniqueForCategory(nodeType, subCategoryNormName, parentCategoryId); + } + + + @Test + public void testIsGroupingUniqueForSubCategory() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = null; + String groupingNormName = ""; + String parentSubCategoryId = ""; + Either<Boolean, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isGroupingUniqueForSubCategory(nodeType, groupingNormName, parentSubCategoryId); + } + + + @Test + public void testGetSubCategoryUniqueForType() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = null; + String normalizedName = ""; + Either<SubCategoryDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getSubCategoryUniqueForType(nodeType, normalizedName); + } + + + @Test + public void testGetGroupingUniqueForType() throws Exception { + ElementOperation testSubject; + NodeTypeEnum nodeType = null; + String groupingNormalizedName = ""; + Either<GroupingDefinition, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getGroupingUniqueForType(nodeType, groupingNormalizedName); + } + + + @Test + public void testGetAllTags() throws Exception { + ElementOperation testSubject; + Either<List<Tag>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllTags(); + } + + + @Test + public void testGetCategoryData() throws Exception { + ElementOperation testSubject; + String name = ""; + NodeTypeEnum type = NodeTypeEnum.DataType; + Class<T> clazz = null; + Either<org.openecomp.sdc.be.resources.data.CategoryData, StorageOperationStatus> result; + + // test 1 + testSubject = createTestSubject(); + name = null; + result = testSubject.getCategoryData(name, type, null); + + // test 2 + testSubject = createTestSubject(); + name = ""; + result = testSubject.getCategoryData(name, type, null); + } + + + + + + @Test + public void testGetAllPropertyScopes() throws Exception { + ElementOperation testSubject; + Either<List<PropertyScope>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllPropertyScopes(); + } + + + @Test + public void testGetAllArtifactTypes() throws Exception { + ElementOperation testSubject; + Either<List<ArtifactType>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllArtifactTypes(); + } + + + @Test + public void testGetAllDeploymentArtifactTypes() throws Exception { + ElementOperation testSubject; + Either<Map<String, Object>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllDeploymentArtifactTypes(); + } + + + @Test + public void testGetDefaultHeatTimeout() throws Exception { + ElementOperation testSubject; + Either<Integer, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDefaultHeatTimeout(); + } + + + @Test + public void testGetResourceTypesMap() throws Exception { + ElementOperation testSubject; + Either<Map<String, String>, ActionStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getResourceTypesMap(); + } + + + @Test + public void testGetNewCategoryData() throws Exception { + ElementOperation testSubject; + String name = ""; + NodeTypeEnum type = NodeTypeEnum.HeatParameter; + Class<T> clazz = null; + Either<CategoryData, StorageOperationStatus> result; + + // test 1 + testSubject = createTestSubject(); + name = null; + result = testSubject.getNewCategoryData(name, type, null); + + // test 2 + testSubject = createTestSubject(); + name = ""; + result = testSubject.getNewCategoryData(name, type, null); + } } diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java index 88f3a24b5d..c3e23ba001 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java @@ -20,35 +20,56 @@ package org.openecomp.sdc.be.model.operations.impl; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.tinkerpop.gremlin.structure.T; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.IComplexDefaultValue; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.operations.api.DerivedFromOperation; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.ToscaType; import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint; import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint; import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint; +import org.openecomp.sdc.be.resources.data.DataTypeData; +import org.openecomp.sdc.be.resources.data.PropertyData; +import org.openecomp.sdc.be.resources.data.PropertyValueData; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import com.thinkaurelius.titan.core.TitanVertex; -import static org.junit.Assert.*; +import fj.data.Either; public class PropertyOperationTest extends ModelTestBase { TitanGenericDao titanGenericDao = Mockito.mock(TitanGenericDao.class); - + PropertyOperation propertyOperation = new PropertyOperation(titanGenericDao, null); @Before @@ -60,28 +81,46 @@ public class PropertyOperationTest extends ModelTestBase { /* * @Test public void addPropertyToResourceTest() { * - * String propName = "myProp"; PropertyDefinition property = buildPropertyDefinition(); List<PropertyConstraint> constraints = buildConstraints(); property.setConstraints(constraints); + * String propName = "myProp"; PropertyDefinition property = + * buildPropertyDefinition(); List<PropertyConstraint> constraints = + * buildConstraints(); property.setConstraints(constraints); * - * PropertyData propertyData = new PropertyData(property, propertyOperation.convertConstraintsToString(constraints)); + * PropertyData propertyData = new PropertyData(property, + * propertyOperation.convertConstraintsToString(constraints)); * - * Either<PropertyData, TitanOperationStatus> either = Either.left(propertyData); //when(propertyDao.create((GraphNeighbourTable)anyObject(), eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); GraphRelation graphRelation = - * new GraphRelation(); Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation); + * Either<PropertyData, TitanOperationStatus> either = + * Either.left(propertyData); + * //when(propertyDao.create((GraphNeighbourTable)anyObject(), + * eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); + * GraphRelation graphRelation = new GraphRelation(); Either<GraphRelation, + * TitanOperationStatus> relationResult = Either.left(graphRelation); * - * when(titanGenericDao.createNode((PropertyData)anyObject(), eq(PropertyData.class))).thenReturn(either); when(titanGenericDao.createRelation((GraphNode)anyObject(), (GraphNode)anyObject(), eq(GraphEdgeLabels.PROPERTY), + * when(titanGenericDao.createNode((PropertyData)anyObject(), + * eq(PropertyData.class))).thenReturn(either); + * when(titanGenericDao.createRelation((GraphNode)anyObject(), + * (GraphNode)anyObject(), eq(GraphEdgeLabels.PROPERTY), * anyMap())).thenReturn(relationResult); * - * Either<PropertyDefinition, StorageOperationStatus> result = propertyOperation.addPropertyToResource(propName, property, NodeTypeEnum.Resource, "my-resource.1.0"); + * Either<PropertyDefinition, StorageOperationStatus> result = + * propertyOperation.addPropertyToResource(propName, property, + * NodeTypeEnum.Resource, "my-resource.1.0"); * - * assertTrue(result.isLeft()); System.out.println(result.left().value()); PropertyDefinition propertyDefinition = result.left().value(); + * assertTrue(result.isLeft()); System.out.println(result.left().value()); + * PropertyDefinition propertyDefinition = result.left().value(); * - * List<PropertyConstraint> originalConstraints = property.getConstraints(); List<PropertyConstraint> propertyConstraintsResult = propertyDefinition.getConstraints(); assertEquals(propertyConstraintsResult.size(), originalConstraints.size()); + * List<PropertyConstraint> originalConstraints = property.getConstraints(); + * List<PropertyConstraint> propertyConstraintsResult = + * propertyDefinition.getConstraints(); + * assertEquals(propertyConstraintsResult.size(), + * originalConstraints.size()); * * } */ private PropertyDefinition buildPropertyDefinition() { PropertyDefinition property = new PropertyDefinition(); property.setDefaultValue("10"); - property.setDescription("Size of the local disk, in Gigabytes (GB), available to applications running on the Compute node."); + property.setDescription( + "Size of the local disk, in Gigabytes (GB), available to applications running on the Compute node."); property.setType(ToscaType.INTEGER.name().toLowerCase()); return property; } @@ -147,7 +186,8 @@ public class PropertyOperationTest extends ModelTestBase { List<String> convertedStringConstraints = propertyOperation.convertConstraintsToString(constraints); assertEquals("constraints size", constraints.size(), convertedStringConstraints.size()); - List<PropertyConstraint> convertedConstraints = propertyOperation.convertConstraints(convertedStringConstraints); + List<PropertyConstraint> convertedConstraints = propertyOperation + .convertConstraints(convertedStringConstraints); assertEquals("check size of constraints", constraints.size(), convertedConstraints.size()); Set<String> constraintsClasses = new HashSet<String>(); @@ -156,7 +196,8 @@ public class PropertyOperationTest extends ModelTestBase { } for (PropertyConstraint propertyConstraint : convertedConstraints) { - assertTrue("check all classes generated", constraintsClasses.contains(propertyConstraint.getClass().getName())); + assertTrue("check all classes generated", + constraintsClasses.contains(propertyConstraint.getClass().getName())); } } @@ -288,7 +329,8 @@ public class PropertyOperationTest extends ModelTestBase { assertEquals("check value", "v1node1", instanceProperty.getValue()); assertEquals("check default value", "v1node3", instanceProperty.getDefaultValue()); - assertEquals("check valid unique id", instanceProperty1.getValueUniqueUid(), instanceProperty.getValueUniqueUid()); + assertEquals("check valid unique id", instanceProperty1.getValueUniqueUid(), + instanceProperty.getValueUniqueUid()); } @@ -507,6 +549,664 @@ public class PropertyOperationTest extends ModelTestBase { } + private PropertyOperation createTestSubject() { + return new PropertyOperation(new TitanGenericDao(new TitanGraphClient()), null); + } + + + @Test + public void testMain() throws Exception { + String[] args = new String[] { "" }; + + // default test + PropertyOperation.main(args); + } + + + @Test + public void testConvertPropertyDataToPropertyDefinition() throws Exception { + PropertyOperation testSubject; + PropertyData propertyDataResult = new PropertyData(); + String propertyName = ""; + String resourceId = ""; + PropertyDefinition result; + + // default test + testSubject = createTestSubject(); + result = testSubject.convertPropertyDataToPropertyDefinition(propertyDataResult, propertyName, resourceId); + } + + + @Test + public void testAddPropertiesToGraph() throws Exception { + PropertyOperation testSubject; + Map<String, PropertyDefinition> properties = null; + String resourceId = ""; + Map<String, DataTypeDefinition> dataTypes = null; + TitanOperationStatus result; + + // test 1 + testSubject = createTestSubject(); + properties = null; + result = testSubject.addPropertiesToGraph(properties, resourceId, dataTypes); + } + + + @Test + public void testAddPropertiesToGraph_1() throws Exception { + PropertyOperation testSubject; + TitanVertex metadataVertex = null; + Map<String, PropertyDefinition> properties = null; + Map<String, DataTypeDefinition> dataTypes = null; + String resourceId = ""; + TitanOperationStatus result; + + // test 1 + testSubject = createTestSubject(); + properties = null; + result = testSubject.addPropertiesToGraph(metadataVertex, properties, dataTypes, resourceId); + } + + + @Test + public void testAddProperty() throws Exception { + PropertyOperation testSubject; + String propertyName = ""; + PropertyDefinition propertyDefinition = new PropertyDefinition(); + String resourceId = ""; + Either<PropertyData, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addProperty(propertyName, propertyDefinition, resourceId); + } + + + @Test + public void testValidateAndUpdateProperty() throws Exception { + PropertyOperation testSubject; + IComplexDefaultValue propertyDefinition = new PropertyDefinition(); + Map<String, DataTypeDefinition> dataTypes = new HashMap<>(); + dataTypes.put("", new DataTypeDefinition()); + StorageOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateAndUpdateProperty(propertyDefinition, dataTypes); + } + + + @Test + public void testAddPropertyToGraph() throws Exception { + PropertyOperation testSubject; + String propertyName = ""; + PropertyDefinition propertyDefinition = new PropertyDefinition(); + String resourceId = ""; + Either<PropertyData, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addPropertyToGraph(propertyName, propertyDefinition, resourceId); + } + + + @Test + public void testAddPropertyToGraphByVertex() throws Exception { + PropertyOperation testSubject; + TitanVertex metadataVertex = null; + String propertyName = ""; + PropertyDefinition propertyDefinition = new PropertyDefinition(); + String resourceId = ""; + TitanOperationStatus result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addPropertyToGraphByVertex(metadataVertex, propertyName, propertyDefinition, resourceId); + } + + + @Test + public void testGetTitanGenericDao() throws Exception { + PropertyOperation testSubject; + TitanGenericDao result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getTitanGenericDao(); + } + + + @Test + public void testDeleteProperty() throws Exception { + PropertyOperation testSubject; + String propertyId = ""; + Either<PropertyData, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteProperty(propertyId); + } + + + @Test + public void testDeletePropertyFromGraph() throws Exception { + PropertyOperation testSubject; + String propertyId = ""; + Either<PropertyData, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deletePropertyFromGraph(propertyId); + } + + + @Test + public void testUpdateProperty() throws Exception { + PropertyOperation testSubject; + String propertyId = ""; + PropertyDefinition newPropertyDefinition = new PropertyDefinition(); + Map<String, DataTypeDefinition> dataTypes = new HashMap<>(); + Either<PropertyData, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updateProperty(propertyId, newPropertyDefinition, dataTypes); + } + + + @Test + public void testUpdatePropertyFromGraph() throws Exception { + PropertyOperation testSubject; + String propertyId = ""; + PropertyDefinition propertyDefinition = null; + Either<PropertyData, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updatePropertyFromGraph(propertyId, propertyDefinition); + } + + + @Test + public void testSetTitanGenericDao() throws Exception { + PropertyOperation testSubject; + TitanGenericDao titanGenericDao = null; + + // default test + testSubject = createTestSubject(); + testSubject.setTitanGenericDao(titanGenericDao); + } + + + @Test + public void testAddPropertyToNodeType() throws Exception { + PropertyOperation testSubject; + String propertyName = ""; + PropertyDefinition propertyDefinition = new PropertyDefinition(); + NodeTypeEnum nodeType = NodeTypeEnum.Attribute; + String uniqueId = ""; + Either<PropertyData, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addPropertyToNodeType(propertyName, propertyDefinition, nodeType, uniqueId); + } + + + @Test + public void testFindPropertiesOfNode() throws Exception { + PropertyOperation testSubject; + NodeTypeEnum nodeType = null; + String uniqueId = ""; + Either<Map<String, PropertyDefinition>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.findPropertiesOfNode(nodeType, uniqueId); + } + + + @Test + public void testDeletePropertiesAssociatedToNode() throws Exception { + PropertyOperation testSubject; + NodeTypeEnum nodeType = null; + String uniqueId = ""; + Either<Map<String, PropertyDefinition>, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deletePropertiesAssociatedToNode(nodeType, uniqueId); + } + + + @Test + public void testDeleteAllPropertiesAssociatedToNode() throws Exception { + PropertyOperation testSubject; + NodeTypeEnum nodeType = null; + String uniqueId = ""; + Either<Map<String, PropertyDefinition>, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.deleteAllPropertiesAssociatedToNode(nodeType, uniqueId); + } + + + @Test + public void testIsPropertyExist() throws Exception { + PropertyOperation testSubject; + List<PropertyDefinition> properties = null; + String resourceUid = ""; + String propertyName = ""; + String propertyType = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isPropertyExist(properties, resourceUid, propertyName, propertyType); + } + + + @Test + public void testValidateAndUpdateRules() throws Exception { + PropertyOperation testSubject; + String propertyType = ""; + List<PropertyRule> rules = null; + String innerType = ""; + Map<String, DataTypeDefinition> dataTypes = null; + boolean isValidate = false; + ImmutablePair<String, Boolean> result; + + // test 1 + testSubject = createTestSubject(); + rules = null; + result = testSubject.validateAndUpdateRules(propertyType, rules, innerType, dataTypes, isValidate); + } + + + @Test + public void testAddRulesToNewPropertyValue() throws Exception { + PropertyOperation testSubject; + PropertyValueData propertyValueData = new PropertyValueData(); + ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty(); + String resourceInstanceId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.addRulesToNewPropertyValue(propertyValueData, resourceInstanceProperty, resourceInstanceId); + } + + + @Test + public void testFindPropertyValue() throws Exception { + PropertyOperation testSubject; + String resourceInstanceId = ""; + String propertyId = ""; + ImmutablePair<TitanOperationStatus, String> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.findPropertyValue(resourceInstanceId, propertyId); + } + + + @Test + public void testUpdateRulesInPropertyValue() throws Exception { + PropertyOperation testSubject; + PropertyValueData propertyValueData = new PropertyValueData(); + ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty(); + String resourceInstanceId = ""; + + // default test + testSubject = createTestSubject(); + testSubject.updateRulesInPropertyValue(propertyValueData, resourceInstanceProperty, resourceInstanceId); + } + + + @Test + public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId() throws Exception { + PropertyOperation testSubject; + String resourceInstanceUid = ""; + Either<List<ComponentInstanceProperty>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid); + } + + + @Test + public void testRemovePropertyOfResourceInstance() throws Exception { + PropertyOperation testSubject; + String propertyValueUid = ""; + String resourceInstanceId = ""; + Either<PropertyValueData, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.removePropertyOfResourceInstance(propertyValueUid, resourceInstanceId); + } + + + @Test + public void testRemovePropertyValueFromResourceInstance() throws Exception { + PropertyOperation testSubject; + String propertyValueUid = ""; + String resourceInstanceId = ""; + boolean inTransaction = false; + Either<ComponentInstanceProperty, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.removePropertyValueFromResourceInstance(propertyValueUid, resourceInstanceId, + inTransaction); + } + + + @Test + public void testBuildResourceInstanceProperty() throws Exception { + PropertyOperation testSubject; + PropertyValueData propertyValueData = new PropertyValueData(); + ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty(); + ComponentInstanceProperty result; + + // default test + testSubject = createTestSubject(); + result = testSubject.buildResourceInstanceProperty(propertyValueData, resourceInstanceProperty); + } + + + @Test + public void testIsPropertyDefaultValueValid() throws Exception { + PropertyOperation testSubject; + IComplexDefaultValue propertyDefinition = null; + Map<String, DataTypeDefinition> dataTypes = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + propertyDefinition = null; + result = testSubject.isPropertyDefaultValueValid(propertyDefinition, dataTypes); + Assert.assertEquals(false, result); + } + + + @Test + public void testIsPropertyTypeValid() throws Exception { + PropertyOperation testSubject; + IComplexDefaultValue property = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + property = null; + result = testSubject.isPropertyTypeValid(property); + Assert.assertEquals(false, result); + } + + + @Test + public void testIsPropertyInnerTypeValid() throws Exception { + PropertyOperation testSubject; + IComplexDefaultValue property = null; + Map<String, DataTypeDefinition> dataTypes = null; + ImmutablePair<String, Boolean> result; + + // test 1 + testSubject = createTestSubject(); + property = null; + result = testSubject.isPropertyInnerTypeValid(property, dataTypes); + } + + + @Test + public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId_1() throws Exception { + PropertyOperation testSubject; + String resourceInstanceUid = ""; + NodeTypeEnum instanceNodeType = null; + Either<List<ComponentInstanceProperty>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid, instanceNodeType); + } + + + @Test + public void testFindDefaultValueFromSecondPosition() throws Exception { + PropertyOperation testSubject; + List<String> pathOfComponentInstances = null; + String propertyUniqueId = ""; + String defaultValue = ""; + Either<String, TitanOperationStatus> result; + + // test 1 + testSubject = createTestSubject(); + pathOfComponentInstances = null; + result = testSubject.findDefaultValueFromSecondPosition(pathOfComponentInstances, propertyUniqueId, + defaultValue); + } + + + @Test + public void testUpdatePropertyByBestMatch() throws Exception { + PropertyOperation testSubject; + String propertyUniqueId = ""; + ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty(); + List<String> path = new ArrayList<>(); + path.add("path"); + instanceProperty.setPath(path); + Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>(); + instanceIdToValue.put("123", instanceProperty); + + // default test + testSubject = createTestSubject(); + testSubject.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue); + } + + + @Test + public void testGetDataTypeByUid() throws Exception { + PropertyOperation testSubject; + String uniqueId = ""; + Either<DataTypeDefinition, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDataTypeByUid(uniqueId); + } + + + @Test + public void testAddDataType() throws Exception { + PropertyOperation testSubject; + DataTypeDefinition dataTypeDefinition = new DataTypeDefinition(); + Either<DataTypeDefinition, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.addDataType(dataTypeDefinition); + } + + + @Test + public void testGetDataTypeByName() throws Exception { + PropertyOperation testSubject; + String name = ""; + boolean inTransaction = false; + Either<DataTypeDefinition, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDataTypeByName(name, inTransaction); + } + + + @Test + public void testGetDataTypeByName_1() throws Exception { + PropertyOperation testSubject; + String name = ""; + Either<DataTypeDefinition, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDataTypeByName(name); + } + + + @Test + public void testGetDataTypeByNameWithoutDerived() throws Exception { + PropertyOperation testSubject; + String name = ""; + Either<DataTypeDefinition, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDataTypeByNameWithoutDerived(name); + } + + + @Test + public void testGetDataTypeByUidWithoutDerivedDataTypes() throws Exception { + PropertyOperation testSubject; + String uniqueId = ""; + Either<DataTypeDefinition, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getDataTypeByUidWithoutDerivedDataTypes(uniqueId); + } + + + @Test + public void testIsDefinedInDataTypes() throws Exception { + PropertyOperation testSubject; + String propertyType = ""; + Either<Boolean, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isDefinedInDataTypes(propertyType); + } + + + @Test + public void testGetAllDataTypes() throws Exception { + PropertyOperation testSubject; + Either<Map<String, DataTypeDefinition>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllDataTypes(); + } + + + @Test + public void testCheckInnerType() throws Exception { + PropertyOperation testSubject; + PropertyDataDefinition propDataDef = new PropertyDataDefinition(); + Either<String, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.checkInnerType(propDataDef); + } + + + @Test + public void testGetAllDataTypeNodes() throws Exception { + PropertyOperation testSubject; + Either<List<DataTypeData>, TitanOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.getAllDataTypeNodes(); + } + + + @Test + public void testValidateAndUpdatePropertyValue() throws Exception { + PropertyOperation testSubject; + String propertyType = ""; + String value = ""; + boolean isValidate = false; + String innerType = ""; + Map<String, DataTypeDefinition> dataTypes = null; + Either<Object, Boolean> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateAndUpdatePropertyValue(propertyType, value, isValidate, innerType, dataTypes); + } + + + @Test + public void testValidateAndUpdatePropertyValue_1() throws Exception { + PropertyOperation testSubject; + String propertyType = ""; + String value = ""; + String innerType = ""; + Map<String, DataTypeDefinition> dataTypes = new HashMap<>(); + dataTypes.put("", new DataTypeDefinition()); + Either<Object, Boolean> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.validateAndUpdatePropertyValue(propertyType, value, innerType, dataTypes); + } + + + + + + @Test + public void testAddPropertiesToElementType() throws Exception { + PropertyOperation testSubject; + String uniqueId = ""; + NodeTypeEnum elementType = null; + List<PropertyDefinition> properties = null; + Either<Map<String, PropertyData>, TitanOperationStatus> result; + + // test 1 + testSubject = createTestSubject(); + properties = null; + result = testSubject.addPropertiesToElementType(uniqueId, elementType, properties); + } + + + @Test + public void testUpdateDataType() throws Exception { + PropertyOperation testSubject; + DataTypeDefinition newDataTypeDefinition = new DataTypeDefinition(); + DataTypeDefinition oldDataTypeDefinition = new DataTypeDefinition(); + Either<DataTypeDefinition, StorageOperationStatus> result; + + // default test + testSubject = createTestSubject(); + result = testSubject.updateDataType(newDataTypeDefinition, oldDataTypeDefinition); + } + + + @Test + public void testIsValueToscaFunction() throws Exception { + PropertyOperation testSubject; + String type = ""; + String value = ""; + boolean result; + + // test 1 + testSubject = createTestSubject(); + value = null; + result = testSubject.isValueToscaFunction(type, value); + Assert.assertEquals(false, result); + + // test 2 + testSubject = createTestSubject(); + value = ""; + result = testSubject.isValueToscaFunction(type, value); + Assert.assertEquals(false, result); + } + // add all rule types // add rule with size = 1(instance itself = ALL). relevant for VLi. equals // to X.*.*.* in all paths size diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java new file mode 100644 index 0000000000..877c7c40eb --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java @@ -0,0 +1,41 @@ +package org.openecomp.sdc.be.model.tosca.constraints; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.model.tosca.ToscaType; +import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil.ConstraintInformation; + +public class ConstraintUtilTest { + + @Test + public void testCheckStringType() throws Exception { + ToscaType propertyType = ToscaType.STRING; + + // default test + ConstraintUtil.checkStringType(propertyType); + } + + + @Test + public void testCheckComparableType() throws Exception { + ToscaType propertyType = ToscaType.INTEGER; + + // default test + ConstraintUtil.checkComparableType(propertyType); + } + + + @Test + public void testConvertToComparable() throws Exception { + ToscaType propertyType = ToscaType.BOOLEAN; + String value = ""; + Comparable result; + + // default test + result = ConstraintUtil.convertToComparable(propertyType, value); + } + + + +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java new file mode 100644 index 0000000000..d86f7f43f7 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java @@ -0,0 +1,45 @@ +package org.openecomp.sdc.be.model.tosca.converters; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.model.DataTypeDefinition; + +public class LowerCaseConverterTest { + + private LowerCaseConverter createTestSubject() { + return LowerCaseConverter.getInstance(); + } + + + @Test + public void testConvert() throws Exception { + LowerCaseConverter testSubject; + String value = ""; + String innerType = ""; + Map<String, DataTypeDefinition> dataTypes = null; + String result; + + // test 1 + testSubject = createTestSubject(); + value = null; + result = testSubject.convert(value, innerType, dataTypes); + + // test 2 + testSubject = createTestSubject(); + value = ""; + result = testSubject.convert(value, innerType, dataTypes); + } + + + @Test + public void testGetInstance() throws Exception { + LowerCaseConverter result; + + // default test + result = LowerCaseConverter.getInstance(); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java new file mode 100644 index 0000000000..02d8ed6632 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.be.model.tosca.converters; + +import static org.junit.Assert.*; +import java.util.*; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.model.DataTypeDefinition; + +import com.google.gson.JsonElement; + +public class ToscaMapValueConverterTest { + + private ToscaMapValueConverter createTestSubject() { + return ToscaMapValueConverter.getInstance(); + } + + + @Test + public void testGetInstance() throws Exception { + ToscaMapValueConverter result; + + // default test + result = ToscaMapValueConverter.getInstance(); + } + + +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java new file mode 100644 index 0000000000..c1a99e754a --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java @@ -0,0 +1,58 @@ +package org.openecomp.sdc.be.model.tosca.validators; + +import java.util.Map; + +import javax.annotation.Generated; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.be.model.DataTypeDefinition; + +public class ToscaBooleanValidatorTest { + + private ToscaBooleanValidator createTestSubject() { + return ToscaBooleanValidator.getInstance(); + } + + + @Test + public void testGetInstance() throws Exception { + ToscaBooleanValidator result; + + // default test + result = ToscaBooleanValidator.getInstance(); + } + + + @Test + public void testIsValid() throws Exception { + ToscaBooleanValidator testSubject; + String value = ""; + String innerType = ""; + Map<String, DataTypeDefinition> dataTypes = null; + boolean result; + + // test 1 + testSubject = createTestSubject(); + value = null; + result = testSubject.isValid(value, innerType, dataTypes); + + // test 2 + testSubject = createTestSubject(); + value = ""; + result = testSubject.isValid(value, innerType, dataTypes); + } + + + @Test + public void testIsValid_1() throws Exception { + ToscaBooleanValidator testSubject; + String value = ""; + String innerType = ""; + boolean result; + + // default test + testSubject = createTestSubject(); + result = testSubject.isValid(value, innerType); + } +}
\ No newline at end of file diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java new file mode 100644 index 0000000000..380111dc77 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java @@ -0,0 +1,179 @@ +package org.openecomp.sdc.be.unittests.utils; + +import java.util.List; + +import javax.annotation.Generated; + +import org.junit.Test; +import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.resources.data.CapabilityData; +import org.openecomp.sdc.be.resources.data.CapabilityInstData; +import org.openecomp.sdc.be.resources.data.PropertyData; +import org.openecomp.sdc.be.resources.data.PropertyValueData; +import org.openecomp.sdc.be.resources.data.RequirementData; +import org.openecomp.sdc.be.resources.data.ResourceMetadataData; + +public class FactoryUtilsTest { + +// private FactoryUtils createTestSubject() { +// return FactoryUtils.Constants; +// } + + + @Test + public void testCreateVFWithRI() throws Exception { + String riVersion = ""; + Resource result; + + // default test + result = FactoryUtils.createVFWithRI(riVersion); + } + + + @Test + public void testCreateVF() throws Exception { + Resource result; + + // default test + result = FactoryUtils.createVF(); + } + + + @Test + public void testCreateResourceByType() throws Exception { + String resourceType = ""; + ResourceMetadataData result; + + // default test + result = FactoryUtils.createResourceByType(resourceType); + } + + + @Test + public void testAddComponentInstanceToVF() throws Exception { + Resource vf = new Resource(); + ComponentInstance resourceInstance = null; + + // default test + FactoryUtils.addComponentInstanceToVF(vf, resourceInstance); + } + + + @Test + public void testCreateResourceInstance() throws Exception { + ComponentInstance result; + + // default test + result = FactoryUtils.createResourceInstance(); + } + + + @Test + public void testCreateResourceInstanceWithVersion() throws Exception { + String riVersion = ""; + ComponentInstance result; + + // default test + result = FactoryUtils.createResourceInstanceWithVersion(riVersion); + } + + + @Test + public void testCreateCapabilityData() throws Exception { + CapabilityData result; + + // default test + result = FactoryUtils.createCapabilityData(); + } + + + @Test + public void testCreateRequirementData() throws Exception { + RequirementData result; + + // default test + result = FactoryUtils.createRequirementData(); + } + + + @Test + public void testConvertCapabilityDataToCapabilityDefinitionAddProperties() throws Exception { + CapabilityData capData = new CapabilityData(); + CapabilityDefinition result; + + // default test + result = FactoryUtils.convertCapabilityDataToCapabilityDefinitionAddProperties(capData); + } + + + @Test + public void testCreateComponentInstancePropertyList() throws Exception { + List<ComponentInstanceProperty> result; + + // default test + result = FactoryUtils.createComponentInstancePropertyList(); + } + + + @Test + public void testConvertRequirementDataIDToRequirementDefinition() throws Exception { + String reqDataId = ""; + RequirementDefinition result; + + // default test + result = FactoryUtils.convertRequirementDataIDToRequirementDefinition(reqDataId); + } + + + @Test + public void testCreateGraphEdge() throws Exception { + GraphEdge result; + + // default test + result = FactoryUtils.createGraphEdge(); + } + + + @Test + public void testCreateCapabilityInstData() throws Exception { + CapabilityInstData result; + + // default test + result = FactoryUtils.createCapabilityInstData(); + } + + + @Test + public void testCreatePropertyData() throws Exception { + PropertyValueData result; + + // default test + result = FactoryUtils.createPropertyData(); + } + + + @Test + public void testConvertCapabilityDefinitionToCapabilityData() throws Exception { + PropertyDefinition propDef = new PropertyDefinition(); + PropertyData result; + + // default test + result = FactoryUtils.convertCapabilityDefinitionToCapabilityData(propDef); + } + + + @Test + public void testConvertCapabilityDataToCapabilityDefinitionRoot() throws Exception { + CapabilityData capData = new CapabilityData(); + CapabilityDefinition result; + + // default test + result = FactoryUtils.convertCapabilityDataToCapabilityDefinitionRoot(capData); + } +}
\ No newline at end of file |