2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.ci.tests.execute.property;
23 import fj.data.Either;
24 import org.junit.Rule;
25 import org.junit.rules.TestName;
26 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
27 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
28 import org.openecomp.sdc.be.model.ComponentInstance;
29 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
30 import org.openecomp.sdc.be.model.Resource;
31 import org.openecomp.sdc.be.model.Service;
32 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
33 import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
34 import org.openecomp.sdc.ci.tests.datatypes.enums.*;
35 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
36 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
37 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
38 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
39 import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
40 import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
41 import org.testng.annotations.BeforeMethod;
42 import org.testng.annotations.Test;
44 import java.util.ArrayList;
45 import java.util.List;
47 import static org.testng.AssertJUnit.assertTrue;
49 // open bug for this class: DE199108 - closed, DE199741
50 public class ComponentInstancePropertyTest extends ComponentBaseTest {
52 protected Resource basicVFC;
53 protected Resource vfc1FromBasicVFC;
54 protected Resource vfc2FromVfc1;
55 protected Resource vfResource;
57 private List<ComponentInstanceProperty> expectedPropertyList;
58 private List<ComponentInstanceProperty> actualPropertyList;
59 // protected String updatedStringValue = "{Not Default String Value}";
60 protected String updatedStringValue = "Not Default String Value";
61 protected String updatedIntegerValue = "666";
62 protected String updatedBooleanValue = "false";
63 protected String newStringPropName = "stringProp2";
64 protected String newIntegerPropName = "integerProp2";
65 protected String newBooleanPropName = "booleanProp2";
66 // bug DE199741 protected String newStringPropValue = "<second string
68 protected String newStringPropValue = "second string value";
69 protected String newIntegerPropValue = "888";
70 protected String newBooleanPropValue = "false";
74 expectedPropertyList = new ArrayList<>();
75 actualPropertyList = new ArrayList<>();
79 public static TestName name = new TestName();
81 // --------------Regular
82 // resource-------------------------------------------------------------------------------
85 public void nestedResourceProperty3Levels() throws Exception {
88 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
90 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
91 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
93 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
94 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
96 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
97 actualPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, actualPropertyList);
98 assertTrue("check list size failed, expected 3", actualPropertyList.size() == 3);
103 // resource-----------------------------------------------------------
106 public void nestedVfResourceProperty3Levels() throws Exception {
108 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
109 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
110 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
111 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
112 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
114 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
115 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
117 // create VF + add RI
118 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
120 ComponentInstance componentInstDetails = AtomicOperationUtils
121 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
123 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
124 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
127 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
128 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
129 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
133 public void nestedVfResourceProperty3LevelsAndCpWithProp() throws Exception {
135 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
136 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
137 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
138 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
139 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
141 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
142 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
145 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
146 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
148 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
149 cpStringProperty.setName("Different Name");
150 cpStringProperty.setPropertyDefaultValue("Different value from default");
151 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
152 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
153 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
154 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
155 // create VF + add RI
156 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
158 ComponentInstance componentInstDetails = AtomicOperationUtils
159 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
161 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
162 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
164 componentInstDetails = AtomicOperationUtils
165 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
166 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
167 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
170 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
171 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
172 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
176 public void nestedCertifiedVfResourceProperty3Levels() throws Exception {
177 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
178 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
179 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
180 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
181 LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
183 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
184 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
185 // create VF + add RI
186 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
188 ComponentInstance componentInstDetails = AtomicOperationUtils
189 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
191 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
192 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
195 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
196 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
197 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
198 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
200 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
201 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
205 public void nestedVfResourceProperty3Levels2SameResInstances() throws Exception {
207 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
208 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
209 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
210 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
211 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
213 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
214 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
215 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
216 // create VF + add RI
217 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
219 ComponentInstance componentInstDetails = AtomicOperationUtils
220 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
222 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
224 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
227 componentInstDetails = AtomicOperationUtils
228 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
230 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
231 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
233 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
234 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
235 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
238 // ------------------update resource
239 // property-----------------------------------
242 public void nestedVfResourceProperty3LevelsUpdateFirstLevelProperty() throws Exception {
244 basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
245 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
247 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
248 .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
249 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
250 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
251 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
253 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
254 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
255 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
256 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
258 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
259 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
261 // create VF + add RI
262 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
264 ComponentInstance componentInstDetails = AtomicOperationUtils
265 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
267 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
268 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
271 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
272 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
275 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
278 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
279 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
280 expectedUpdatePropDetails.setValue(updatedStringValue);
281 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
282 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
283 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
284 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
285 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
286 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
288 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
290 actualPropertyList = new ArrayList<>();
291 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
293 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
294 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
295 assertTrue("property was not updated propely",
296 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
301 public void nestedVfResourceProperty3LevelsUpdateSecondLevelProperty() throws Exception {
302 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
305 vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
306 basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
307 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
308 .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
309 UserRoleEnum.DESIGNER, true);
310 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
311 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
312 AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
315 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
316 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
318 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
319 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
321 // create VF + add RI
322 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
324 ComponentInstance componentInstDetails = AtomicOperationUtils
325 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
327 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
328 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
330 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
331 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
334 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
337 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
338 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
339 expectedUpdatePropDetails.setValue(updatedIntegerValue);
340 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
341 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
342 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
343 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
345 "expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS
346 + " ,but was " + updatePropertyValueOnResourceInstance.getErrorCode(),
347 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
349 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
351 actualPropertyList = new ArrayList<>();
352 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
353 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
354 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
355 assertTrue("property was not updated properly",
356 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
361 public void nestedVfResourceProperty3LevelsUpdateThirdLevelProperty() throws Exception {
363 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
364 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
365 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
368 vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
369 vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
370 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
371 .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
372 UserRoleEnum.DESIGNER, true);
373 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
374 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
375 AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
378 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
379 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
381 // create VF + add RI
382 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
384 ComponentInstance componentInstDetails = AtomicOperationUtils
385 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
387 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
388 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
390 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
391 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
394 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
397 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
398 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
399 expectedUpdatePropDetails.setValue(updatedBooleanValue);
400 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
401 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
402 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
403 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
404 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
405 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
407 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
409 actualPropertyList = new ArrayList<>();
410 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
411 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
412 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
413 assertTrue("property was not updated propely",
414 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
418 // ---------------------Service------------------------------------------------------------------------
421 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
424 public void serviceWithNestedResourceProperty3Levels() throws Exception {
426 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
427 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
428 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
429 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
430 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
431 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
432 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
434 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
436 ComponentInstance componentInstDetails = AtomicOperationUtils
437 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
439 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
440 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
441 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
443 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
444 componentInstDetails = AtomicOperationUtils
445 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
447 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
448 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
449 expectedPropertyList);
450 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
451 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
456 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
460 public void serviceWithNestedResourceProperty3LevelsAndVfProperty() throws Exception {
462 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
463 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
464 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
465 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
466 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
467 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
468 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
470 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
472 ComponentInstance componentInstDetails = AtomicOperationUtils
473 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
475 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
476 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
478 PropertyReqDetails propDetails = ElementFactory.getDefaultBooleanProperty();
479 propDetails.setName(newBooleanPropName);
480 propDetails.setPropertyDefaultValue(newBooleanPropValue);
481 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
482 propDetails = ElementFactory.getDefaultStringProperty();
483 propDetails.setName(newStringPropName);
484 propDetails.setPropertyDefaultValue(newStringPropValue);
485 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
486 propDetails = ElementFactory.getDefaultIntegerProperty();
487 propDetails.setName(newIntegerPropName);
488 propDetails.setPropertyDefaultValue(newIntegerPropValue);
489 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
490 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
491 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
492 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfResource, expectedPropertyList);
494 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
495 componentInstDetails = AtomicOperationUtils
496 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
498 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
499 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
500 expectedPropertyList);
501 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
502 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
507 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
508 * (p1) CP(VF inst) (p5)
511 public void serviceWithNestedResourceProperty3LevelsAndCp() throws Exception {
513 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
514 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
515 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
516 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
517 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
518 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
519 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
522 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
523 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
525 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
526 cpStringProperty.setName("Different Name");
527 cpStringProperty.setPropertyDefaultValue("Different value from default");
528 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
529 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
530 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
531 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
532 // create VF + add RI
533 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
535 ComponentInstance componentInstDetails = AtomicOperationUtils
536 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
538 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
539 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
541 componentInstDetails = AtomicOperationUtils
542 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
543 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
544 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
545 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
548 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
549 componentInstDetails = AtomicOperationUtils
550 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
552 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
553 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
554 expectedPropertyList);
555 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
556 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
561 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
565 public void serviceWithNestedResourceProperty3LevelsAndCpResInst() throws Exception {
567 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
568 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
569 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
570 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
571 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
572 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
573 // expectedPropertyList =
574 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
575 // expectedPropertyList);
578 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
579 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
581 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
582 cpStringProperty.setName("Different Name");
583 cpStringProperty.setPropertyDefaultValue("Different value from default");
584 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
585 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
586 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
587 // create VF + add RI
588 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
590 ComponentInstance componentInstDetails = AtomicOperationUtils
591 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
593 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
594 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
597 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
598 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
599 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
601 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
603 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
604 componentInstDetails = AtomicOperationUtils
605 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
607 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
608 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
609 expectedPropertyList);
610 componentInstDetails = AtomicOperationUtils
611 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
612 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
613 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
614 expectedPropertyList);
615 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
616 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
621 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3) (p2) (p1)
622 * | (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
624 * VF2(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3') (p2') (p1') |
625 * (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
628 public void serviceNestedVfResourceProperty3Levels2SameResInstances() throws Exception {
630 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
631 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
632 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
633 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
634 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
635 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
637 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
638 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
640 // create VF + add RI
641 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
643 ComponentInstance componentInstDetails = AtomicOperationUtils
644 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
646 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
648 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
651 componentInstDetails = AtomicOperationUtils
652 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
654 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
655 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
657 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
658 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
659 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
660 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
663 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
664 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
665 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
667 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
669 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
670 componentInstDetails = AtomicOperationUtils
671 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
673 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
674 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
675 expectedPropertyList);
676 componentInstDetails = AtomicOperationUtils
677 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
679 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
680 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
681 expectedPropertyList);
682 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
683 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
684 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
688 // service test template
690 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
694 public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty() throws Exception {
696 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
697 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
698 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
699 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
700 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
701 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
703 // create VF + add RI
704 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
706 ComponentInstance componentInstDetails = AtomicOperationUtils
707 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
709 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
710 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
711 newProp.setName(newStringPropName);
712 newProp.setPropertyDefaultValue(newStringPropValue);
713 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
714 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
715 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
718 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
719 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
720 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
722 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
723 componentInstDetails = AtomicOperationUtils
724 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
726 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
727 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
728 expectedPropertyList);
729 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
730 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
731 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
736 * update property(p4)
739 * VFC(p1) ^ | VFC(p2) ^ | Service-->VF(inst)-->VF-->(VFC(inst)-->VFC(p3)
743 public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty_UpdateVfproperty() throws Exception {
744 // Create VFC(check-in state) derived from another resource
745 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
746 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
747 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
748 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
749 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
750 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
752 // create VF + add RI
753 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
755 ComponentInstance componentInstDetails = AtomicOperationUtils
756 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
759 // add property to VF
760 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
761 newProp.setName(newStringPropName);
762 newProp.setPropertyDefaultValue(newStringPropValue);
763 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
764 .addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
765 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
766 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
767 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
768 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
771 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
772 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
773 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
775 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
776 componentInstDetails = AtomicOperationUtils
777 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
779 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
780 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
781 expectedPropertyList);
783 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
784 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
785 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
787 // update VF instance property
788 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
789 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
790 expectedUpdatePropDetails.setValue(updatedStringValue);
791 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
792 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
793 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
794 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
795 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
796 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
798 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
800 actualPropertyList = new ArrayList<>();
801 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
803 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
804 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
805 assertTrue("property was not updated propely",
806 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
811 * update property(p1)
812 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
816 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance1LevelProperty()
819 basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
820 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
822 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
823 .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
824 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
825 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
826 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
827 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
828 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
829 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
830 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
831 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
833 // create VF + add RI
834 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
836 ComponentInstance componentInstDetails = AtomicOperationUtils
837 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
840 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
841 newProp.setName(newStringPropName);
842 newProp.setPropertyDefaultValue(newStringPropValue);
843 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
844 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
845 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
848 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
849 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
850 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
852 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
853 componentInstDetails = AtomicOperationUtils
854 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
856 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
857 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
858 expectedPropertyList);
860 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
861 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
862 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
864 // update VF property
865 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
866 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
867 expectedUpdatePropDetails.setValue(updatedStringValue);
868 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
869 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
870 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
871 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
872 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
873 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
875 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
877 actualPropertyList = new ArrayList<>();
878 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
880 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
881 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
882 assertTrue("property was not updated propely",
883 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
888 * update property(p2)
889 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
893 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance2LevelProperty()
896 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
897 vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
898 basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
899 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
900 .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
901 UserRoleEnum.DESIGNER, true);
902 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
903 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
904 AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
906 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
907 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
908 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
910 // create VF + add RI
911 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
913 ComponentInstance componentInstDetails = AtomicOperationUtils
914 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
918 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
919 newProp.setName(newStringPropName);
920 newProp.setPropertyDefaultValue(newStringPropValue);
921 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
922 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
923 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
926 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
927 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
928 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
930 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
931 componentInstDetails = AtomicOperationUtils
932 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
934 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
935 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
936 expectedPropertyList);
938 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
939 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
940 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
942 // update VF property
943 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
944 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
945 expectedUpdatePropDetails.setValue(updatedIntegerValue);
946 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
947 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
948 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
949 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
950 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
951 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
953 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
954 actualPropertyList = new ArrayList<>();
955 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
956 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
957 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
958 assertTrue("property was not updated propely",
959 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
964 * update property(p3)
965 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
969 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance3LevelProperty()
972 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
973 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
974 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
975 vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
976 vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
977 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
978 .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
979 UserRoleEnum.DESIGNER, true);
980 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
981 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
982 AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
984 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
986 // create VF + add RI
987 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
989 ComponentInstance componentInstDetails = AtomicOperationUtils
990 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
993 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
994 newProp.setName(newStringPropName);
995 newProp.setPropertyDefaultValue(newStringPropValue);
996 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
997 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
998 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1001 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1002 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1003 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1005 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1006 componentInstDetails = AtomicOperationUtils
1007 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1009 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1010 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1011 expectedPropertyList);
1013 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1014 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1015 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1017 // update VF property
1018 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
1019 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
1020 expectedUpdatePropDetails.setValue(updatedBooleanValue);
1021 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1022 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1023 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1024 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1025 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1026 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1028 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1030 actualPropertyList = new ArrayList<>();
1031 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1033 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1034 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
1035 assertTrue("property was not updated propely",
1036 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1041 * update property p5'
1042 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
1043 * (p1) CP(inst on VF) (p5) CP(inst) (p5')
1046 public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfService() throws Exception {
1047 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
1048 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
1049 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
1050 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
1051 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
1052 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
1053 // expectedPropertyList =
1054 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
1055 // expectedPropertyList);
1058 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
1059 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1061 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
1062 cpStringProperty.setName("Different Name");
1063 cpStringProperty.setPropertyDefaultValue("Different value from default");
1064 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
1065 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1066 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
1067 // create VF + add RI
1068 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
1070 ComponentInstance componentInstDetails = AtomicOperationUtils
1071 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1073 componentInstDetails = AtomicOperationUtils
1074 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
1075 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1076 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1079 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1080 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1081 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1083 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
1085 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1086 componentInstDetails = AtomicOperationUtils
1087 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1089 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1090 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1091 expectedPropertyList);
1093 componentInstDetails = AtomicOperationUtils
1094 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
1095 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1096 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1097 expectedPropertyList);
1099 // service = AtomicOperationUtils.getServiceObject(service,
1100 // UserRoleEnum.DESIGNER);
1101 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1102 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1104 String propNameToUpdate = "cidr";
1105 String propTypeToUpdate = "string";
1107 // update CP property
1108 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
1109 service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
1110 expectedUpdatePropDetails.setValue(updatedStringValue);
1111 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1112 List<String> path = expectedUpdatePropDetails.getPath();
1113 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1114 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1115 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1116 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1117 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1119 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1121 actualPropertyList = new ArrayList<>();
1122 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1124 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1125 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
1126 assertTrue("property was not updated propely",
1127 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1131 * update property p5
1132 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
1133 * (p1) CP(inst on VF) (p5) CP(inst) (p5')
1136 public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfVf() throws Exception {
1137 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
1138 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
1139 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
1140 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
1141 LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
1142 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
1143 // expectedPropertyList =
1144 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
1145 // expectedPropertyList);
1148 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
1149 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1151 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
1152 cpStringProperty.setName("Different Name");
1153 cpStringProperty.setPropertyDefaultValue("Different value from default");
1154 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
1155 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1156 // create VF + add RI
1157 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
1158 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
1160 ComponentInstance componentInstDetails = AtomicOperationUtils
1161 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1163 componentInstDetails = AtomicOperationUtils
1164 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
1165 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1166 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1169 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1170 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1171 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1173 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
1175 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1176 componentInstDetails = AtomicOperationUtils
1177 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1179 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1180 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1181 expectedPropertyList);
1183 componentInstDetails = AtomicOperationUtils
1184 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
1185 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1186 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1187 expectedPropertyList);
1189 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1190 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1191 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1193 String propNameToUpdate = "cidr";
1194 String propTypeToUpdate = "string";
1196 // update CP property
1197 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
1198 service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
1199 expectedUpdatePropDetails.setValue(updatedStringValue);
1200 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1201 List<String> path = expectedUpdatePropDetails.getPath();
1202 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1203 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1204 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1205 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1206 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1208 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1210 actualPropertyList = new ArrayList<>();
1211 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1213 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1214 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
1215 assertTrue("property was not updated propely",
1216 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1219 // -------------------Methods--------------------------
1220 public static PropertyDataDefinition convertToPropertyDataDefinitionObject(PropertyReqDetails prop) {
1221 PropertyDataDefinition propDataDef = new PropertyDataDefinition();
1222 propDataDef.setDefaultValue(prop.getPropertyDefaultValue());
1223 propDataDef.setType(prop.getPropertyType());
1224 propDataDef.setPassword(prop.getPropertyPassword());
1225 propDataDef.setDescription(prop.getPropertyDescription());
1229 protected Resource createResourceWithPropertyDerivedFromOtherResource(PropertyReqDetails propertyReqDetails,
1230 LifeCycleStatesEnum state, Resource derivedFromResource) throws Exception {
1231 Resource resource = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
1232 derivedFromResource, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left()
1234 if (propertyReqDetails != null) {
1235 AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
1237 AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, state, true);
1238 return AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);
1242 protected Resource createResourceWithProperty(PropertyReqDetails propertyReqDetails, LifeCycleStatesEnum state)
1244 Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1245 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1247 if (propertyReqDetails != null) {
1248 AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
1250 AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, state, true);
1251 return AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);