1 package org.openecomp.sdc.be.components.impl;
3 import static org.junit.Assert.assertTrue;
4 import static org.mockito.ArgumentMatchers.any;
5 import static org.mockito.ArgumentMatchers.anySet;
6 import static org.mockito.ArgumentMatchers.anyString;
7 import static org.mockito.ArgumentMatchers.eq;
8 import static org.mockito.Mockito.when;
10 import java.util.ArrayList;
11 import java.util.HashMap;
12 import java.util.HashSet;
13 import java.util.List;
16 import java.util.function.BiPredicate;
18 import org.apache.commons.lang3.tuple.ImmutablePair;
19 import org.apache.commons.lang3.tuple.Pair;
20 import org.assertj.core.util.Lists;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.mockito.Mock;
25 import org.mockito.Mockito;
26 import org.mockito.MockitoAnnotations;
27 import org.openecomp.sdc.be.components.validation.UserValidations;
28 import org.openecomp.sdc.be.dao.api.ActionStatus;
29 import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
30 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
31 import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
32 import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
33 import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
34 import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
35 import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
36 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
37 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
38 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
39 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
40 import org.openecomp.sdc.be.impl.ComponentsUtils;
41 import org.openecomp.sdc.be.impl.ServletUtils;
42 import org.openecomp.sdc.be.info.CreateAndAssotiateInfo;
43 import org.openecomp.sdc.be.model.CapabilityDefinition;
44 import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
45 import org.openecomp.sdc.be.model.Component;
46 import org.openecomp.sdc.be.model.ComponentInstance;
47 import org.openecomp.sdc.be.model.ComponentInstanceInput;
48 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
49 import org.openecomp.sdc.be.model.ComponentParametersView;
50 import org.openecomp.sdc.be.model.RelationshipImpl;
51 import org.openecomp.sdc.be.model.RelationshipInfo;
52 import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
53 import org.openecomp.sdc.be.model.RequirementDefinition;
54 import org.openecomp.sdc.be.model.Resource;
55 import org.openecomp.sdc.be.model.Service;
56 import org.openecomp.sdc.be.model.User;
57 import org.openecomp.sdc.be.model.jsontitan.operations.ForwardingPathOperation;
58 import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
59 import org.openecomp.sdc.be.model.operations.api.IComponentInstanceOperation;
60 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
61 import org.openecomp.sdc.be.model.operations.impl.ArtifactOperation;
62 import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
63 import org.openecomp.sdc.be.user.UserBusinessLogic;
64 import org.openecomp.sdc.exception.ResponseFormat;
65 import org.openecomp.sdc.common.datastructure.Wrapper;
67 import fj.data.Either;
68 import javassist.CodeConverter.ArrayAccessReplacementMethodNames;
69 import mockit.Deencapsulation;
74 * The test suite designed for test functionality of
75 * ComponentInstanceBusinessLogic class
77 public class ComponentInstanceBusinessLogicTest {
79 private final static String USER_ID = "jh0003";
80 private final static String COMPONENT_ID = "componentId";
81 private final static String TO_INSTANCE_ID = "toInstanceId";
82 private final static String FROM_INSTANCE_ID = "fromInstanceId";
83 private final static String RELATION_ID = "relationId";
84 private final static String CAPABILITY_OWNER_ID = "capabilityOwnerId";
85 private final static String CAPABILITY_UID = "capabilityUid";
86 private final static String CAPABILITY_NAME = "capabilityName";
87 private final static String REQUIREMENT_OWNER_ID = "requirementOwnerId";
88 private final static String REQUIREMENT_UID = "requirementUid";
89 private final static String REQUIREMENT_NAME = "requirementName";
90 private final static String RELATIONSHIP_TYPE = "relationshipType";
92 private static ComponentsUtils componentsUtils;
93 private static ServletUtils servletUtils;
94 private static ResponseFormat responseFormat;
95 private static ToscaOperationFacade toscaOperationFacade;
96 private static IComponentInstanceOperation componentInstanceOperation;
97 private static UserBusinessLogic userAdmin;
99 private static ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
100 private static ForwardingPathOperation forwardingPathOperation;
101 private static User user;
102 private static UserValidations userValidations;
103 private static Component service;
104 private static Component resource;
105 private static ComponentInstance toInstance;
106 private static ComponentInstance fromInstance;
107 private static CapabilityDataDefinition capability;
108 private static RequirementDataDefinition requirement;
109 private static RequirementCapabilityRelDef relation;
110 private static BaseBusinessLogic baseBusinessLogic;
111 private static ArtifactsBusinessLogic artifactsBusinessLogic;
112 private static ToscaDataDefinition toscaDataDefinition;
115 // public static void setup() {
119 // createComponents();
129 MockitoAnnotations.initMocks(this);
133 public void testGetRelationByIdSuccess() {
134 getServiceRelationByIdSuccess(service);
135 getServiceRelationByIdSuccess(resource);
139 public void testGetRelationByIdUserValidationFailure() {
140 getServiceRelationByIdUserValidationFailure(service);
141 getServiceRelationByIdUserValidationFailure(resource);
145 public void testGetRelationByIdComponentNotFoundFailure() {
146 getRelationByIdComponentNotFoundFailure(service);
147 getRelationByIdComponentNotFoundFailure(resource);
152 public void testForwardingPathOnVersionChange() {
153 getforwardingPathOnVersionChange();
156 private void getforwardingPathOnVersionChange() {
157 String containerComponentParam = "services";
158 String containerComponentID = "121-cont";
159 String componentInstanceID = "121-cont-1-comp";
160 Service component = new Service();
161 Map<String, ForwardingPathDataDefinition> forwardingPaths = generateForwardingPath(componentInstanceID);
163 // Add existing componentInstance to component
164 List<ComponentInstance> componentInstanceList = new ArrayList<>();
165 ComponentInstance oldComponentInstance = new ComponentInstance();
166 oldComponentInstance.setName("OLD_COMP_INSTANCE");
167 oldComponentInstance.setUniqueId(componentInstanceID);
168 oldComponentInstance.setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, "1-comp");
169 componentInstanceList.add(oldComponentInstance);
170 component.setComponentInstances(componentInstanceList);
171 component.setForwardingPaths(forwardingPaths);
173 List<ComponentInstance> componentInstanceListNew = new ArrayList<>();
174 ComponentInstance newComponentInstance = new ComponentInstance();
175 String new_Comp_UID = "2-comp";
176 newComponentInstance.setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_UID, new_Comp_UID);
177 newComponentInstance.setUniqueId(new_Comp_UID);
178 componentInstanceListNew.add(newComponentInstance);
179 Component component2 = new Service();
180 component2.setComponentInstances(componentInstanceListNew);
182 // Mock for getting component
183 when(toscaOperationFacade.getToscaElement(eq(containerComponentID), any(ComponentParametersView.class)))
184 .thenReturn(Either.left(component));
185 when(toscaOperationFacade.validateComponentExists(any(String.class))).thenReturn(Either.left(Boolean.TRUE));
186 // Mock for getting component for componentInstance
187 when(toscaOperationFacade.getToscaFullElement(eq("1-comp"))).thenReturn(Either.left(component));
188 when(toscaOperationFacade.getToscaFullElement(eq(new_Comp_UID))).thenReturn(Either.left(component2));
190 Either<Set<String>, ResponseFormat> resultOp = componentInstanceBusinessLogic.forwardingPathOnVersionChange(
191 containerComponentParam, containerComponentID, componentInstanceID, newComponentInstance);
192 Assert.assertEquals(1, resultOp.left().value().size());
193 Assert.assertEquals("FP-ID-1", resultOp.left().value().iterator().next());
198 public void testDeleteForwardingPathsWhenComponentinstanceDeleted() {
200 ComponentTypeEnum containerComponentType = ComponentTypeEnum.findByParamName("services");
201 String containerComponentID = "Service-comp";
202 String componentInstanceID = "NodeA1";
203 Service component = new Service();
205 component.addForwardingPath(createPath("path1", "NodeA1", "NodeB1", "1"));
206 component.addForwardingPath(createPath("Path2", "NodeA2", "NodeB2", "2"));
207 when(toscaOperationFacade.getToscaElement(eq(containerComponentID), any(ComponentParametersView.class)))
208 .thenReturn(Either.left(component));
209 when(toscaOperationFacade.getToscaElement(eq(containerComponentID))).thenReturn(Either.left(component));
210 when(forwardingPathOperation.deleteForwardingPath(any(Service.class), anySet()))
211 .thenReturn(Either.left(new HashSet<>()));
212 Either<ComponentInstance, ResponseFormat> responseFormatEither = componentInstanceBusinessLogic
213 .deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentID, componentInstanceID,
214 containerComponentType, Either.left(new ComponentInstance()));
215 Assert.assertTrue(responseFormatEither.isLeft());
220 public void testDeleteForwardingPathsWhenErrorInComponentinstanceDelete() {
222 ComponentTypeEnum containerComponentType = ComponentTypeEnum.findByParamName("services");
223 String containerComponentID = "Service-comp";
224 String componentInstanceID = "NodeA1";
225 Service component = new Service();
227 component.addForwardingPath(createPath("path1", "NodeA1", "NodeB1", "1"));
228 component.addForwardingPath(createPath("Path2", "NodeA2", "NodeB2", "2"));
229 when(toscaOperationFacade.getToscaElement(eq(containerComponentID), any(ComponentParametersView.class)))
230 .thenReturn(Either.left(component));
231 when(toscaOperationFacade.getToscaElement(eq(containerComponentID))).thenReturn(Either.left(component));
232 when(forwardingPathOperation.deleteForwardingPath(any(Service.class), anySet()))
233 .thenReturn(Either.left(new HashSet<>()));
234 Either<ComponentInstance, ResponseFormat> responseFormatEither = componentInstanceBusinessLogic
235 .deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentID, componentInstanceID,
236 containerComponentType, Either.right(new ResponseFormat()));
237 Assert.assertTrue(responseFormatEither.isRight());
241 private ForwardingPathDataDefinition createPath(String pathName, String fromNode, String toNode, String uniqueId) {
242 ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition(pathName);
243 forwardingPath.setProtocol("protocol");
244 forwardingPath.setDestinationPortNumber("port");
245 forwardingPath.setUniqueId(uniqueId);
246 ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition = new ListDataDefinition<>();
247 forwardingPathElementListDataDefinition.add(new ForwardingPathElementDataDefinition(fromNode, toNode,
248 "nodeAcpType", "nodeBcpType", "nodeDcpName", "nodeBcpName"));
249 forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
251 return forwardingPath;
254 private Map<String, ForwardingPathDataDefinition> generateForwardingPath(String componentInstanceID) {
255 ForwardingPathDataDefinition forwardingPath = new ForwardingPathDataDefinition("fpName");
256 String protocol = "protocol";
257 forwardingPath.setProtocol(protocol);
258 forwardingPath.setDestinationPortNumber("DestinationPortNumber");
259 forwardingPath.setUniqueId("FP-ID-1");
260 ListDataDefinition<ForwardingPathElementDataDefinition> forwardingPathElementListDataDefinition = new ListDataDefinition<>();
261 forwardingPathElementListDataDefinition.add(new ForwardingPathElementDataDefinition(componentInstanceID,
262 "nodeB", "nodeA_FORWARDER_CAPABILITY", "nodeBcpType", "nodeDcpName", "nodeBcpName"));
263 forwardingPath.setPathElements(forwardingPathElementListDataDefinition);
264 Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>();
265 forwardingPaths.put("1122", forwardingPath);
266 return forwardingPaths;
269 @SuppressWarnings("unchecked")
270 private void getServiceRelationByIdSuccess(Component component) {
271 Either<User, ActionStatus> eitherCreator = Either.left(user);
272 when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
273 Either<Component, StorageOperationStatus> getComponentRes = Either.left(component);
274 when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class)))
275 .thenReturn(getComponentRes);
277 Either<RequirementDataDefinition, StorageOperationStatus> getfulfilledRequirementRes = Either.left(requirement);
278 when(toscaOperationFacade.getFulfilledRequirementByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID),
279 eq(relation), any(BiPredicate.class))).thenReturn(getfulfilledRequirementRes);
281 Either<CapabilityDataDefinition, StorageOperationStatus> getfulfilledCapabilityRes = Either.left(capability);
282 when(toscaOperationFacade.getFulfilledCapabilityByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID), eq(relation),
283 any(BiPredicate.class))).thenReturn(getfulfilledCapabilityRes);
285 Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic
286 .getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
287 assertTrue(response.isLeft());
290 private void getServiceRelationByIdUserValidationFailure(Component component) {
291 // Either<User, ActionStatus> eitherCreator =
292 // Either.right(ActionStatus.USER_NOT_FOUND);
293 // when(userAdmin.getUser(eq(USER_ID),
294 // eq(false))).thenReturn(eitherCreator);
295 when(userValidations.validateUserExists(eq(USER_ID), eq("get relation by Id"), eq(false)))
296 .thenReturn(Either.right(new ResponseFormat(404)));
297 Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic
298 .getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
299 assertTrue(response.isRight());
302 private void getRelationByIdComponentNotFoundFailure(Component component) {
303 Either<User, ActionStatus> eitherCreator = Either.left(user);
304 when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator);
305 Either<Component, StorageOperationStatus> getComponentRes = Either.right(StorageOperationStatus.NOT_FOUND);
306 when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class)))
307 .thenReturn(getComponentRes);
309 Either<RequirementCapabilityRelDef, ResponseFormat> response = componentInstanceBusinessLogic
310 .getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType());
311 assertTrue(response.isRight());
314 private static void createMocks() {
315 componentsUtils = Mockito.mock(ComponentsUtils.class);
316 servletUtils = Mockito.mock(ServletUtils.class);
317 responseFormat = Mockito.mock(ResponseFormat.class);
318 toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class);
319 userAdmin = Mockito.mock(UserBusinessLogic.class);
320 user = Mockito.mock(User.class);
321 baseBusinessLogic = Mockito.mock(BaseBusinessLogic.class);
322 userValidations = Mockito.mock(UserValidations.class);
323 forwardingPathOperation = Mockito.mock(ForwardingPathOperation.class);
324 componentInstanceOperation = Mockito.mock(IComponentInstanceOperation.class);
325 artifactsBusinessLogic = Mockito.mock(ArtifactsBusinessLogic.class);
326 toscaDataDefinition = Mockito.mock(ToscaDataDefinition.class);
329 private static void setMocks() {
330 componentInstanceBusinessLogic = new ComponentInstanceBusinessLogic();
331 componentInstanceBusinessLogic.setToscaOperationFacade(toscaOperationFacade);
332 componentInstanceBusinessLogic.setUserAdmin(userAdmin);
333 componentInstanceBusinessLogic.setComponentsUtils(componentsUtils);
334 componentInstanceBusinessLogic.setUserValidations(userValidations);
335 componentInstanceBusinessLogic.setForwardingPathOperation(forwardingPathOperation);
338 private static void stubMethods() {
339 when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils);
340 when(userValidations.validateUserExists(eq(USER_ID), eq("get relation by Id"), eq(false)))
341 .thenReturn(Either.left(user));
342 when(componentsUtils.getResponseFormat(eq(ActionStatus.RELATION_NOT_FOUND), eq(RELATION_ID), eq(COMPONENT_ID)))
343 .thenReturn(responseFormat);
344 Either<User, ActionStatus> eitherGetUser = Either.left(user);
345 when(userAdmin.getUser("jh0003", false)).thenReturn(eitherGetUser);
346 when(userValidations.validateUserExists(eq(user.getUserId()), anyString(), eq(false)))
347 .thenReturn(Either.left(user));
350 private static void createComponents() {
357 private static Component createResource() {
358 resource = new Resource();
359 resource.setUniqueId(COMPONENT_ID);
360 resource.setComponentInstancesRelations(Lists.newArrayList(relation));
361 resource.setComponentInstances(Lists.newArrayList(toInstance, fromInstance));
362 resource.setCapabilities(toInstance.getCapabilities());
363 resource.setRequirements(fromInstance.getRequirements());
364 resource.setComponentType(ComponentTypeEnum.RESOURCE);
368 private static Component createService() {
369 service = new Service();
370 service.setUniqueId(COMPONENT_ID);
371 service.setComponentInstancesRelations(Lists.newArrayList(relation));
372 service.setComponentInstances(Lists.newArrayList(toInstance, fromInstance));
373 service.setCapabilities(toInstance.getCapabilities());
374 service.setRequirements(fromInstance.getRequirements());
375 service.setComponentType(ComponentTypeEnum.SERVICE);
379 private static ComponentInstance createInstances() {
380 toInstance = new ComponentInstance();
381 toInstance.setUniqueId(TO_INSTANCE_ID);
382 toInstance.setComponentUid("uuuiiid");
383 toInstance.setName("tests");
385 fromInstance = new ComponentInstance();
386 fromInstance.setUniqueId(FROM_INSTANCE_ID);
388 capability = new CapabilityDataDefinition();
389 capability.setOwnerId(CAPABILITY_OWNER_ID);
390 capability.setUniqueId(CAPABILITY_UID);
391 capability.setName(CAPABILITY_NAME);
393 Map<String, List<CapabilityDefinition>> capabilities = new HashMap<>();
394 capabilities.put(capability.getName(), Lists.newArrayList(new CapabilityDefinition(capability)));
396 requirement = new RequirementDataDefinition();
397 requirement.setOwnerId(REQUIREMENT_OWNER_ID);
398 requirement.setUniqueId(REQUIREMENT_UID);
399 requirement.setName(REQUIREMENT_NAME);
400 requirement.setRelationship(RELATIONSHIP_TYPE);
402 Map<String, List<RequirementDefinition>> requirements = new HashMap<>();
403 requirements.put(requirement.getCapability(), Lists.newArrayList(new RequirementDefinition(requirement)));
405 toInstance.setCapabilities(capabilities);
406 fromInstance.setRequirements(requirements);
410 private static void createRelation() {
412 relation = new RequirementCapabilityRelDef();
413 CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship();
414 RelationshipInfo relationInfo = new RelationshipInfo();
415 relationInfo.setId(RELATION_ID);
416 relationship.setRelation(relationInfo);
418 relation.setRelationships(Lists.newArrayList(relationship));
419 relation.setToNode(TO_INSTANCE_ID);
420 relation.setFromNode(FROM_INSTANCE_ID);
422 relationInfo.setCapabilityOwnerId(CAPABILITY_OWNER_ID);
423 relationInfo.setCapabilityUid(CAPABILITY_UID);
424 relationInfo.setCapability(CAPABILITY_NAME);
425 relationInfo.setRequirementOwnerId(REQUIREMENT_OWNER_ID);
426 relationInfo.setRequirementUid(REQUIREMENT_UID);
427 relationInfo.setRequirement(REQUIREMENT_NAME);
428 RelationshipImpl relationshipImpl = new RelationshipImpl();
429 relationshipImpl.setType(RELATIONSHIP_TYPE);
430 relationInfo.setRelationships(relationshipImpl);
433 ///////////////////////////////////////////////////////////////////////////////
434 /////////////////////////////new test//////////////////////////////////////////
435 ///////////////////////////////////////////////////////////////////////////////
438 private ComponentInstanceBusinessLogic createTestSubject() {
439 return componentInstanceBusinessLogic;
447 public void testChangeServiceProxyVersion() throws Exception {
448 ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
449 String containerComponentType = "";
450 String containerComponentId = "";
451 String serviceProxyId = "";
452 String userId = user.getUserId();
453 Either<ComponentInstance, ResponseFormat> result;
456 componentInstanceBusinessLogic = createTestSubject();
457 result = componentInstanceBusinessLogic.changeServiceProxyVersion(containerComponentType, containerComponentId, serviceProxyId,
468 public void testCreateServiceProxy() throws Exception {
469 ComponentInstanceBusinessLogic testSubject;
470 String containerComponentType = "";
471 String containerComponentId = "";
472 String userId = user.getUserId();
473 ComponentInstance componentInstance = createInstances();
474 Either<ComponentInstance, ResponseFormat> result;
477 testSubject = createTestSubject();
478 result = testSubject.createServiceProxy(containerComponentType, containerComponentId, userId,
487 public void testDeleteForwardingPathsRelatedTobeDeletedComponentInstance() throws Exception {
488 ComponentInstanceBusinessLogic testSubject;
489 String containerComponentId = "";
490 String componentInstanceId = "";
491 ComponentTypeEnum containerComponentType = ComponentTypeEnum.RESOURCE;
492 Either<ComponentInstance, ResponseFormat> resultOp = null;
493 Either<ComponentInstance, ResponseFormat> result;
496 testSubject = createTestSubject();
497 result = testSubject.deleteForwardingPathsRelatedTobeDeletedComponentInstance(containerComponentId,
498 componentInstanceId, containerComponentType, resultOp);
503 public void testDeleteServiceProxy() throws Exception {
504 ComponentInstanceBusinessLogic testSubject;
505 String containerComponentType = "";
506 String containerComponentId = "";
507 String serviceProxyId = "";
508 String userId = user.getUserId();
509 Either<ComponentInstance, ResponseFormat> result;
512 testSubject = createTestSubject();
513 result = testSubject.deleteServiceProxy(containerComponentType, containerComponentId, serviceProxyId, userId);
522 public void testGetComponentInstanceInputsByInputId() throws Exception {
523 ComponentInstanceBusinessLogic testSubject;
524 Component component = new Service();
526 List<ComponentInstanceInput> result;
529 testSubject = createTestSubject();
530 result = testSubject.getComponentInstanceInputsByInputId(component, inputId);
536 public void testGetComponentInstancePropertiesByInputId() throws Exception {
537 ComponentInstanceBusinessLogic testSubject;
538 Component component = new Service();
540 List<ComponentInstanceProperty> result;
543 testSubject = createTestSubject();
544 result = testSubject.getComponentInstancePropertiesByInputId(component, inputId);
549 public void testGetRelationById() throws Exception {
550 ComponentInstanceBusinessLogic testSubject;
551 String componentId = "";
552 String relationId = "";
553 String userId = user.getUserId();
554 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE_INSTANCE;
555 Either<RequirementCapabilityRelDef, ResponseFormat> result;
558 testSubject = createTestSubject();
559 result = testSubject.getRelationById(componentId, relationId, userId, componentTypeEnum);
567 public void testCreateComponentInstance_1() throws Exception {
568 ComponentInstanceBusinessLogic testSubject;String containerComponentParam = "";
569 String containerComponentId = "";
570 String userId = user.getUserId();
571 ComponentInstance resourceInstance = null;
572 boolean inTransaction = false;
573 boolean needLock = false;
574 Either<ComponentInstance,ResponseFormat> result;
577 testSubject=createTestSubject();result=testSubject.createComponentInstance(containerComponentParam, containerComponentId, userId, resourceInstance, inTransaction, needLock);
585 public void testCreateAndAssociateRIToRI() throws Exception {
586 ComponentInstanceBusinessLogic testSubject;
588 String containerComponentParam = "";
589 String containerComponentId = "";
590 String userId = user.getUserId();
591 CreateAndAssotiateInfo createAndAssotiateInfo = new CreateAndAssotiateInfo(null, null);
592 Either<CreateAndAssotiateInfo,ResponseFormat> result;
595 testSubject=createTestSubject();result=testSubject.createAndAssociateRIToRI(containerComponentParam, containerComponentId, userId, createAndAssotiateInfo);
599 public void testGetOriginComponentFromComponentInstance_1() throws Exception {
600 ComponentInstanceBusinessLogic testSubject;
601 Component compoent = createResource();
602 String componentInstanceName = "";
603 String origComponetId = compoent.getUniqueId();
604 Either<Component, StorageOperationStatus> oldResourceRes = Either.left(compoent);
605 when(toscaOperationFacade.getToscaFullElement(compoent.getUniqueId())).thenReturn(oldResourceRes);
606 Either<Component,ResponseFormat> result;
609 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "getOriginComponentFromComponentInstance", new Object[]{componentInstanceName, origComponetId});
614 public void testCreateComponentInstanceOnGraph() throws Exception {
615 ComponentInstanceBusinessLogic testSubject;
616 Component containerComponent = createResource();
617 Component originComponent = null;
618 ComponentInstance componentInstance = createInstances();
619 Either<ComponentInstance,ResponseFormat> result;
621 Either<ImmutablePair<Component, String>, StorageOperationStatus> result2 = Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND);
622 when(toscaOperationFacade.addComponentInstanceToTopologyTemplate(containerComponent, containerComponent,componentInstance, false, user)).thenReturn(result2);
625 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "createComponentInstanceOnGraph", new Object[]{containerComponent, containerComponent, componentInstance, user});
628 @Test(expected=NullPointerException.class)
629 public void testCreateComponentInstanceOnGraph2() throws Exception {
630 ComponentInstanceBusinessLogic testSubject;
631 Component containerComponent = createResource();
632 containerComponent.setName("name");
633 ComponentInstance componentInstance = createInstances();
634 Either<ComponentInstance,ResponseFormat> result;
635 ImmutablePair<Component, String> pair = new ImmutablePair<>(containerComponent,"");
640 Either<ImmutablePair<Component, String>, StorageOperationStatus> result2 = Either.left(pair);
641 when(toscaOperationFacade.addComponentInstanceToTopologyTemplate(containerComponent, containerComponent,componentInstance, false, user)).thenReturn(result2);
644 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "createComponentInstanceOnGraph", new Object[]{containerComponent, containerComponent, componentInstance, user});
648 public void testUpdateComponentInstanceMetadata() throws Exception {
649 ComponentInstanceBusinessLogic testSubject;
650 String containerComponentParam = "";
651 String containerComponentId = "";
652 String componentInstanceId = "";
653 String userId = user.getUserId();
654 ComponentInstance componentInstance = createInstances();
655 Either<ComponentInstance,ResponseFormat> result;
658 testSubject=createTestSubject();result=testSubject.updateComponentInstanceMetadata(containerComponentParam, containerComponentId, componentInstanceId, userId, componentInstance);
663 public void testUpdateComponentInstanceMetadata_1() throws Exception {
664 ComponentInstanceBusinessLogic testSubject;String containerComponentParam = "";
665 String containerComponentId = "";
666 String componentInstanceId = "";
667 String userId = user.getUserId();
668 ComponentInstance componentInstance = createInstances();
669 boolean inTransaction = false;
670 boolean needLock = false;
671 boolean createNewTransaction = false;
672 Either<ComponentInstance,ResponseFormat> result;
675 testSubject=createTestSubject();result=testSubject.updateComponentInstanceMetadata(containerComponentParam, containerComponentId, componentInstanceId, userId, componentInstance, inTransaction, needLock, createNewTransaction);
683 public void testValidateParent() throws Exception {
684 ComponentInstanceBusinessLogic testSubject;
685 Component containerComponent = createResource();
686 String nodeTemplateId = "";
690 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "validateParent", new Object[]{containerComponent, nodeTemplateId});
695 public void testGetComponentType() throws Exception {
696 ComponentInstanceBusinessLogic testSubject;
697 ComponentTypeEnum containerComponentType = ComponentTypeEnum.RESOURCE;
698 ComponentTypeEnum result;
701 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "getComponentType", new Object[]{ComponentTypeEnum.class});
707 public void testGetNewGroupName() throws Exception {
708 ComponentInstanceBusinessLogic testSubject;String oldPrefix = "";
709 String newNormailzedPrefix = "";
710 String qualifiedGroupInstanceName = "";
714 testSubject=createTestSubject();
715 result=Deencapsulation.invoke(testSubject, "getNewGroupName", new Object[]{oldPrefix, newNormailzedPrefix, qualifiedGroupInstanceName});
720 public void testUpdateComponentInstanceMetadata_3() throws Exception {
721 ComponentInstanceBusinessLogic testSubject;
722 ComponentInstance oldComponentInstance = createInstances();
723 ComponentInstance newComponentInstance = null;
724 ComponentInstance result;
727 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "updateComponentInstanceMetadata", new Object[]{oldComponentInstance, oldComponentInstance});
732 public void testDeleteComponentInstance() throws Exception {
733 ComponentInstanceBusinessLogic testSubject;String containerComponentParam = "";
734 String containerComponentId = "";
735 String componentInstanceId = "";
736 String userId = user.getUserId();
737 Either<ComponentInstance,ResponseFormat> result;
740 testSubject=createTestSubject();result=testSubject.deleteComponentInstance(containerComponentParam, containerComponentId, componentInstanceId, userId);
745 public void testDeleteForwardingPaths() throws Exception {
746 ComponentInstanceBusinessLogic testSubject;
747 Component service = createService();
748 String serviceId = service.getUniqueId();
749 List<String> pathIdsToDelete = new ArrayList<>();
750 Either<Set<String>,ResponseFormat> result;
752 // Either<Service, StorageOperationStatus> storageStatus = toscaOperationFacade.getToscaElement(serviceId);
753 when(toscaOperationFacade.getToscaElement(serviceId)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
756 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "deleteForwardingPaths", new Object[]{serviceId, pathIdsToDelete});
761 public void testAssociateRIToRIOnGraph() throws Exception {
762 ComponentInstanceBusinessLogic testSubject;
763 Component containerComponent = createResource();
764 RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef();
765 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
766 boolean inTransaction = false;
767 Either<RequirementCapabilityRelDef,ResponseFormat> result;
771 Either<RequirementCapabilityRelDef, StorageOperationStatus> getResourceResult = Either.left(requirementDef);
772 when(toscaOperationFacade.associateResourceInstances(containerComponent.getUniqueId(), requirementDef)).thenReturn(getResourceResult);
775 testSubject=createTestSubject();result=testSubject.associateRIToRIOnGraph(containerComponent, requirementDef, componentTypeEnum, inTransaction);
781 public void testFindRelation() throws Exception {
782 ComponentInstanceBusinessLogic testSubject;
783 String relationId = "";
784 List<RequirementCapabilityRelDef> requirementCapabilityRelations = new ArrayList<>();
785 RequirementCapabilityRelDef result;
788 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "findRelation", new Object[]{relationId, requirementCapabilityRelations});
793 public void testIsNetworkRoleServiceProperty() throws Exception {
794 ComponentInstanceBusinessLogic testSubject;
795 ComponentInstanceProperty property = new ComponentInstanceProperty();
796 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
800 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "isNetworkRoleServiceProperty", new Object[]{property, componentTypeEnum});
805 public void testConcatServiceNameToVLINetworkRolePropertiesValues() throws Exception {
806 ComponentInstanceBusinessLogic testSubject;
807 ToscaOperationFacade toscaOperationFacade = new ToscaOperationFacade();
808 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
809 String componentId = "";
810 String resourceInstanceId = "";
811 List<ComponentInstanceProperty> properties = new ArrayList<>();
812 StorageOperationStatus result;
815 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "concatServiceNameToVLINetworkRolePropertiesValues", new Object[]{toscaOperationFacade, componentTypeEnum, componentId, resourceInstanceId, properties});
820 public void testCreateOrUpdatePropertiesValues() throws Exception {
821 ComponentInstanceBusinessLogic testSubject;
822 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
823 Component component = createResource();
824 String componentId = component.getUniqueId();
825 String resourceInstanceId = "";
826 List<ComponentInstanceProperty> properties = new ArrayList<>();
827 String userId = user.getUserId();
828 Either<List<ComponentInstanceProperty>,ResponseFormat> result;
830 // Either<Component, StorageOperationStatus> getResourceResult = toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseAll);
831 when(toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(component));
834 testSubject=createTestSubject();
835 result=testSubject.createOrUpdatePropertiesValues(componentTypeEnum, componentId, resourceInstanceId, properties, userId);
837 componentTypeEnum =null;
838 result=testSubject.createOrUpdatePropertiesValues(componentTypeEnum, componentId, resourceInstanceId, properties, userId);
840 when(toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
841 result=testSubject.createOrUpdatePropertiesValues(componentTypeEnum, componentId, resourceInstanceId, properties, userId);
847 public void testUpdateCapabilityPropertyOnContainerComponent() throws Exception {
848 ComponentInstanceBusinessLogic testSubject;
849 ComponentInstanceProperty property = new ComponentInstanceProperty();
850 String newValue = "";
851 Component containerComponent = createResource();
852 ComponentInstance foundResourceInstance = createInstances();
853 String capabilityType = "";
854 String capabilityName = "";
855 ResponseFormat result;
858 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "updateCapabilityPropertyOnContainerComponent", new Object[]{property, newValue, containerComponent, foundResourceInstance, capabilityType, capabilityName});
864 public void testCreateOrUpdateInstanceInputValues() throws Exception {
865 ComponentInstanceBusinessLogic testSubject;
866 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
867 Component resource = createResource();
868 String componentId = resource.getUniqueId();
869 String resourceInstanceId = "";
870 List<ComponentInstanceInput> inputs = new ArrayList<>();
871 String userId = user.getUserId();
872 Either<List<ComponentInstanceInput>,ResponseFormat> result;
874 when(toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.left(resource));
877 testSubject=createTestSubject();
878 result=testSubject.createOrUpdateInstanceInputValues(componentTypeEnum, componentId, resourceInstanceId, inputs, userId);
879 componentTypeEnum =null;
880 result=testSubject.createOrUpdateInstanceInputValues(componentTypeEnum, componentId, resourceInstanceId, inputs, userId);
883 when(toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseAll)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
884 result=testSubject.createOrUpdateInstanceInputValues(componentTypeEnum, componentId, resourceInstanceId, inputs, userId);
890 public void testCreateOrUpdateGroupInstancePropertyValue() throws Exception {
891 ComponentInstanceBusinessLogic testSubject;
892 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
893 Component resource = createResource();
894 String componentId = resource.getUniqueId();
895 String resourceInstanceId = "";
896 String groupInstanceId = "";
897 ComponentInstanceProperty property = new ComponentInstanceProperty();
898 String userId = user.getUserId();
899 Either<ComponentInstanceProperty,ResponseFormat> result;
902 when(toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(resource));
905 testSubject=createTestSubject();
906 result=testSubject.createOrUpdateGroupInstancePropertyValue(componentTypeEnum, componentId, resourceInstanceId, groupInstanceId, property, userId);
907 componentTypeEnum = null;
908 result=testSubject.createOrUpdateGroupInstancePropertyValue(componentTypeEnum, componentId, resourceInstanceId, groupInstanceId, property, userId);
910 when(toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
911 result=testSubject.createOrUpdateGroupInstancePropertyValue(componentTypeEnum, componentId, resourceInstanceId, groupInstanceId, property, userId);
916 public void testCreateOrUpdateInputValue() throws Exception {
917 ComponentInstanceBusinessLogic testSubject;
918 Component component = createResource();
919 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
920 String componentId = component.getUniqueId();
921 String resourceInstanceId = component.getUniqueId();
922 ComponentInstanceInput inputProperty = new ComponentInstanceInput();
923 String userId = user.getUserId();
924 Either<ComponentInstanceInput,ResponseFormat> result;
927 Either<Component, StorageOperationStatus> getResourceResult = Either.left(component);
928 when(toscaOperationFacade.getToscaElement(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata)).thenReturn(getResourceResult);
931 testSubject=createTestSubject();
932 result=testSubject.createOrUpdateInputValue(componentTypeEnum, componentId, resourceInstanceId, inputProperty, userId);
934 componentTypeEnum = null;
935 result=testSubject.createOrUpdateInputValue(componentTypeEnum, componentId, resourceInstanceId, inputProperty, userId);
937 when(toscaOperationFacade.getToscaElement(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
938 result=testSubject.createOrUpdateInputValue(componentTypeEnum, componentId, resourceInstanceId, inputProperty, userId);
943 public void testDeletePropertyValue() throws Exception {
944 ComponentInstanceBusinessLogic testSubject;
945 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
946 Component service = createService();
947 String serviceId = service.getUniqueId();
948 String resourceInstanceId = "";
949 String propertyValueId = "";
950 String userId = user.getUserId();
951 Either<ComponentInstanceProperty,ResponseFormat> result;
953 when(toscaOperationFacade.getToscaElement(serviceId, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.left(service));
956 testSubject=createTestSubject();
957 result=testSubject.deletePropertyValue(componentTypeEnum, serviceId, resourceInstanceId, propertyValueId, userId);
958 componentTypeEnum= null;
959 result=testSubject.deletePropertyValue(componentTypeEnum, serviceId, resourceInstanceId, propertyValueId, userId);
961 when(toscaOperationFacade.getToscaElement(serviceId, JsonParseFlagEnum.ParseMetadata)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
962 result=testSubject.deletePropertyValue(componentTypeEnum, serviceId, resourceInstanceId, propertyValueId, userId);
967 public void testGetAndValidateOriginComponentOfComponentInstance() throws Exception {
968 ComponentInstanceBusinessLogic testSubject;
969 ComponentTypeEnum containerComponentType = ComponentTypeEnum.RESOURCE;
970 Component resource = createResource();
971 ComponentInstance componentInstance = createInstances();
972 Either<Component,ResponseFormat> result;
974 when(toscaOperationFacade.getToscaFullElement(componentInstance.getComponentUid())).thenReturn(Either.left(resource));
977 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "getAndValidateOriginComponentOfComponentInstance", new Object[]{containerComponentType, componentInstance});
985 public void testGetComponentParametersViewForForwardingPath() throws Exception {
986 ComponentInstanceBusinessLogic testSubject;
987 ComponentParametersView result;
990 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "getComponentParametersViewForForwardingPath");
995 public void testChangeComponentInstanceVersion() throws Exception {
996 ComponentInstanceBusinessLogic testSubject;
997 String containerComponentParam = "";
998 String containerComponentId = "";
999 String componentInstanceId = "";
1000 String userId = user.getUserId();
1001 ComponentInstance newComponentInstance = createInstances();
1002 Either<ComponentInstance,ResponseFormat> result;
1005 testSubject=createTestSubject();result=testSubject.changeComponentInstanceVersion(containerComponentParam, containerComponentId, componentInstanceId, userId, newComponentInstance);
1006 newComponentInstance = null;
1007 testSubject=createTestSubject();result=testSubject.changeComponentInstanceVersion(containerComponentParam, containerComponentId, componentInstanceId, userId, newComponentInstance);
1012 public void testValidateInstanceNameUniquenessUponUpdate() throws Exception {
1013 ComponentInstanceBusinessLogic testSubject;
1014 Component containerComponent = createResource();
1015 ComponentInstance oldComponentInstance = createInstances();
1016 String newInstanceName = oldComponentInstance.getName();
1020 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "validateInstanceNameUniquenessUponUpdate", new Object[]{containerComponent, oldComponentInstance, newInstanceName});
1025 public void testGetResourceInstanceById() throws Exception {
1026 ComponentInstanceBusinessLogic testSubject;
1027 Component containerComponent = createResource();
1028 String instanceId = "";
1029 Either<ComponentInstance,StorageOperationStatus> result;
1032 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "getResourceInstanceById", new Object[]{containerComponent, instanceId});
1037 public void testBuildComponentInstance() throws Exception {
1038 ComponentInstanceBusinessLogic testSubject;
1039 ComponentInstance resourceInstanceForUpdate = createInstances();
1040 ComponentInstance origInstanceForUpdate = null;
1041 ComponentInstance result;
1044 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "buildComponentInstance", new Object[]{resourceInstanceForUpdate, resourceInstanceForUpdate});
1052 public void testFindCapabilityOfInstance() throws Exception {
1053 ComponentInstanceBusinessLogic testSubject;String componentId = "";
1054 String instanceId = "";
1055 String capabilityType = "";
1056 String capabilityName = "";
1057 String ownerId = "";
1058 Map<String,List<CapabilityDefinition>> instanceCapabilities = new HashMap<>();
1059 Either<List<ComponentInstanceProperty>,ResponseFormat> result;
1062 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "findCapabilityOfInstance", new Object[]{componentId, instanceId, capabilityType, capabilityName, ownerId, instanceCapabilities});
1067 public void testFetchComponentInstanceCapabilityProperties() throws Exception {
1068 ComponentInstanceBusinessLogic testSubject;String componentId = "";
1069 String instanceId = "";
1070 String capabilityType = "";
1071 String capabilityName = "";
1072 String ownerId = "";
1073 Either<List<ComponentInstanceProperty>,ResponseFormat> result;
1076 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "fetchComponentInstanceCapabilityProperties", new Object[]{componentId, instanceId, capabilityType, capabilityName, ownerId});
1081 public void testUpdateCapabilityPropertyOnContainerComponent_1() throws Exception {
1082 ComponentInstanceBusinessLogic testSubject;
1083 ComponentInstanceProperty property = new ComponentInstanceProperty();
1084 String newValue = "";
1085 Component containerComponent = createResource();
1086 ComponentInstance foundResourceInstance = createInstances();
1087 String capabilityType = "";
1088 String capabilityName = "";
1089 String ownerId = "";
1090 ResponseFormat result;
1093 testSubject=createTestSubject();result=Deencapsulation.invoke(testSubject, "updateCapabilityPropertyOnContainerComponent", new Object[]{property, newValue, containerComponent, foundResourceInstance, capabilityType, capabilityName, ownerId});
1098 public void testUpdateInstanceCapabilityProperties() throws Exception {
1099 ComponentInstanceBusinessLogic testSubject;
1100 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
1101 Component resource = createResource();
1102 String containerComponentId = resource.getUniqueId();
1103 String componentInstanceUniqueId = "";
1104 String capabilityType = "";
1105 String capabilityName = "";
1106 String ownerId = "";
1107 List<ComponentInstanceProperty> properties = new ArrayList<>();
1108 String userId = user.getUserId();
1109 Either<List<ComponentInstanceProperty>,ResponseFormat> result;
1112 when(toscaOperationFacade.getToscaFullElement(containerComponentId)).thenReturn(Either.left(resource));
1117 testSubject=createTestSubject();
1118 result=testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, ownerId, properties, userId);
1119 when(toscaOperationFacade.getToscaFullElement(containerComponentId)).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
1120 result=testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, ownerId, properties, userId);
1121 componentTypeEnum = null;
1122 result=testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, ownerId, properties, userId);
1129 public void testUpdateInstanceCapabilityProperties_1() throws Exception {
1130 ComponentInstanceBusinessLogic testSubject;
1131 ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.RESOURCE;
1132 Component component = createResource();
1133 String containerComponentId = component.getUniqueId();
1134 String componentInstanceUniqueId = "";
1135 String capabilityType = "";
1136 String capabilityName = "";
1137 List<ComponentInstanceProperty> properties = new ArrayList<>();
1138 String userId = user.getUserId();
1139 Either<List<ComponentInstanceProperty>,ResponseFormat> result;
1142 when(toscaOperationFacade.getToscaFullElement(containerComponentId)).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
1144 testSubject=createTestSubject();
1145 result=testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, properties, userId);
1146 when(toscaOperationFacade.getToscaFullElement(containerComponentId)).thenReturn(Either.left(component));
1147 result=testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, properties, userId);