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 static org.testng.AssertJUnit.assertTrue;
25 import java.util.ArrayList;
26 import java.util.List;
28 import org.junit.Rule;
29 import org.junit.rules.TestName;
30 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
31 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
32 import org.openecomp.sdc.be.model.ComponentInstance;
33 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
34 import org.openecomp.sdc.be.model.Resource;
35 import org.openecomp.sdc.be.model.Service;
36 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
37 import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
38 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
39 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
40 import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
42 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
43 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
44 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
45 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
46 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
47 import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils;
48 import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils;
49 import org.testng.annotations.BeforeMethod;
50 import org.testng.annotations.Test;
52 import fj.data.Either;
54 // open bug for this class: DE199108 - closed, DE199741
55 public class ComponentInstancePropertyTest extends ComponentBaseTest {
57 protected Resource basicVFC;
58 protected Resource vfc1FromBasicVFC;
59 protected Resource vfc2FromVfc1;
60 protected Resource vfResource;
62 private List<ComponentInstanceProperty> expectedPropertyList;
63 private List<ComponentInstanceProperty> actualPropertyList;
64 // protected String updatedStringValue = "{Not Default String Value}";
65 protected String updatedStringValue = "Not Default String Value";
66 protected String updatedIntegerValue = "666";
67 protected String updatedBooleanValue = "false";
68 protected String newStringPropName = "stringProp2";
69 protected String newIntegerPropName = "integerProp2";
70 protected String newBooleanPropName = "booleanProp2";
71 // bug DE199741 protected String newStringPropValue = "<second string
73 protected String newStringPropValue = "second string value";
74 protected String newIntegerPropValue = "888";
75 protected String newBooleanPropValue = "false";
79 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
80 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
84 public static TestName name = new TestName();
86 public ComponentInstancePropertyTest() {
87 super(name, ComponentInstancePropertyTest.class.getName());
90 // --------------Regular
91 // resource-------------------------------------------------------------------------------
94 public void nestedResourceProperty3Levels() throws Exception {
97 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
99 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
100 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
102 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
103 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
105 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
106 actualPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, actualPropertyList);
107 assertTrue("check list size failed, expected 3", actualPropertyList.size() == 3);
112 // resource-----------------------------------------------------------
115 public void nestedVfResourceProperty3Levels() throws Exception {
117 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
118 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
119 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
120 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
121 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
123 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
124 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
126 // create VF + add RI
127 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
129 ComponentInstance componentInstDetails = AtomicOperationUtils
130 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
132 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
133 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
136 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
137 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
138 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
142 public void nestedVfResourceProperty3LevelsAndCpWithProp() throws Exception {
144 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
145 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
146 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
147 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
148 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
150 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
151 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
154 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
155 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
157 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
158 cpStringProperty.setName("Different Name");
159 cpStringProperty.setPropertyDefaultValue("Different value from default");
160 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
161 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
162 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
163 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
164 // create VF + add RI
165 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
167 ComponentInstance componentInstDetails = AtomicOperationUtils
168 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
170 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
171 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
173 componentInstDetails = AtomicOperationUtils
174 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
175 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
176 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
179 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
180 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
181 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
185 public void nestedCertifiedVfResourceProperty3Levels() throws Exception {
186 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
187 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
188 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
189 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
190 LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
192 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
193 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
194 // create VF + add RI
195 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
197 ComponentInstance componentInstDetails = AtomicOperationUtils
198 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
200 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
201 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
204 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
205 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
206 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
207 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
209 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
210 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
214 public void nestedVfResourceProperty3Levels2SameResInstances() throws Exception {
216 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
217 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
218 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
219 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
220 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
222 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
223 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
224 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
225 // create VF + add RI
226 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
228 ComponentInstance componentInstDetails = AtomicOperationUtils
229 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
231 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
233 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
236 componentInstDetails = AtomicOperationUtils
237 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
239 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
240 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
242 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
243 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
244 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
247 // ------------------update resource
248 // property-----------------------------------
251 public void nestedVfResourceProperty3LevelsUpdateFirstLevelProperty() throws Exception {
253 basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
254 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
256 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
257 .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
258 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
259 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
260 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
262 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
263 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
264 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
265 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
267 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
268 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
270 // create VF + add RI
271 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
273 ComponentInstance componentInstDetails = AtomicOperationUtils
274 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
276 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
277 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
280 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
281 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
284 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
287 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
288 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
289 expectedUpdatePropDetails.setValue(updatedStringValue);
290 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
291 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
292 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
293 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
294 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
295 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
297 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
299 actualPropertyList = new ArrayList<>();
300 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
302 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
303 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
304 assertTrue("property was not updated propely",
305 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
310 public void nestedVfResourceProperty3LevelsUpdateSecondLevelProperty() throws Exception {
311 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
314 vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
315 basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
316 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
317 .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
318 UserRoleEnum.DESIGNER, true);
319 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
320 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
321 AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
324 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
325 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
327 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
328 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
330 // create VF + add RI
331 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
333 ComponentInstance componentInstDetails = AtomicOperationUtils
334 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
336 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
337 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
339 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
340 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
343 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
346 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
347 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
348 expectedUpdatePropDetails.setValue(updatedIntegerValue);
349 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
350 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
351 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
352 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
354 "expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS
355 + " ,but was " + updatePropertyValueOnResourceInstance.getErrorCode(),
356 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
358 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
360 actualPropertyList = new ArrayList<>();
361 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
362 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
363 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
364 assertTrue("property was not updated properly",
365 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
370 public void nestedVfResourceProperty3LevelsUpdateThirdLevelProperty() throws Exception {
372 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
373 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
374 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
377 vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
378 vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
379 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
380 .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
381 UserRoleEnum.DESIGNER, true);
382 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
383 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
384 AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
387 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
388 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
390 // create VF + add RI
391 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
393 ComponentInstance componentInstDetails = AtomicOperationUtils
394 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
396 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
397 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
399 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
400 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
403 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
406 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
407 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
408 expectedUpdatePropDetails.setValue(updatedBooleanValue);
409 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
410 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
411 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
412 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
413 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
414 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
416 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
418 actualPropertyList = new ArrayList<>();
419 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
420 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
421 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
422 assertTrue("property was not updated propely",
423 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
427 // ---------------------Service------------------------------------------------------------------------
430 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
433 public void serviceWithNestedResourceProperty3Levels() throws Exception {
435 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
436 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
437 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
438 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
439 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
440 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
441 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
443 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
445 ComponentInstance componentInstDetails = AtomicOperationUtils
446 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
448 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
449 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
450 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
452 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
453 componentInstDetails = AtomicOperationUtils
454 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
456 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
457 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
458 expectedPropertyList);
459 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
460 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
465 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
469 public void serviceWithNestedResourceProperty3LevelsAndVfProperty() throws Exception {
471 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
472 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
473 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
474 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
475 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
476 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
477 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
479 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
481 ComponentInstance componentInstDetails = AtomicOperationUtils
482 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
484 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
485 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
487 PropertyReqDetails propDetails = ElementFactory.getDefaultBooleanProperty();
488 propDetails.setName(newBooleanPropName);
489 propDetails.setPropertyDefaultValue(newBooleanPropValue);
490 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
491 propDetails = ElementFactory.getDefaultStringProperty();
492 propDetails.setName(newStringPropName);
493 propDetails.setPropertyDefaultValue(newStringPropValue);
494 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
495 propDetails = ElementFactory.getDefaultIntegerProperty();
496 propDetails.setName(newIntegerPropName);
497 propDetails.setPropertyDefaultValue(newIntegerPropValue);
498 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
499 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
500 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
501 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfResource, expectedPropertyList);
503 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
504 componentInstDetails = AtomicOperationUtils
505 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
507 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
508 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
509 expectedPropertyList);
510 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
511 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
516 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
517 * (p1) CP(VF inst) (p5)
520 public void serviceWithNestedResourceProperty3LevelsAndCp() throws Exception {
522 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
523 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
524 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
525 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
526 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
527 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
528 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
531 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
532 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
534 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
535 cpStringProperty.setName("Different Name");
536 cpStringProperty.setPropertyDefaultValue("Different value from default");
537 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
538 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
539 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
540 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
541 // create VF + add RI
542 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
544 ComponentInstance componentInstDetails = AtomicOperationUtils
545 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
547 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
548 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
550 componentInstDetails = AtomicOperationUtils
551 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
552 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
553 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
554 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
557 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
558 componentInstDetails = AtomicOperationUtils
559 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
561 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
562 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
563 expectedPropertyList);
564 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
565 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
570 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
574 public void serviceWithNestedResourceProperty3LevelsAndCpResInst() throws Exception {
576 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
577 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
578 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
579 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
580 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
581 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
582 // expectedPropertyList =
583 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
584 // expectedPropertyList);
587 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
588 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
590 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
591 cpStringProperty.setName("Different Name");
592 cpStringProperty.setPropertyDefaultValue("Different value from default");
593 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
594 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
595 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
596 // create VF + add RI
597 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
599 ComponentInstance componentInstDetails = AtomicOperationUtils
600 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
602 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
603 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
606 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
607 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
608 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
610 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
612 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
613 componentInstDetails = AtomicOperationUtils
614 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
616 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
617 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
618 expectedPropertyList);
619 componentInstDetails = AtomicOperationUtils
620 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
621 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
622 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
623 expectedPropertyList);
624 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
625 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
630 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3) (p2) (p1)
631 * | (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
633 * VF2(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3') (p2') (p1') |
634 * (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
637 public void serviceNestedVfResourceProperty3Levels2SameResInstances() throws Exception {
639 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
640 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
641 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
642 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
643 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
644 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
646 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
647 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
649 // create VF + add RI
650 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
652 ComponentInstance componentInstDetails = AtomicOperationUtils
653 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
655 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
657 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
660 componentInstDetails = AtomicOperationUtils
661 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
663 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
664 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
666 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
667 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
668 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
669 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
672 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
673 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
674 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
676 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
678 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
679 componentInstDetails = AtomicOperationUtils
680 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
682 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
683 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
684 expectedPropertyList);
685 componentInstDetails = AtomicOperationUtils
686 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
688 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
689 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
690 expectedPropertyList);
691 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
692 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
693 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
697 // service test template
699 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
703 public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty() throws Exception {
705 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
706 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
707 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
708 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
709 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
710 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
712 // create VF + add RI
713 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
715 ComponentInstance componentInstDetails = AtomicOperationUtils
716 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
718 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
719 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
720 newProp.setName(newStringPropName);
721 newProp.setPropertyDefaultValue(newStringPropValue);
722 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
723 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
724 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
727 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
728 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
729 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
731 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
732 componentInstDetails = AtomicOperationUtils
733 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
735 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
736 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
737 expectedPropertyList);
738 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
739 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
740 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
745 * update property(p4)
748 * VFC(p1) ^ | VFC(p2) ^ | Service-->VF(inst)-->VF-->(VFC(inst)-->VFC(p3)
752 public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty_UpdateVfproperty() throws Exception {
753 // Create VFC(check-in state) derived from another resource
754 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
755 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
756 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
757 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
758 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
759 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
761 // create VF + add RI
762 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
764 ComponentInstance componentInstDetails = AtomicOperationUtils
765 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
768 // add property to VF
769 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
770 newProp.setName(newStringPropName);
771 newProp.setPropertyDefaultValue(newStringPropValue);
772 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
773 .addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
774 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
775 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
776 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
777 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
780 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
781 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
782 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
784 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
785 componentInstDetails = AtomicOperationUtils
786 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
788 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
789 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
790 expectedPropertyList);
792 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
793 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
794 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
796 // update VF instance property
797 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
798 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
799 expectedUpdatePropDetails.setValue(updatedStringValue);
800 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
801 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
802 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
803 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
804 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
805 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
807 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
809 actualPropertyList = new ArrayList<>();
810 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
812 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
813 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
814 assertTrue("property was not updated propely",
815 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
820 * update property(p1)
821 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
825 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance1LevelProperty()
828 basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
829 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
831 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
832 .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
833 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
834 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
835 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
836 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
837 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
838 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
839 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
840 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
842 // create VF + add RI
843 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
845 ComponentInstance componentInstDetails = AtomicOperationUtils
846 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
849 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
850 newProp.setName(newStringPropName);
851 newProp.setPropertyDefaultValue(newStringPropValue);
852 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
853 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
854 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
857 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
858 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
859 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
861 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
862 componentInstDetails = AtomicOperationUtils
863 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
865 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
866 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
867 expectedPropertyList);
869 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
870 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
871 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
873 // update VF property
874 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
875 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
876 expectedUpdatePropDetails.setValue(updatedStringValue);
877 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
878 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
879 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
880 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
881 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
882 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
884 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
886 actualPropertyList = new ArrayList<>();
887 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
889 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
890 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
891 assertTrue("property was not updated propely",
892 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
897 * update property(p2)
898 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
902 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance2LevelProperty()
905 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
906 vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
907 basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
908 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
909 .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
910 UserRoleEnum.DESIGNER, true);
911 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
912 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
913 AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
915 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
916 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
917 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
919 // create VF + add RI
920 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
922 ComponentInstance componentInstDetails = AtomicOperationUtils
923 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
927 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
928 newProp.setName(newStringPropName);
929 newProp.setPropertyDefaultValue(newStringPropValue);
930 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
931 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
932 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
935 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
936 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
937 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
939 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
940 componentInstDetails = AtomicOperationUtils
941 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
943 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
944 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
945 expectedPropertyList);
947 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
948 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
949 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
951 // update VF property
952 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
953 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
954 expectedUpdatePropDetails.setValue(updatedIntegerValue);
955 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
956 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
957 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
958 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
959 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
960 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
962 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
963 actualPropertyList = new ArrayList<>();
964 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
965 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
966 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
967 assertTrue("property was not updated propely",
968 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
973 * update property(p3)
974 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
978 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance3LevelProperty()
981 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
982 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
983 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
984 vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
985 vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
986 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
987 .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
988 UserRoleEnum.DESIGNER, true);
989 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
990 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
991 AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
993 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
995 // create VF + add RI
996 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
998 ComponentInstance componentInstDetails = AtomicOperationUtils
999 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1002 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
1003 newProp.setName(newStringPropName);
1004 newProp.setPropertyDefaultValue(newStringPropValue);
1005 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
1006 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1007 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1010 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1011 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1012 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1014 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1015 componentInstDetails = AtomicOperationUtils
1016 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1018 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1019 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1020 expectedPropertyList);
1022 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1023 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1024 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1026 // update VF property
1027 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
1028 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
1029 expectedUpdatePropDetails.setValue(updatedBooleanValue);
1030 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1031 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1032 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1033 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1034 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1035 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1037 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1039 actualPropertyList = new ArrayList<>();
1040 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1042 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1043 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
1044 assertTrue("property was not updated propely",
1045 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1050 * update property p5'
1051 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
1052 * (p1) CP(inst on VF) (p5) CP(inst) (p5')
1055 public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfService() throws Exception {
1056 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
1057 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
1058 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
1059 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
1060 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
1061 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
1062 // expectedPropertyList =
1063 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
1064 // expectedPropertyList);
1067 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
1068 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1070 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
1071 cpStringProperty.setName("Different Name");
1072 cpStringProperty.setPropertyDefaultValue("Different value from default");
1073 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
1074 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1075 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
1076 // create VF + add RI
1077 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
1079 ComponentInstance componentInstDetails = AtomicOperationUtils
1080 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1082 componentInstDetails = AtomicOperationUtils
1083 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
1084 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1085 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1088 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1089 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1090 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1092 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
1094 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1095 componentInstDetails = AtomicOperationUtils
1096 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1098 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1099 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1100 expectedPropertyList);
1102 componentInstDetails = AtomicOperationUtils
1103 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
1104 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1105 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1106 expectedPropertyList);
1108 // service = AtomicOperationUtils.getServiceObject(service,
1109 // UserRoleEnum.DESIGNER);
1110 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1111 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1113 String propNameToUpdate = "cidr";
1114 String propTypeToUpdate = "string";
1116 // update CP property
1117 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
1118 service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
1119 expectedUpdatePropDetails.setValue(updatedStringValue);
1120 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1121 List<String> path = expectedUpdatePropDetails.getPath();
1122 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1123 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1124 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1125 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1126 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1128 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1130 actualPropertyList = new ArrayList<>();
1131 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1133 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1134 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
1135 assertTrue("property was not updated propely",
1136 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1140 * update property p5
1141 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
1142 * (p1) CP(inst on VF) (p5) CP(inst) (p5')
1145 public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfVf() throws Exception {
1146 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
1147 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
1148 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
1149 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
1150 LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
1151 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
1152 // expectedPropertyList =
1153 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
1154 // expectedPropertyList);
1157 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
1158 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1160 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
1161 cpStringProperty.setName("Different Name");
1162 cpStringProperty.setPropertyDefaultValue("Different value from default");
1163 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
1164 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1165 // create VF + add RI
1166 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
1167 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
1169 ComponentInstance componentInstDetails = AtomicOperationUtils
1170 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1172 componentInstDetails = AtomicOperationUtils
1173 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
1174 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1175 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1178 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1179 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1180 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1182 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
1184 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1185 componentInstDetails = AtomicOperationUtils
1186 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1188 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1189 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1190 expectedPropertyList);
1192 componentInstDetails = AtomicOperationUtils
1193 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
1194 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1195 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1196 expectedPropertyList);
1198 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1199 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1200 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1202 String propNameToUpdate = "cidr";
1203 String propTypeToUpdate = "string";
1205 // update CP property
1206 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
1207 service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
1208 expectedUpdatePropDetails.setValue(updatedStringValue);
1209 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1210 List<String> path = expectedUpdatePropDetails.getPath();
1211 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1212 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1213 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1214 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1215 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1217 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1219 actualPropertyList = new ArrayList<>();
1220 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1222 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1223 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
1224 assertTrue("property was not updated propely",
1225 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1228 // -------------------Methods--------------------------
1229 public static PropertyDataDefinition convertToPropertyDataDefinitionObject(PropertyReqDetails prop) {
1230 PropertyDataDefinition propDataDef = new PropertyDataDefinition();
1231 propDataDef.setDefaultValue(prop.getPropertyDefaultValue());
1232 propDataDef.setType(prop.getPropertyType());
1233 propDataDef.setPassword(prop.getPropertyPassword());
1234 propDataDef.setDescription(prop.getPropertyDescription());
1238 protected Resource createResourceWithPropertyDerivedFromOtherResource(PropertyReqDetails propertyReqDetails,
1239 LifeCycleStatesEnum state, Resource derivedFromResource) throws Exception {
1240 Resource resource = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
1241 derivedFromResource, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left()
1243 if (propertyReqDetails != null) {
1244 AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
1246 AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, state, true);
1247 return AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);
1251 protected Resource createResourceWithProperty(PropertyReqDetails propertyReqDetails, LifeCycleStatesEnum state)
1253 Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1254 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1256 if (propertyReqDetails != null) {
1257 AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
1259 AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, state, true);
1260 return AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);