summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2018-05-10 11:13:25 +0300
committerYuli Shlosberg <ys9693@att.com>2018-05-10 11:14:25 +0300
commit9597e97eddcc9b5ea3376fb8d49b02fe42f5d820 (patch)
treec75953aeb46b2cb800a941d807ea78fcab4a462d
parentf9561f8b5a361fa027a162aef697e5c0115c1415 (diff)
new unit tests for sdc-model
Change-Id: Ie4cdc54ae829832b4092b249b467f5b9b4b756b6 Issue-ID: SDC-1302 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java81
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java93
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java827
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java136
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/LifeCycleTransitionEnumTest.java42
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ModelTestBase.java1
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperationTest.java235
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/IdMapperTest.java39
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsontitan/utils/InterfaceUtilsTest.java72
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java89
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java399
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java742
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtilTest.java41
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/LowerCaseConverterTest.java45
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/converters/ToscaMapValueConverterTest.java27
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/tosca/validators/ToscaBooleanValidatorTest.java58
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/unittests/utils/FactoryUtilsTest.java179
-rw-r--r--catalog-model/src/test/resources/config/configuration.yaml677
18 files changed, 3222 insertions, 561 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
new file mode 100644
index 0000000000..9b196e55ef
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilderTest.java
@@ -0,0 +1,81 @@
+package org.openecomp.sdc.be.components.distribution.engine;
+
+import javax.annotation.Generated;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
+
+public class ServiceDistributionArtifactsBuilderTest {
+
+ private ServiceDistributionArtifactsBuilder createTestSubject() {
+ return new ServiceDistributionArtifactsBuilder();
+ }
+
+
+ @Test
+ public void testBuildResourceInstanceArtifactUrl() throws Exception {
+ Service service = new Service();
+ ComponentInstance resourceInstance = new ComponentInstance();
+ String artifactName = "";
+ String result;
+
+ // default test
+ result = ServiceDistributionArtifactsBuilder.buildResourceInstanceArtifactUrl(service, resourceInstance,
+ artifactName);
+ }
+
+
+
+
+ @Test
+ public void testBuildServiceArtifactUrl() throws Exception {
+ Service service = new Service();;
+ String artifactName = "";
+ String result;
+
+ // default test
+ result = ServiceDistributionArtifactsBuilder.buildServiceArtifactUrl(service, artifactName);
+ }
+
+
+
+
+
+ @Test
+ public void testGetInterfaceLifecycleOperation() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ InterfaceLifecycleOperation result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getInterfaceLifecycleOperation();
+ }
+
+
+ @Test
+ public void testSetInterfaceLifecycleOperation() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ InterfaceLifecycleOperation interfaceLifecycleOperation = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setInterfaceLifecycleOperation(interfaceLifecycleOperation);
+ }
+
+
+ @Test
+ public void testVerifyServiceContainsDeploymentArtifacts() throws Exception {
+ ServiceDistributionArtifactsBuilder testSubject;
+ Service service = new Service();;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.verifyServiceContainsDeploymentArtifacts(service);
+ }
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java
index e2fceddcf6..a7529ed614 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogicTest.java
@@ -12,6 +12,8 @@ import org.openecomp.sdc.be.model.operations.api.IElementOperation;
import org.openecomp.sdc.exception.ResponseFormat;
import fj.data.Either;
+import java.util.*;
+import org.junit.Assert;
public class AdditionalInformationBusinessLogicTest {
@@ -22,16 +24,6 @@ public class AdditionalInformationBusinessLogicTest {
@Test
- public void testGetElementDao() throws Exception {
- Class<IElementOperation> class1 = null;
- ServletContext context = null;
- IElementOperation result;
-
- // default test
- }
-
-
- @Test
public void testCreateAdditionalInformation() throws Exception {
AdditionalInformationBusinessLogic testSubject;
NodeTypeEnum nodeType = null;
@@ -47,75 +39,6 @@ public class AdditionalInformationBusinessLogicTest {
@Test
- public void testValidateAndConvertValue() throws Exception {
- AdditionalInformationBusinessLogic testSubject;
- AdditionalInfoParameterInfo additionalInfoParameterInfo = null;
- String context = "";
- ResponseFormat result;
-
- // default test
- testSubject = createTestSubject();
- }
-
-
- @Test
- public void testValidateAndConvertKey() throws Exception {
- AdditionalInformationBusinessLogic testSubject;
- AdditionalInfoParameterInfo additionalInfoParameterInfo = null;
- String context = "";
- ResponseFormat result;
-
- // default test
- testSubject = createTestSubject();
- }
-
-
- @Test
- public void testValidateMaxSizeNotReached() throws Exception {
- AdditionalInformationBusinessLogic testSubject;
- NodeTypeEnum nodeType = null;
- String componentId = "";
- AdditionalInfoParameterInfo additionalInfoParameterInfo = null;
- ResponseFormat result;
-
- // default test
- testSubject = createTestSubject();
- }
-
-
- @Test
- public void testValidateValue() throws Exception {
- AdditionalInformationBusinessLogic testSubject;
- String value = "";
- Either<String, ResponseFormat> result;
-
- // default test
- testSubject = createTestSubject();
- }
-
-
- @Test
- public void testFindAdditionInformationKey() throws Exception {
- AdditionalInformationBusinessLogic testSubject;List<AdditionalInfoParameterInfo> parameters = null;
- String key = "";
- AdditionalInfoParameterInfo result;
-
- // default test
- }
-
-
- @Test
- public void testValidateAndNormalizeKey() throws Exception {
- AdditionalInformationBusinessLogic testSubject;
- String key = "";
- Either<String, ResponseFormat> result;
-
- // default test
- testSubject = createTestSubject();
- }
-
-
- @Test
public void testUpdateAdditionalInformation() throws Exception {
AdditionalInformationBusinessLogic testSubject;
NodeTypeEnum nodeType = null;
@@ -172,16 +95,4 @@ public class AdditionalInformationBusinessLogicTest {
// default test
testSubject = createTestSubject();
}
-
-
- @Test
- public void testVerifyCanWorkOnComponent() throws Exception {
- AdditionalInformationBusinessLogic testSubject;
- NodeTypeEnum nodeType = null;
- String resourceId = "";
- String userId = "";
- ResponseFormat result;
-
- // default test
- }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
index a5d05eff2c..d406244551 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
@@ -1,6 +1,19 @@
package org.openecomp.sdc.be.components.impl;
-import fj.data.Either;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anySet;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.BiPredicate;
+
import org.assertj.core.util.Lists;
import org.junit.Assert;
import org.junit.Before;
@@ -19,10 +32,13 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.ServletUtils;
+import org.openecomp.sdc.be.info.CreateAndAssotiateInfo;
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.RelationshipImpl;
import org.openecomp.sdc.be.model.RelationshipInfo;
@@ -37,348 +53,479 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.exception.ResponseFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiPredicate;
-
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anySet;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
+import fj.data.Either;
/**
- * The test suite designed for test functionality of ComponentInstanceBusinessLogic class
+ * The test suite designed for test functionality of
+ * ComponentInstanceBusinessLogic class
*/
public class ComponentInstanceBusinessLogicTest {
- private final static String USER_ID = "jh0003";
- private final static String COMPONENT_ID = "componentId";
- private final static String TO_INSTANCE_ID = "toInstanceId";
- private final static String FROM_INSTANCE_ID = "fromInstanceId";
- private final static String RELATION_ID = "relationId";
- private final static String CAPABILITY_OWNER_ID = "capabilityOwnerId";
- private final static String CAPABILITY_UID = "capabilityUid";
- private final static String CAPABILITY_NAME = "capabilityName";
- private final static String REQUIREMENT_OWNER_ID = "requirementOwnerId";
- private final static String REQUIREMENT_UID = "requirementUid";
- private final static String REQUIREMENT_NAME = "requirementName";
- private final static String RELATIONSHIP_TYPE = "relationshipType";
-
- private static ComponentsUtils componentsUtils;
- private static ServletUtils servletUtils;
- private static ResponseFormat responseFormat;
- private static ToscaOperationFacade toscaOperationFacade;
- private static UserBusinessLogic userAdmin;
-
- private static ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
- private static ForwardingPathOperation forwardingPathOperation;
- private static User user;
- private static UserValidations userValidations;
- private static Component service;
- private static Component resource;
- private static ComponentInstance toInstance;
- private static ComponentInstance fromInstance;
- private static CapabilityDataDefinition capability;
- private static RequirementDataDefinition requirement;
- private static RequirementCapabilityRelDef relation;
-
- @BeforeClass
- public static void setup() {
- createMocks();
- setMocks();
- stubMethods();
- createComponents();
-
- }
-
- @Before
- public void init(){
- MockitoAnnotations.initMocks(this);
- }
- @Test
- public void testGetRelationByIdSuccess(){
- getServiceRelationByIdSuccess(service);
- getServiceRelationByIdSuccess(resource);
- }
-
- @Test
- public void testGetRelationByIdUserValidationFailure(){
- getServiceRelationByIdUserValidationFailure(service);
- getServiceRelationByIdUserValidationFailure(resource);
- }
-
- @Test
- public void testGetRelationByIdComponentNotFoundFailure(){
- getRelationByIdComponentNotFoundFailure(service);
- getRelationByIdComponentNotFoundFailure(resource);
- }
-
-
-
-
- @Test
- public void testForwardingPathOnVersionChange(){
- getforwardingPathOnVersionChange();
- }
-
- private void getforwardingPathOnVersionChange(){
- String containerComponentParam="services";
- String containerComponentID="121-cont";
- String componentInstanceID="121-cont-1-comp";
- Service component=new Service();
- Map<String, ForwardingPathDataDefinition> forwardingPaths = generateForwardingPath(componentInstanceID);
-
- //Add existing componentInstance to component
- List<ComponentInstance> componentInstanceList=new ArrayList<>();
- ComponentInstance oldComponentInstance=new ComponentInstance();
- oldComponentInstance.setName("OLD_COMP_INSTANCE");
- oldComponentInstance.setUniqueId(componentInstanceID);
- oldComponentInstance.setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID,"1-comp");
- componentInstanceList.add(oldComponentInstance);
- component.setComponentInstances(componentInstanceList);
- component.setForwardingPaths(forwardingPaths);
-
- List<ComponentInstance> componentInstanceListNew=new ArrayList<>();
- ComponentInstance newComponentInstance=new ComponentInstance();
- String new_Comp_UID="2-comp";
- newComponentInstance.setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID,new_Comp_UID);
- newComponentInstance.setUniqueId(new_Comp_UID);
- componentInstanceListNew.add(newComponentInstance);
- Component component2=new Service();
- component2.setComponentInstances(componentInstanceListNew);
-
- //Mock for getting component
- when(toscaOperationFacade.getToscaElement(eq(containerComponentID),any(ComponentParametersView.class))).thenReturn(Either.left(component));
- when(toscaOperationFacade.validateComponentExists(any(String.class))).thenReturn(Either.left(Boolean.TRUE));
- //Mock for getting component for componentInstance
- when(toscaOperationFacade.getToscaFullElement(eq("1-comp"))).thenReturn(Either.left(component));
- when(toscaOperationFacade.getToscaFullElement(eq(new_Comp_UID))).thenReturn(Either.left(component2));
-
- Either<Set<String>, ResponseFormat> resultOp = componentInstanceBusinessLogic.forwardingPathOnVersionChange
- (containerComponentParam,containerComponentID,componentInstanceID,newComponentInstance);
- Assert.assertEquals(1,resultOp.left().value().size());
- Assert.assertEquals("FP-ID-1",resultOp.left().value().iterator().next());
-
- }
-
-
- @Test
- public void testDeleteForwardingPathsWhenComponentinstanceDeleted(){
-
- ComponentTypeEnum containerComponentType = ComponentTypeEnum.findByParamName("services");
- String containerComponentID = "Service-comp";
- String componentInstanceID = "NodeA1";
- Service component = new Service();
-
- component.addForwardingPath(createPath("path1", "NodeA1", "NodeB1", "1"));
- component.addForwardingPath(createPath("Path2", "NodeA2","NodeB2", "2"));
- when(toscaOperationFacade.getToscaElement(eq(containerComponentID),any(ComponentParametersView.class))).thenReturn(Either.left(component));
- when(toscaOperationFacade.getToscaElement(eq(containerComponentID))).thenReturn(Either.left(component));
- when(forwardingPathOperation.deleteForwardingPath(any(Service.class), anySet())).thenReturn(Either.left(new HashSet<>()));
- Either<ComponentInstance, ResponseFormat> responseFormatEither = componentInstanceBusinessLogic.deleteForwardingPathsRelatedTobeDeletedComponentInstance(
- containerComponentID, componentInstanceID, containerComponentType, Either.left(new ComponentInstance()));
- Assert.assertTrue(responseFormatEither.isLeft());
-
- }
-
- @Test
- public void testDeleteForwardingPathsWhenErrorInComponentinstanceDelete(){
-
- ComponentTypeEnum containerComponentType = ComponentTypeEnum.findByParamName("services");
- String containerComponentID = "Service-comp";
- String componentInstanceID = "NodeA1";
- Service component = new Service();
-
- component.addForwardingPath(createPath("path1", "NodeA1", "NodeB1", "1"));
- component.addForwardingPath(createPath("Path2", "NodeA2","NodeB2", "2"));
- when(toscaOperationFacade.getToscaElement(eq(containerComponentID),any(ComponentParametersView.class))).thenReturn(Either.left(component));
- when(toscaOperationFacade.getToscaElement(eq(containerComponentID))).thenReturn(Either.left(component));
- when(forwardingPathOperation.deleteForwardingPath(any(Service.class), anySet())).thenReturn(Either.left(new HashSet<>()));
- Either<ComponentInstance, ResponseFormat> responseFormatEither = componentInstanceBusinessLogic.deleteForwardingPathsRelatedTobeDeletedComponentInstance(
- containerComponentID, componentInstanceID, containerComponentType, Either.right(new ResponseFormat()));
- Assert.assertTrue(responseFormatEither.isRight());
-
- }
-
-
- private ForwardingPathDataDefinition createPath(String pathName, String fromNode, String toNode , String uniqueId){
- ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition(pathName);
- forwardingPath.setProtocol("protocol");
- forwardingPath.setDestinationPortNumber("port");
- forwardingPath.setUniqueId(uniqueId);
- ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition = new ListDataDefinition<>();
- forwardingPathElementListDataDefinition.add(new ForwardingPathElementDataDefinition(fromNode, toNode,
- "nodeAcpType", "nodeBcpType", "nodeDcpName", "nodeBcpName"));
- forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
-
- return forwardingPath;
- }
-
-
-
- private Map<String, ForwardingPathDataDefinition> generateForwardingPath(String componentInstanceID) {
- ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition("fpName");
- String protocol = "protocol";
- forwardingPath.setProtocol(protocol);
- forwardingPath.setDestinationPortNumber("DestinationPortNumber");
- forwardingPath.setUniqueId("FP-ID-1");
- ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition =
- new ListDataDefinition<>();
- forwardingPathElementListDataDefinition.add(
- new ForwardingPathElementDataDefinition(componentInstanceID, "nodeB", "nodeA_FORWARDER_CAPABILITY",
- "nodeBcpType" , "nodeDcpName",
- "nodeBcpName"));
- forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
- Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>();
- forwardingPaths.put("1122", forwardingPath);
- return forwardingPaths;
- }
-
- @SuppressWarnings("unchecked")
- private void getServiceRelationByIdSuccess(Component component){
- Either<User, ActionStatus> eitherCreator = Either.left(user);
- when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
- Either<Component, StorageOperationStatus> getComponentRes = Either.left(component);
- when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(getComponentRes);
-
- Either<RequirementDataDefinition, StorageOperationStatus> getfulfilledRequirementRes = Either.left(requirement);
- when(toscaOperationFacade.getFulfilledRequirementByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID), eq(relation), any(BiPredicate.class))).thenReturn(getfulfilledRequirementRes);
-
- Either<CapabilityDataDefinition, StorageOperationStatus> getfulfilledCapabilityRes = Either.left(capability);
- when(toscaOperationFacade.getFulfilledCapabilityByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID), eq(relation), any(BiPredicate.class))).thenReturn(getfulfilledCapabilityRes);
-
- Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic.getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
- assertTrue(response.isLeft());
- }
-
- private void getServiceRelationByIdUserValidationFailure(Component component){
- //Either<User, ActionStatus> eitherCreator = Either.right(ActionStatus.USER_NOT_FOUND);
- //when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
- when(userValidations.validateUserExists(eq(USER_ID), eq("get relation by Id"), eq(false))).thenReturn(Either.right(new ResponseFormat(404)));
- Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic.getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
- assertTrue(response.isRight());
- }
-
- private void getRelationByIdComponentNotFoundFailure(Component component){
- Either<User, ActionStatus> eitherCreator = Either.left(user);
- when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
- Either<Component, StorageOperationStatus> getComponentRes = Either.right(StorageOperationStatus.NOT_FOUND);
- when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(getComponentRes);
-
- Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic.getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
- assertTrue(response.isRight());
- }
-
- private static void createMocks() {
- componentsUtils = Mockito.mock(ComponentsUtils.class);
- servletUtils = Mockito.mock(ServletUtils.class);
- responseFormat = Mockito.mock(ResponseFormat.class);
- toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
- userAdmin = Mockito.mock(UserBusinessLogic.class);
- user = Mockito.mock(User.class);
- userValidations = Mockito.mock(UserValidations.class);
- forwardingPathOperation = Mockito.mock(ForwardingPathOperation.class);
- }
-
- private static void setMocks() {
- componentInstanceBusinessLogic = new ComponentInstanceBusinessLogic();
- componentInstanceBusinessLogic.setToscaOperationFacade(toscaOperationFacade);
- componentInstanceBusinessLogic.setUserAdmin(userAdmin);
- componentInstanceBusinessLogic.setComponentsUtils(componentsUtils);
- componentInstanceBusinessLogic.setUserValidations(userValidations);
- componentInstanceBusinessLogic.setForwardingPathOperation(forwardingPathOperation);
- }
-
- private static void stubMethods() {
- when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils);
- when(userValidations.validateUserExists(eq(USER_ID), eq("get relation by Id"), eq(false))).thenReturn(Either.left(user));
- when(componentsUtils.getResponseFormat(eq(ActionStatus.RELATION_NOT_FOUND), eq(RELATION_ID), eq(COMPONENT_ID))).thenReturn(responseFormat);
- }
-
- private static void createComponents() {
- createRelation();
- createInstances();
- createService();
- createResource();
- }
-
- private static void createResource() {
- resource = new Resource();
- resource.setUniqueId(COMPONENT_ID);
- resource.setComponentInstancesRelations(Lists.newArrayList(relation));
- resource.setComponentInstances(Lists.newArrayList(toInstance,fromInstance));
- resource.setCapabilities(toInstance.getCapabilities());
- resource.setRequirements(fromInstance.getRequirements());
- resource.setComponentType(ComponentTypeEnum.RESOURCE);
- }
-
-
- private static void createService() {
- service = new Service();
- service.setUniqueId(COMPONENT_ID);
- service.setComponentInstancesRelations(Lists.newArrayList(relation));
- service.setComponentInstances(Lists.newArrayList(toInstance,fromInstance));
- service.setCapabilities(toInstance.getCapabilities());
- service.setRequirements(fromInstance.getRequirements());
- service.setComponentType(ComponentTypeEnum.SERVICE);
- }
-
-
- private static void createInstances() {
- toInstance = new ComponentInstance();
- toInstance.setUniqueId(TO_INSTANCE_ID);
-
- fromInstance = new ComponentInstance();
- fromInstance.setUniqueId(FROM_INSTANCE_ID);
-
- capability = new CapabilityDataDefinition();
- capability.setOwnerId(CAPABILITY_OWNER_ID);
- capability.setUniqueId(CAPABILITY_UID);
- capability.setName(CAPABILITY_NAME);
-
- Map<String, List<CapabilityDefinition>> capabilities = new HashMap<>();
- capabilities.put(capability.getName(), Lists.newArrayList(new CapabilityDefinition(capability)));
-
- requirement = new RequirementDataDefinition();
- requirement.setOwnerId(REQUIREMENT_OWNER_ID);
- requirement.setUniqueId(REQUIREMENT_UID);
- requirement.setName(REQUIREMENT_NAME);
- requirement.setRelationship(RELATIONSHIP_TYPE);
-
-
- Map<String, List<RequirementDefinition>> requirements = new HashMap<>();
- requirements.put(requirement.getCapability(), Lists.newArrayList(new RequirementDefinition(requirement)));
-
- toInstance.setCapabilities(capabilities);
- fromInstance.setRequirements(requirements);
- }
-
-
- private static void createRelation() {
-
- 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.setType(RELATIONSHIP_TYPE);
- relationInfo.setRelationships(relationshipImpl);
- }
+ private final static String USER_ID = "jh0003";
+ private final static String COMPONENT_ID = "componentId";
+ private final static String TO_INSTANCE_ID = "toInstanceId";
+ private final static String FROM_INSTANCE_ID = "fromInstanceId";
+ private final static String RELATION_ID = "relationId";
+ private final static String CAPABILITY_OWNER_ID = "capabilityOwnerId";
+ private final static String CAPABILITY_UID = "capabilityUid";
+ private final static String CAPABILITY_NAME = "capabilityName";
+ private final static String REQUIREMENT_OWNER_ID = "requirementOwnerId";
+ private final static String REQUIREMENT_UID = "requirementUid";
+ private final static String REQUIREMENT_NAME = "requirementName";
+ private final static String RELATIONSHIP_TYPE = "relationshipType";
+
+ private static ComponentsUtils componentsUtils;
+ private static ServletUtils servletUtils;
+ private static ResponseFormat responseFormat;
+ private static ToscaOperationFacade toscaOperationFacade;
+ private static UserBusinessLogic userAdmin;
+
+ private static ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
+ private static ForwardingPathOperation forwardingPathOperation;
+ private static User user;
+ private static UserValidations userValidations;
+ private static Component service;
+ private static Component resource;
+ private static ComponentInstance toInstance;
+ private static ComponentInstance fromInstance;
+ private static CapabilityDataDefinition capability;
+ private static RequirementDataDefinition requirement;
+ private static RequirementCapabilityRelDef relation;
+ private static BaseBusinessLogic baseBusinessLogic;
+
+
+// @BeforeClass
+// public static void setup() {
+// createMocks();
+// setMocks();
+// stubMethods();
+// createComponents();
+//
+// }
+
+ @Before
+ public void init() {
+ createMocks();
+ setMocks();
+ stubMethods();
+ createComponents();
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testGetRelationByIdSuccess() {
+ getServiceRelationByIdSuccess(service);
+ getServiceRelationByIdSuccess(resource);
+ }
+
+ @Test
+ public void testGetRelationByIdUserValidationFailure() {
+ getServiceRelationByIdUserValidationFailure(service);
+ getServiceRelationByIdUserValidationFailure(resource);
+ }
+
+ @Test
+ public void testGetRelationByIdComponentNotFoundFailure() {
+ getRelationByIdComponentNotFoundFailure(service);
+ getRelationByIdComponentNotFoundFailure(resource);
+ }
+
+
+ @Test
+ public void testForwardingPathOnVersionChange() {
+ getforwardingPathOnVersionChange();
+ }
+
+ private void getforwardingPathOnVersionChange() {
+ String containerComponentParam = "services";
+ String containerComponentID = "121-cont";
+ String componentInstanceID = "121-cont-1-comp";
+ Service component = new Service();
+ Map<String, ForwardingPathDataDefinition> forwardingPaths = generateForwardingPath(componentInstanceID);
+
+ // Add existing componentInstance to component
+ List<ComponentInstance> componentInstanceList = new ArrayList<>();
+ ComponentInstance oldComponentInstance = new ComponentInstance();
+ oldComponentInstance.setName("OLD_COMP_INSTANCE");
+ oldComponentInstance.setUniqueId(componentInstanceID);
+ oldComponentInstance.setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, "1-comp");
+ componentInstanceList.add(oldComponentInstance);
+ component.setComponentInstances(componentInstanceList);
+ component.setForwardingPaths(forwardingPaths);
+
+ List<ComponentInstance> componentInstanceListNew = new ArrayList<>();
+ ComponentInstance newComponentInstance = new ComponentInstance();
+ String new_Comp_UID = "2-comp";
+ newComponentInstance.setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, new_Comp_UID);
+ newComponentInstance.setUniqueId(new_Comp_UID);
+ componentInstanceListNew.add(newComponentInstance);
+ Component component2 = new Service();
+ component2.setComponentInstances(componentInstanceListNew);
+
+ // Mock for getting component
+ when(toscaOperationFacade.getToscaElement(eq(containerComponentID), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(component));
+ when(toscaOperationFacade.validateComponentExists(any(String.class))).thenReturn(Either.left(Boolean.TRUE));
+ // Mock for getting component for componentInstance
+ when(toscaOperationFacade.getToscaFullElement(eq("1-comp"))).thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaFullElement(eq(new_Comp_UID))).thenReturn(Either.left(component2));
+
+ Either<Set<String>, ResponseFormat> resultOp = componentInstanceBusinessLogic.forwardingPathOnVersionChange(
+ containerComponentParam, containerComponentID, componentInstanceID, newComponentInstance);
+ Assert.assertEquals(1, resultOp.left().value().size());
+ Assert.assertEquals("FP-ID-1", resultOp.left().value().iterator().next());
+
+ }
+
+ @Test
+ public void testDeleteForwardingPathsWhenComponentinstanceDeleted() {
+
+ ComponentTypeEnum containerComponentType = ComponentTypeEnum.findByParamName("services");
+ String containerComponentID = "Service-comp";
+ String componentInstanceID = "NodeA1";
+ Service component = new Service();
+
+ component.addForwardingPath(createPath("path1", "NodeA1", "NodeB1", "1"));
+ component.addForwardingPath(createPath("Path2", "NodeA2", "NodeB2", "2"));
+ when(toscaOperationFacade.getToscaElement(eq(containerComponentID), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaElement(eq(containerComponentID))).thenReturn(Either.left(component));
+ when(forwardingPathOperation.deleteForwardingPath(any(Service.class), anySet()))
+ .thenReturn(Either.left(new HashSet<>()));
+ Either<ComponentInstance, ResponseFormat> responseFormatEither = componentInstanceBusinessLogic
+ .deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentID, componentInstanceID,
+ containerComponentType, Either.left(new ComponentInstance()));
+ Assert.assertTrue(responseFormatEither.isLeft());
+
+ }
+
+ @Test
+ public void testDeleteForwardingPathsWhenErrorInComponentinstanceDelete() {
+
+ ComponentTypeEnum containerComponentType = ComponentTypeEnum.findByParamName("services");
+ String containerComponentID = "Service-comp";
+ String componentInstanceID = "NodeA1";
+ Service component = new Service();
+
+ component.addForwardingPath(createPath("path1", "NodeA1", "NodeB1", "1"));
+ component.addForwardingPath(createPath("Path2", "NodeA2", "NodeB2", "2"));
+ when(toscaOperationFacade.getToscaElement(eq(containerComponentID), any(ComponentParametersView.class)))
+ .thenReturn(Either.left(component));
+ when(toscaOperationFacade.getToscaElement(eq(containerComponentID))).thenReturn(Either.left(component));
+ when(forwardingPathOperation.deleteForwardingPath(any(Service.class), anySet()))
+ .thenReturn(Either.left(new HashSet<>()));
+ Either<ComponentInstance, ResponseFormat> responseFormatEither = componentInstanceBusinessLogic
+ .deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentID, componentInstanceID,
+ containerComponentType, Either.right(new ResponseFormat()));
+ Assert.assertTrue(responseFormatEither.isRight());
+
+ }
+
+ private ForwardingPathDataDefinition createPath(String pathName, String fromNode, String toNode, String uniqueId) {
+ ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition(pathName);
+ forwardingPath.setProtocol("protocol");
+ forwardingPath.setDestinationPortNumber("port");
+ forwardingPath.setUniqueId(uniqueId);
+ ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition = new ListDataDefinition<>();
+ forwardingPathElementListDataDefinition.add(new ForwardingPathElementDataDefinition(fromNode, toNode,
+ "nodeAcpType", "nodeBcpType", "nodeDcpName", "nodeBcpName"));
+ forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
+
+ return forwardingPath;
+ }
+
+ private Map<String, ForwardingPathDataDefinition> generateForwardingPath(String componentInstanceID) {
+ ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition("fpName");
+ String protocol = "protocol";
+ forwardingPath.setProtocol(protocol);
+ forwardingPath.setDestinationPortNumber("DestinationPortNumber");
+ forwardingPath.setUniqueId("FP-ID-1");
+ ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition = new ListDataDefinition<>();
+ forwardingPathElementListDataDefinition.add(new ForwardingPathElementDataDefinition(componentInstanceID,
+ "nodeB", "nodeA_FORWARDER_CAPABILITY", "nodeBcpType", "nodeDcpName", "nodeBcpName"));
+ forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
+ Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>();
+ forwardingPaths.put("1122", forwardingPath);
+ return forwardingPaths;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void getServiceRelationByIdSuccess(Component component) {
+ Either<User, ActionStatus> eitherCreator = Either.left(user);
+ when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
+ Either<Component, StorageOperationStatus> getComponentRes = Either.left(component);
+ when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class)))
+ .thenReturn(getComponentRes);
+
+ Either<RequirementDataDefinition, StorageOperationStatus> getfulfilledRequirementRes = Either.left(requirement);
+ when(toscaOperationFacade.getFulfilledRequirementByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID),
+ eq(relation), any(BiPredicate.class))).thenReturn(getfulfilledRequirementRes);
+
+ Either<CapabilityDataDefinition, StorageOperationStatus> getfulfilledCapabilityRes = Either.left(capability);
+ when(toscaOperationFacade.getFulfilledCapabilityByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID), eq(relation),
+ any(BiPredicate.class))).thenReturn(getfulfilledCapabilityRes);
+
+ Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic
+ .getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
+ assertTrue(response.isLeft());
+ }
+
+ private void getServiceRelationByIdUserValidationFailure(Component component) {
+ // Either<User, ActionStatus> eitherCreator =
+ // Either.right(ActionStatus.USER_NOT_FOUND);
+ // when(userAdmin.getUser(eq(USER_ID),
+ // eq(false))).thenReturn(eitherCreator);
+ when(userValidations.validateUserExists(eq(USER_ID), eq("get relation by Id"), eq(false)))
+ .thenReturn(Either.right(new ResponseFormat(404)));
+ Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic
+ .getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
+ assertTrue(response.isRight());
+ }
+
+ private void getRelationByIdComponentNotFoundFailure(Component component) {
+ Either<User, ActionStatus> eitherCreator = Either.left(user);
+ when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
+ Either<Component, StorageOperationStatus> getComponentRes = Either.right(StorageOperationStatus.NOT_FOUND);
+ when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class)))
+ .thenReturn(getComponentRes);
+
+ Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic
+ .getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
+ assertTrue(response.isRight());
+ }
+
+ private static void createMocks() {
+ componentsUtils = Mockito.mock(ComponentsUtils.class);
+ servletUtils = Mockito.mock(ServletUtils.class);
+ responseFormat = Mockito.mock(ResponseFormat.class);
+ toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
+ userAdmin = Mockito.mock(UserBusinessLogic.class);
+ user = Mockito.mock(User.class);
+ baseBusinessLogic = Mockito.mock(BaseBusinessLogic.class);
+ userValidations = Mockito.mock(UserValidations.class);
+ forwardingPathOperation = Mockito.mock(ForwardingPathOperation.class);
+ }
+
+ private static void setMocks() {
+ componentInstanceBusinessLogic = new ComponentInstanceBusinessLogic();
+ componentInstanceBusinessLogic.setToscaOperationFacade(toscaOperationFacade);
+ componentInstanceBusinessLogic.setUserAdmin(userAdmin);
+ componentInstanceBusinessLogic.setComponentsUtils(componentsUtils);
+ componentInstanceBusinessLogic.setUserValidations(userValidations);
+ componentInstanceBusinessLogic.setForwardingPathOperation(forwardingPathOperation);
+ }
+
+ private static void stubMethods() {
+ when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils);
+ when(userValidations.validateUserExists(eq(USER_ID), eq("get relation by Id"), eq(false)))
+ .thenReturn(Either.left(user));
+ when(componentsUtils.getResponseFormat(eq(ActionStatus.RELATION_NOT_FOUND), eq(RELATION_ID), eq(COMPONENT_ID)))
+ .thenReturn(responseFormat);
+ }
+
+ private static void createComponents() {
+ createRelation();
+ createInstances();
+ createService();
+ createResource();
+ }
+
+ private static void createResource() {
+ resource = new Resource();
+ resource.setUniqueId(COMPONENT_ID);
+ resource.setComponentInstancesRelations(Lists.newArrayList(relation));
+ resource.setComponentInstances(Lists.newArrayList(toInstance, fromInstance));
+ resource.setCapabilities(toInstance.getCapabilities());
+ resource.setRequirements(fromInstance.getRequirements());
+ resource.setComponentType(ComponentTypeEnum.RESOURCE);
+ }
+
+ private static void createService() {
+ service = new Service();
+ service.setUniqueId(COMPONENT_ID);
+ service.setComponentInstancesRelations(Lists.newArrayList(relation));
+ service.setComponentInstances(Lists.newArrayList(toInstance, fromInstance));
+ service.setCapabilities(toInstance.getCapabilities());
+ service.setRequirements(fromInstance.getRequirements());
+ service.setComponentType(ComponentTypeEnum.SERVICE);
+ }
+
+ private static void createInstances() {
+ toInstance = new ComponentInstance();
+ toInstance.setUniqueId(TO_INSTANCE_ID);
+
+ fromInstance = new ComponentInstance();
+ fromInstance.setUniqueId(FROM_INSTANCE_ID);
+
+ capability = new CapabilityDataDefinition();
+ capability.setOwnerId(CAPABILITY_OWNER_ID);
+ capability.setUniqueId(CAPABILITY_UID);
+ capability.setName(CAPABILITY_NAME);
+
+ Map<String, List<CapabilityDefinition>> capabilities = new HashMap<>();
+ capabilities.put(capability.getName(), Lists.newArrayList(new CapabilityDefinition(capability)));
+
+ requirement = new RequirementDataDefinition();
+ requirement.setOwnerId(REQUIREMENT_OWNER_ID);
+ requirement.setUniqueId(REQUIREMENT_UID);
+ requirement.setName(REQUIREMENT_NAME);
+ requirement.setRelationship(RELATIONSHIP_TYPE);
+
+ Map<String, List<RequirementDefinition>> requirements = new HashMap<>();
+ requirements.put(requirement.getCapability(), Lists.newArrayList(new RequirementDefinition(requirement)));
+
+ toInstance.setCapabilities(capabilities);
+ fromInstance.setRequirements(requirements);
+ }
+
+ private static void createRelation() {
+
+ 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.setType(RELATIONSHIP_TYPE);
+ relationInfo.setRelationships(relationshipImpl);
+ }
+
+ private ComponentInstanceBusinessLogic createTestSubject() {
+ return componentInstanceBusinessLogic;
+ }
+
+
+
+
+
+ @Test
+ public void testChangeServiceProxyVersion() throws Exception {
+ ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
+ String containerComponentType = "";
+ String containerComponentId = "";
+ String serviceProxyId = "";
+ String userId = "";
+ Either<ComponentInstance, ResponseFormat> result;
+
+ // default test
+ componentInstanceBusinessLogic = createTestSubject();
+ result = componentInstanceBusinessLogic.changeServiceProxyVersion(containerComponentType, containerComponentId, serviceProxyId,
+ userId);
+ }
+
+
+
+
+
+
+
+ @Test
+ public void testCreateServiceProxy() throws Exception {
+ ComponentInstanceBusinessLogic testSubject;
+ String containerComponentType = "";
+ String containerComponentId = "";
+ String userId = "";
+ ComponentInstance componentInstance = null;
+ Either<ComponentInstance, ResponseFormat> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.createServiceProxy(containerComponentType, containerComponentId, userId,
+ componentInstance);
+ }
+
+
+
+
+ @Test
+ public void testDeleteForwardingPathsRelatedTobeDeletedComponentInstance() throws Exception {
+ ComponentInstanceBusinessLogic testSubject;
+ String containerComponentId = "";
+ String componentInstanceId = "";
+ ComponentTypeEnum containerComponentType = ComponentTypeEnum.RESOURCE;
+ Either<ComponentInstance, ResponseFormat> resultOp = null;
+ Either<ComponentInstance, ResponseFormat> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentId,
+ componentInstanceId, containerComponentType, resultOp);
+ }
+
+
+ @Test
+ public void testDeleteServiceProxy() throws Exception {
+ ComponentInstanceBusinessLogic testSubject;
+ String containerComponentType = "";
+ String containerComponentId = "";
+ String serviceProxyId = "";
+ String userId = "";
+ Either<ComponentInstance, ResponseFormat> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.deleteServiceProxy(containerComponentType, containerComponentId, serviceProxyId, userId);
+ }
+
+
+
+
+
+
+ @Test
+ public void testGetComponentInstanceInputsByInputId() throws Exception {
+ ComponentInstanceBusinessLogic testSubject;
+ Component component = new Service();
+ String inputId = "";
+ List<ComponentInstanceInput> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getComponentInstanceInputsByInputId(component, inputId);
+ }
+
+
+
+ @Test
+ public void testGetComponentInstancePropertiesByInputId() throws Exception {
+ ComponentInstanceBusinessLogic testSubject;
+ Component component = new Service();
+ String inputId = "";
+ List<ComponentInstanceProperty> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getComponentInstancePropertiesByInputId(component, inputId);
+ }
+
+
+ @Test
+ public void testGetRelationById() throws Exception {
+ ComponentInstanceBusinessLogic testSubject;
+ String componentId = "";
+ String relationId = "";
+ String userId = "";
+ ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE_INSTANCE;
+ Either<RequirementCapabilityRelDef, ResponseFormat> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRelationById(componentId, relationId, userId, componentTypeEnum);
+ }
+
+
}
+
+
+
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java
index 4ccf9c6cbb..cede79d7c8 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/jsongraph/TitanDaoTest.java
@@ -7,6 +7,7 @@ import java.util.Map;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.be.config.ConfigurationManager;
@@ -32,55 +33,54 @@ public class TitanDaoTest {
private static Logger logger = LoggerFactory.getLogger(TitanDaoTest.class);
-
+ private TitanDao dao = new TitanDao(new TitanGraphClient(new DAOTitanStrategy()));
-
- private TitanDao createTestSubject() {
- TitanGraphClient client = new TitanGraphClient(new DAOTitanStrategy());
- client.createGraph();
- return new TitanDao(client);
+ static {
+ String appConfigDir = "src/test/resources/config/catalog-dao";
+ ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
+ ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
}
+
@Before
public void init(){
- String appConfigDir = "src/test/resources/config/catalog-dao";
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
- ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
-
-
-
+ dao.titanClient.createGraph();
+ }
+
+ @After
+ public void end(){
+ dao.titanClient.cleanupGraph();
}
@Test
public void testCommit() throws Exception {
- TitanDao testSubject;
TitanOperationStatus result;
// default test
- testSubject = createTestSubject();
- result = testSubject.commit();
+
+ result = dao.commit();
}
@Test
public void testRollback() throws Exception {
- TitanDao testSubject;
+
TitanOperationStatus result;
// default test
- testSubject = createTestSubject();
- result = testSubject.rollback();
+
+ result = dao.rollback();
}
@Test
public void testGetGraph() throws Exception {
- TitanDao testSubject;
+
Either<TitanGraph, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getGraph();
+
+ result = dao.getGraph();
}
@@ -89,15 +89,15 @@ public class TitanDaoTest {
@Test
public void testGetVertexByPropertyAndLabel() throws Exception {
- TitanDao testSubject;
+
GraphPropertyEnum name = null;
Object value = null;
VertexTypeEnum label = null;
Either<GraphVertex, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getVertexByPropertyAndLabel(name, value, label);
+
+ result = dao.getVertexByPropertyAndLabel(name, value, label);
}
@@ -107,7 +107,7 @@ public class TitanDaoTest {
@Test
public void testGetVertexByPropertyAndLabel_1() throws Exception {
- TitanDao testSubject;
+
GraphPropertyEnum name = null;
Object value = null;
VertexTypeEnum label = null;
@@ -115,39 +115,39 @@ public class TitanDaoTest {
Either<GraphVertex, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getVertexByPropertyAndLabel(name, value, label, parseFlag);
+
+ result = dao.getVertexByPropertyAndLabel(name, value, label, parseFlag);
}
@Test
public void testGetVertexById() throws Exception {
- TitanDao testSubject;
+
String id = "";
Either<GraphVertex, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getVertexById(id);
+
+ result = dao.getVertexById(id);
}
@Test
public void testGetVertexById_1() throws Exception {
- TitanDao testSubject;
+
String id = "";
JsonParseFlagEnum parseFlag = null;
Either<GraphVertex, TitanOperationStatus> result;
// test 1
- testSubject = createTestSubject();
+
id = null;
- result = testSubject.getVertexById(id, parseFlag);
+ result = dao.getVertexById(id, parseFlag);
// test 2
- testSubject = createTestSubject();
+
id = "";
- result = testSubject.getVertexById(id, parseFlag);
+ result = dao.getVertexById(id, parseFlag);
}
@@ -165,27 +165,27 @@ public class TitanDaoTest {
@Test
public void testGetVertexProperties() throws Exception {
- TitanDao testSubject;
+
Element element = null;
Map<GraphPropertyEnum, Object> result;
// test 1
- testSubject = createTestSubject();
+
element = null;
- result = testSubject.getVertexProperties(element);
+ result = dao.getVertexProperties(element);
}
@Test
public void testGetEdgeProperties() throws Exception {
- TitanDao testSubject;
+
Element element = null;
Map<EdgePropertyEnum, Object> result;
// test 1
- testSubject = createTestSubject();
+
element = null;
- result = testSubject.getEdgeProperties(element);
+ result = dao.getEdgeProperties(element);
}
@@ -194,34 +194,34 @@ public class TitanDaoTest {
@Test
public void testGetByCriteria() throws Exception {
- TitanDao testSubject;
+
VertexTypeEnum type = null;
Map<GraphPropertyEnum, Object> props = null;
Either<List<GraphVertex>, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getByCriteria(type, props);
+
+ result = dao.getByCriteria(type, props);
}
@Test
public void testGetByCriteria_1() throws Exception {
- TitanDao testSubject;
+
VertexTypeEnum type = null;
Map<GraphPropertyEnum, Object> props = null;
JsonParseFlagEnum parseFlag = null;
Either<List<GraphVertex>, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getByCriteria(type, props, parseFlag);
+
+ result = dao.getByCriteria(type, props, parseFlag);
}
@Test
public void testGetByCriteria_2() throws Exception {
- TitanDao testSubject;
+
VertexTypeEnum type = null;
Map<GraphPropertyEnum, Object> props = null;
Map<GraphPropertyEnum, Object> hasNotProps = null;
@@ -229,19 +229,19 @@ public class TitanDaoTest {
Either<List<GraphVertex>, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getByCriteria(type, props, hasNotProps, parseFlag);
+
+ result = dao.getByCriteria(type, props, hasNotProps, parseFlag);
}
@Test
public void testGetCatalogVerticies() throws Exception {
- TitanDao testSubject;
+
Either<Iterator<Vertex>, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getCatalogVerticies();
+
+ result = dao.getCatalogVerticies();
}
@@ -261,15 +261,15 @@ public class TitanDaoTest {
@Test
public void testGetParentVertecies_1() throws Exception {
- TitanDao testSubject;
+
Vertex parentVertex = null;
EdgeLabelEnum edgeLabel = null;
JsonParseFlagEnum parseFlag = null;
Either<List<Vertex>, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getParentVertecies(parentVertex, edgeLabel, parseFlag);
+
+ result = dao.getParentVertecies(parentVertex, edgeLabel, parseFlag);
}
@@ -277,15 +277,15 @@ public class TitanDaoTest {
@Test
public void testGetChildrenVertecies_1() throws Exception {
- TitanDao testSubject;
+
Vertex parentVertex = null;
EdgeLabelEnum edgeLabel = null;
JsonParseFlagEnum parseFlag = null;
Either<List<Vertex>, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
+
+ result = dao.getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
}
@@ -318,14 +318,14 @@ public class TitanDaoTest {
@Test
public void testUpdateVertexMetadataPropertiesWithJson() throws Exception {
- TitanDao testSubject;
+
Vertex vertex = null;
Map<GraphPropertyEnum, Object> properties = null;
TitanOperationStatus result;
// default test
- testSubject = createTestSubject();
- result = testSubject.updateVertexMetadataPropertiesWithJson(vertex, properties);
+
+ result = dao.updateVertexMetadataPropertiesWithJson(vertex, properties);
}
@@ -335,14 +335,14 @@ public class TitanDaoTest {
@Test
public void testGetProperty_1() throws Exception {
- TitanDao testSubject;
+
Edge edge = null;
EdgePropertyEnum key = null;
Object result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getProperty(edge, key);
+
+ result = dao.getProperty(edge, key);
}
@@ -351,14 +351,14 @@ public class TitanDaoTest {
@Test
public void testGetBelongingEdgeByCriteria_1() throws Exception {
- TitanDao testSubject;
+
String parentId = "";
EdgeLabelEnum label = null;
Map<GraphPropertyEnum, Object> properties = null;
Either<Edge, TitanOperationStatus> result;
// default test
- testSubject = createTestSubject();
- result = testSubject.getBelongingEdgeByCriteria(parentId, label, properties);
+
+ result = dao.getBelongingEdgeByCriteria(parentId, label, properties);
}
} \ No newline at end of file
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
diff --git a/catalog-model/src/test/resources/config/configuration.yaml b/catalog-model/src/test/resources/config/configuration.yaml
new file mode 100644
index 0000000000..f948f6e3cc
--- /dev/null
+++ b/catalog-model/src/test/resources/config/configuration.yaml
@@ -0,0 +1,677 @@
+identificationHeaderFields:
+ - HTTP_IV_USER
+ - HTTP_CSP_FIRSTNAME
+ - HTTP_CSP_LASTNAME
+ - HTTP_IV_REMOTE_ADDRESS
+ - HTTP_CSP_WSTYPE
+
+# catalog backend hostname
+beFqdn: localhost
+# sdccatalog.att.com
+
+# catalog backend http port
+beHttpPort: 8080
+
+# catalog backend http context
+beContext: /sdc/rest/config/get
+
+# catalog backend protocol
+beProtocol: http
+
+# catalog backend ssl port
+beSslPort: 8443
+
+version: 1.1.0
+released: 2012-11-30
+toscaConformanceLevel: 5.0
+minToscaConformanceLevel: 3.0
+
+titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties
+titanInMemoryGraph: false
+titanLockTimeout: 1800
+
+# The interval to try and reconnect to titan DB when it is down during ASDC startup:
+titanReconnectIntervalInSeconds: 3
+
+# The read timeout towards Titan DB when health check is invoked:
+titanHealthCheckReadTimeout: 1
+
+# The interval to try and reconnect to Elasticsearch when it is down during ASDC startup:
+esReconnectIntervalInSeconds: 3
+uebHealthCheckReconnectIntervalInSeconds: 15
+uebHealthCheckReadTimeout: 4
+
+# Protocols
+protocols:
+ - http
+ - https
+
+# Default imports
+defaultImports:
+ - nodes:
+ file: nodes.yml
+ - datatypes:
+ file: data.yml
+ - capabilities:
+ file: capabilities.yml
+ - relationships:
+ file: relationships.yml
+ - groups:
+ file: groups.yml
+ - policies:
+ file: policies.yml
+
+# Users
+users:
+ tom: passwd
+ bob: passwd
+
+neo4j:
+ host: neo4jhost
+ port: 7474
+ user: neo4j
+ password: "12345"
+
+cassandraConfig:
+ cassandraHosts: ['localhost']
+ localDataCenter: datacenter1
+ reconnectTimeout : 30000
+ authenticate: false
+ username: koko
+ password: bobo
+ ssl: false
+ truststorePath : /path/path
+ truststorePassword : 123123
+ keySpaces:
+ - { name: sdcaudit, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+ - { name: sdcartifact, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+ - { name: sdccomponent, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+ - { name: sdcrepository, replicationStrategy: SimpleStrategy, replicationInfo: ['1']}
+
+#Application-specific settings of ES
+elasticSearch:
+ # Mapping of index prefix to time-based frame. For example, if below is configured:
+ #
+ # - indexPrefix: auditingevents
+ # creationPeriod: minute
+ #
+ # then ES object of type which is mapped to "auditingevents-*" template, and created on 2015-12-23 13:24:54, will enter "auditingevents-2015-12-23-13-24" index.
+ # Another object created on 2015-12-23 13:25:54, will enter "auditingevents-2015-12-23-13-25" index.
+ # If creationPeriod: month, both of the above will enter "auditingevents-2015-12" index.
+ #
+ # PLEASE NOTE: the timestamps are created in UTC/GMT timezone! This is needed so that timestamps will be correctly presented in Kibana.
+ #
+ # Legal values for creationPeriod - year, month, day, hour, minute, none (meaning no time-based behaviour).
+ #
+ # If no creationPeriod is configured for indexPrefix, default behavour is creationPeriod: month.
+
+ indicesTimeFrequency:
+ - indexPrefix: auditingevents
+ creationPeriod: month
+ - indexPrefix: monitoring_events
+ creationPeriod: month
+
+artifactTypes:
+ - CHEF
+ - PUPPET
+ - SHELL
+ - YANG
+ - YANG_XML
+ - HEAT
+ - BPEL
+ - DG_XML
+ - MURANO_PKG
+ - WORKFLOW
+ - NETWORK_CALL_FLOW
+ - TOSCA_TEMPLATE
+ - TOSCA_CSAR
+ - AAI_SERVICE_MODEL
+ - AAI_VF_MODEL
+ - AAI_VF_MODULE_MODEL
+ - AAI_VF_INSTANCE_MODEL
+ - OTHER
+ - SNMP_POLL
+ - SNMP_TRAP
+ - GUIDE
+
+licenseTypes:
+ - User
+ - Installation
+ - CPU
+
+#Deployment artifacts placeHolder
+resourceTypes: &allResourceTypes
+ - VFC
+ - CP
+ - VL
+ - VF
+ - VFCMT
+ - Abstract
+ - CVFC
+
+# validForResourceTypes usage
+# validForResourceTypes:
+# - VF
+# - VL
+deploymentResourceArtifacts:
+# heat:
+# displayName: "Base HEAT Template"
+# type: HEAT
+# validForResourceTypes: *allResourceTypes
+# heatVol:
+# displayName: "Volume HEAT Template"
+# type: HEAT_VOL
+# validForResourceTypes: *allResourceTypes
+# heatNet:
+# displayName: "Network HEAT Template"
+# type: HEAT_NET
+# validForResourceTypes: *allResourceTypes
+
+deploymentResourceInstanceArtifacts:
+ heatEnv:
+ displayName: "HEAT ENV"
+ type: HEAT_ENV
+ description: "Auto-generated HEAT Environment deployment artifact"
+ fileExtension: "env"
+ VfHeatEnv:
+ displayName: "VF HEAT ENV"
+ type: HEAT_ENV
+ description: "VF Auto-generated HEAT Environment deployment artifact"
+ fileExtension: "env"
+
+#tosca artifacts placeholders
+toscaArtifacts:
+ assetToscaTemplate:
+ artifactName: -template.yml
+ displayName: Tosca Template
+ type: TOSCA_TEMPLATE
+ description: TOSCA representation of the asset
+ assetToscaCsar:
+ artifactName: -csar.csar
+ displayName: Tosca Model
+ type: TOSCA_CSAR
+ description: TOSCA definition package of the asset
+
+
+#Informational artifacts placeHolder
+excludeResourceCategory:
+ - Generic
+excludeResourceType:
+ - PNF
+informationalResourceArtifacts:
+ features:
+ displayName: Features
+ type: OTHER
+ capacity:
+ displayName: Capacity
+ type: OTHER
+ vendorTestResult:
+ displayName: Vendor Test Result
+ type: OTHER
+ testScripts:
+ displayName: Test Scripts
+ type: OTHER
+ CloudQuestionnaire:
+ displayName: Cloud Questionnaire (completed)
+ type: OTHER
+ HEATTemplateFromVendor:
+ displayName: HEAT Template from Vendor
+ type: HEAT
+ resourceSecurityTemplate:
+ displayName: Resource Security Template
+ type: OTHER
+
+excludeServiceCategory:
+
+informationalServiceArtifacts:
+ serviceArtifactPlan:
+ displayName: Service Artifact Plan
+ type: OTHER
+ summaryOfImpactsToECOMPElements:
+ displayName: Summary of impacts to ECOMP elements,OSSs, BSSs
+ type: OTHER
+ controlLoopFunctions:
+ displayName: Control Loop Functions
+ type: OTHER
+ dimensioningInfo:
+ displayName: Dimensioning Info
+ type: OTHER
+ affinityRules:
+ displayName: Affinity Rules
+ type: OTHER
+ operationalPolicies:
+ displayName: Operational Policies
+ type: OTHER
+ serviceSpecificPolicies:
+ displayName: Service-specific Policies
+ type: OTHER
+ engineeringRules:
+ displayName: Engineering Rules (ERD)
+ type: OTHER
+ distributionInstructions:
+ displayName: Distribution Instructions
+ type: OTHER
+ certificationTestResults:
+ displayName: TD Certification Test Results
+ type: OTHER
+ deploymentVotingRecord:
+ displayName: Deployment Voting Record
+ type: OTHER
+ serviceQuestionnaire:
+ displayName: Service Questionnaire
+ type: OTHER
+ serviceSecurityTemplate:
+ displayName: Service Security Template
+ type: OTHER
+
+serviceApiArtifacts:
+ configuration:
+ displayName: Configuration
+ type: OTHER
+ instantiation:
+ displayName: Instantiation
+ type: OTHER
+ monitoring:
+ displayName: Monitoring
+ type: OTHER
+ reporting:
+ displayName: Reporting
+ type: OTHER
+ logging:
+ displayName: Logging
+ type: OTHER
+ testing:
+ displayName: Testing
+ type: OTHER
+
+additionalInformationMaxNumberOfKeys: 50
+
+systemMonitoring:
+ enabled: false
+ isProxy: false
+ probeIntervalInSeconds: 15
+
+defaultHeatArtifactTimeoutMinutes: 60
+
+serviceDeploymentArtifacts:
+ YANG_XML:
+ acceptedTypes:
+ - xml
+ VNF_CATALOG:
+ acceptedTypes:
+ - xml
+ MODEL_INVENTORY_PROFILE:
+ acceptedTypes:
+ - xml
+ MODEL_QUERY_SPEC:
+ acceptedTypes:
+ - xml
+ UCPE_LAYER_2_CONFIGURATION:
+ acceptedTypes:
+ - xml
+
+#AAI Artifacts
+ AAI_SERVICE_MODEL:
+ acceptedTypes:
+ - xml
+ AAI_VF_MODULE_MODEL:
+ acceptedTypes:
+ - xml
+ AAI_VF_INSTANCE_MODEL:
+ acceptedTypes:
+ - xml
+ OTHER:
+ acceptedTypes:
+
+resourceDeploymentArtifacts:
+ HEAT:
+ acceptedTypes:
+ - yaml
+ - yml
+ validForResourceTypes: *allResourceTypes
+ HEAT_VOL:
+ acceptedTypes:
+ - yaml
+ - yml
+ validForResourceTypes: *allResourceTypes
+ HEAT_NET:
+ acceptedTypes:
+ - yaml
+ - yml
+ validForResourceTypes: *allResourceTypes
+ HEAT_NESTED:
+ acceptedTypes:
+ - yaml
+ - yml
+ validForResourceTypes: *allResourceTypes
+ HEAT_ARTIFACT:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ YANG_XML:
+ acceptedTypes:
+ - xml
+ validForResourceTypes: *allResourceTypes
+ VNF_CATALOG:
+ acceptedTypes:
+ - xml
+ validForResourceTypes: *allResourceTypes
+ VF_LICENSE:
+ acceptedTypes:
+ - xml
+ validForResourceTypes: *allResourceTypes
+ VENDOR_LICENSE:
+ acceptedTypes:
+ - xml
+ validForResourceTypes: *allResourceTypes
+ MODEL_INVENTORY_PROFILE:
+ acceptedTypes:
+ - xml
+ validForResourceTypes: *allResourceTypes
+ MODEL_QUERY_SPEC:
+ acceptedTypes:
+ - xml
+ validForResourceTypes: *allResourceTypes
+ LIFECYCLE_OPERATIONS:
+ acceptedTypes:
+ - yaml
+ - yml
+ validForResourceTypes:
+ - VF
+ - VFC
+ VES_EVENTS:
+ acceptedTypes:
+ - yaml
+ - yml
+ validForResourceTypes: *allResourceTypes
+ PERFORMANCE_COUNTER:
+ acceptedTypes:
+ - csv
+ validForResourceTypes: *allResourceTypes
+ APPC_CONFIG:
+ acceptedTypes:
+ validForResourceTypes:
+ - VF
+ DCAE_TOSCA:
+ acceptedTypes:
+ - yml
+ - yaml
+ validForResourceTypes:
+ - VF
+ - VFCMT
+ DCAE_JSON:
+ acceptedTypes:
+ - json
+ validForResourceTypes:
+ - VF
+ - VFCMT
+ DCAE_POLICY:
+ acceptedTypes:
+ - emf
+ validForResourceTypes:
+ - VF
+ - VFCMT
+ DCAE_DOC:
+ acceptedTypes:
+ validForResourceTypes:
+ - VF
+ - VFCMT
+ DCAE_EVENT:
+ acceptedTypes:
+ validForResourceTypes:
+ - VF
+ - VFCMT
+ AAI_VF_MODEL:
+ acceptedTypes:
+ - xml
+ validForResourceTypes:
+ - VF
+ AAI_VF_MODULE_MODEL:
+ acceptedTypes:
+ - xml
+ validForResourceTypes:
+ - VF
+ OTHER:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ SNMP_POLL:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ SNMP_TRAP:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+
+resourceInstanceDeploymentArtifacts:
+ HEAT_ENV:
+ acceptedTypes:
+ - env
+ VF_MODULES_METADATA:
+ acceptedTypes:
+ - json
+ VES_EVENTS:
+ acceptedTypes:
+ - yaml
+ - yml
+ PERFORMANCE_COUNTER:
+ acceptedTypes:
+ - csv
+ DCAE_INVENTORY_TOSCA:
+ acceptedTypes:
+ - yml
+ - yaml
+ DCAE_INVENTORY_JSON:
+ acceptedTypes:
+ - json
+ DCAE_INVENTORY_POLICY:
+ acceptedTypes:
+ - emf
+ DCAE_INVENTORY_DOC:
+ acceptedTypes:
+ DCAE_INVENTORY_BLUEPRINT:
+ acceptedTypes:
+ DCAE_INVENTORY_EVENT:
+ acceptedTypes:
+ SNMP_POLL:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ SNMP_TRAP:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+
+resourceInformationalArtifacts:
+ CHEF:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ PUPPET:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ SHELL:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ YANG:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ YANG_XML:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ HEAT:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ BPEL:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ DG_XML:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ MURANO_PKG:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ OTHER:
+ acceptedTypes:
+ validForResourceTypes:
+ - VFC
+ - CVFC
+ - CP
+ - VL
+ - VF
+ - VFCMT
+ - Abstract
+ - PNF
+ SNMP_POLL:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ SNMP_TRAP:
+ acceptedTypes:
+ validForResourceTypes: *allResourceTypes
+ GUIDE:
+ acceptedTypes:
+ validForResourceTypes:
+ - VF
+ - VFC
+ - CVFC
+
+resourceInformationalDeployedArtifacts:
+
+requirementsToFulfillBeforeCert:
+
+capabilitiesToConsumeBeforeCert:
+
+unLoggedUrls:
+ - /sdc2/rest/healthCheck
+
+cleanComponentsConfiguration:
+ cleanIntervalInMinutes: 1440
+ componentsToClean:
+ - Resource
+ - Service
+
+artifactsIndex: resources
+
+heatEnvArtifactHeader: ""
+heatEnvArtifactFooter: ""
+
+onboarding:
+ protocol: http
+ host: localhost
+ port: 8080
+ downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages"
+ healthCheckUri: "/onboarding-api/v1.0/healthcheck"
+
+dcae:
+ protocol: http
+ host: 127.0.0.1
+ port: 8080
+ healthCheckUri: "/dcae/healthCheck"
+
+switchoverDetector:
+ gBeFqdn: AIO-BE.ecomp.idns.cip.com
+ gFeFqdn: AIO-FE.ecomp.idns.cip.com
+ beVip: 0.0.0.0
+ feVip: 0.0.0.0
+ beResolveAttempts: 3
+ feResolveAttempts: 3
+ enabled: false
+ interval: 60
+ changePriorityUser: ecompasdc
+ changePriorityPassword: ecompasdc123
+ publishNetworkUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root"
+ publishNetworkBody: '{"note":"publish network"}'
+ groups:
+ beSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com?user=root",
+ changePriorityBody: '{"name":"AIO-BE.ecomp.idns.com","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com","no_ad_redirection":false,"v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_be","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_be"],"failover_policy":["FAILALL"]},"comment":"AIO BE G-fqdn","intended_app_proto":"DNS"}'}
+ feSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.com?user=root",
+ changePriorityBody: '{"comment":"AIO G-fqdn","name":"AIO-FE.ecomp.idns.com","v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_fe","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_fe"],"failover_policy":["FAILALL"]},"no_ad_redirection":false,"intended_app_proto":"DNS","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.com"}'}
+
+applicationL1Cache:
+ datatypes:
+ enabled: true
+ firstRunDelay: 10
+ pollIntervalInSec: 60
+
+applicationL2Cache:
+ enabled: true
+ catalogL1Cache:
+ enabled: true
+ resourcesSizeInCache: 300
+ servicesSizeInCache: 200
+ productsSizeInCache: 100
+ queue:
+ syncIntervalInSecondes: 43200
+ waitOnShutDownInMinutes: 10
+ numberOfCacheWorkers: 4
+
+toscaValidators:
+ stringMaxLength: 2500
+
+disableAudit: false
+
+vfModuleProperties:
+ min_vf_module_instances:
+ forBaseModule: 1
+ forNonBaseModule: 0
+ max_vf_module_instances:
+ forBaseModule: 1
+ forNonBaseModule:
+ initial_count:
+ forBaseModule: 1
+ forNonBaseModule: 0
+ vf_module_type:
+ forBaseModule: Base
+ forNonBaseModule: Expansion
+
+genericAssetNodeTypes:
+ VFC: org.openecomp.resource.abstract.nodes.VFC
+ CVFC: org.openecomp.resource.abstract.nodes.VFC
+ VF : org.openecomp.resource.abstract.nodes.VF
+ PNF: org.openecomp.resource.abstract.nodes.PNF
+ Service: org.openecomp.resource.abstract.nodes.service
+
+workloadContext: Production
+environmentContext:
+ defaultValue: General_Revenue-Bearing
+ validValues:
+ - Critical_Revenue-Bearing
+ - Vital_Revenue-Bearing
+ - Essential_Revenue-Bearing
+ - Important_Revenue-Bearing
+ - Needed_Revenue-Bearing
+ - Useful_Revenue-Bearing
+ - General_Revenue-Bearing
+ - Critical_Non-Revenue
+ - Vital_Non-Revenue
+ - Essential_Non-Revenue
+ - Important_Non-Revenue
+ - Needed_Non-Revenue
+ - Useful_Non-Revenue
+ - General_Non-Revenue
+
+dmaapConsumerConfiguration:
+ hosts: olsd004.wnsnet.attws.com:3905
+ consumerGroup: asdc
+ consumerId: invalidMamaUser #mama - in Order To Consume Remove This String And Replace It With -> mama
+ timeoutMs: 15000
+ limit: 1
+ pollingInterval: 2
+ topic: com.att.sdc.23911-SDCforTestDev-v001
+ latitude: 32.109333
+ longitude: 34.855499
+ version: 1.0
+ serviceName: dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events
+ environment: TEST
+ partner: BOT_R
+ routeOffer: MR1
+ protocol: https
+ contenttype: application/json
+ dme2TraceOn: true
+ aftEnvironment: AFTUAT
+ aftDme2ConnectionTimeoutMs: 15000
+ aftDme2RoundtripTimeoutMs: 240000
+ aftDme2ReadTimeoutMs: 50000
+ dme2preferredRouterFilePath: DME2preferredRouter.txt
+ timeLimitForNotificationHandleMs: 0
+ credential:
+ username: m09875@sdc.att.com
+ password: hmXYcznAljMSisdy8zgcag==
+
+dmeConfiguration:
+ dme2Search: DME2SEARCH
+ dme2Resolve: DME2RESOLVE