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<ComponentInstanceProperty>();
75 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
79 public static TestName name = new TestName();
81 public ComponentInstancePropertyTest() {
82 super(name, ComponentInstancePropertyTest.class.getName());
85 // --------------Regular
86 // resource-------------------------------------------------------------------------------
89 public void nestedResourceProperty3Levels() throws Exception {
92 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
94 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
95 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
97 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
98 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
100 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
101 actualPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, actualPropertyList);
102 assertTrue("check list size failed, expected 3", actualPropertyList.size() == 3);
107 // resource-----------------------------------------------------------
110 public void nestedVfResourceProperty3Levels() throws Exception {
112 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
113 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
114 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
115 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
116 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
118 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
119 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
121 // create VF + add RI
122 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
124 ComponentInstance componentInstDetails = AtomicOperationUtils
125 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
127 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
128 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
131 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
132 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
133 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
137 public void nestedVfResourceProperty3LevelsAndCpWithProp() throws Exception {
139 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
140 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
141 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
142 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
143 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
145 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
146 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
149 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
150 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
152 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
153 cpStringProperty.setName("Different Name");
154 cpStringProperty.setPropertyDefaultValue("Different value from default");
155 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
156 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
157 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
158 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
159 // create VF + add RI
160 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
162 ComponentInstance componentInstDetails = AtomicOperationUtils
163 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
165 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
166 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
168 componentInstDetails = AtomicOperationUtils
169 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
170 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
171 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
174 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
175 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
176 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
180 public void nestedCertifiedVfResourceProperty3Levels() throws Exception {
181 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
182 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
183 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
184 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
185 LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
187 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
188 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
189 // create VF + add RI
190 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
192 ComponentInstance componentInstDetails = AtomicOperationUtils
193 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
195 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
196 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
199 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
200 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
201 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
202 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
204 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
205 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
209 public void nestedVfResourceProperty3Levels2SameResInstances() throws Exception {
211 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
212 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
213 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
214 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
215 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
217 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
218 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
219 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
220 // create VF + add RI
221 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
223 ComponentInstance componentInstDetails = AtomicOperationUtils
224 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
226 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
228 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
231 componentInstDetails = AtomicOperationUtils
232 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
234 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
235 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
237 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
238 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
239 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
242 // ------------------update resource
243 // property-----------------------------------
246 public void nestedVfResourceProperty3LevelsUpdateFirstLevelProperty() throws Exception {
248 basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
249 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
251 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
252 .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
253 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
254 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
255 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
257 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
258 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
259 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
260 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
262 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
263 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
265 // create VF + add RI
266 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
268 ComponentInstance componentInstDetails = AtomicOperationUtils
269 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
271 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
272 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
275 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
276 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
279 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
282 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
283 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
284 expectedUpdatePropDetails.setValue(updatedStringValue);
285 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
286 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
287 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
288 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
289 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
290 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
292 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
294 actualPropertyList = new ArrayList<>();
295 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
297 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
298 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
299 assertTrue("property was not updated propely",
300 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
305 public void nestedVfResourceProperty3LevelsUpdateSecondLevelProperty() throws Exception {
306 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
309 vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
310 basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
311 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
312 .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
313 UserRoleEnum.DESIGNER, true);
314 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
315 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
316 AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
319 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
320 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
322 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
323 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
325 // create VF + add RI
326 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
328 ComponentInstance componentInstDetails = AtomicOperationUtils
329 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
331 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
332 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
334 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
335 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
338 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
341 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
342 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
343 expectedUpdatePropDetails.setValue(updatedIntegerValue);
344 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
345 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
346 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
347 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
349 "expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS
350 + " ,but was " + updatePropertyValueOnResourceInstance.getErrorCode(),
351 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
353 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
355 actualPropertyList = new ArrayList<>();
356 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
357 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
358 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
359 assertTrue("property was not updated properly",
360 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
365 public void nestedVfResourceProperty3LevelsUpdateThirdLevelProperty() throws Exception {
367 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
368 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
369 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
372 vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
373 vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
374 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
375 .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
376 UserRoleEnum.DESIGNER, true);
377 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
378 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
379 AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
382 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
383 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
385 // create VF + add RI
386 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
388 ComponentInstance componentInstDetails = AtomicOperationUtils
389 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
391 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
392 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
394 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
395 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
398 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
401 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
402 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
403 expectedUpdatePropDetails.setValue(updatedBooleanValue);
404 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
405 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
406 .updatePropertyValueOnResourceInstance(vfResource, componentInstDetails,
407 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
408 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
409 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
411 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
413 actualPropertyList = new ArrayList<>();
414 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
415 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
416 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
417 assertTrue("property was not updated propely",
418 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
422 // ---------------------Service------------------------------------------------------------------------
425 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
428 public void serviceWithNestedResourceProperty3Levels() throws Exception {
430 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
431 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
432 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
433 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
434 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
435 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
436 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
438 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
440 ComponentInstance componentInstDetails = AtomicOperationUtils
441 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
443 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
444 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
445 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
447 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
448 componentInstDetails = AtomicOperationUtils
449 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
451 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
452 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
453 expectedPropertyList);
454 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
455 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
460 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
464 public void serviceWithNestedResourceProperty3LevelsAndVfProperty() throws Exception {
466 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
467 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
468 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
469 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
470 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
471 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
472 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
474 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
476 ComponentInstance componentInstDetails = AtomicOperationUtils
477 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
479 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
480 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
482 PropertyReqDetails propDetails = ElementFactory.getDefaultBooleanProperty();
483 propDetails.setName(newBooleanPropName);
484 propDetails.setPropertyDefaultValue(newBooleanPropValue);
485 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
486 propDetails = ElementFactory.getDefaultStringProperty();
487 propDetails.setName(newStringPropName);
488 propDetails.setPropertyDefaultValue(newStringPropValue);
489 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
490 propDetails = ElementFactory.getDefaultIntegerProperty();
491 propDetails.setName(newIntegerPropName);
492 propDetails.setPropertyDefaultValue(newIntegerPropValue);
493 AtomicOperationUtils.addCustomPropertyToResource(propDetails, vfResource, UserRoleEnum.DESIGNER, true);
494 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
495 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
496 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfResource, expectedPropertyList);
498 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
499 componentInstDetails = AtomicOperationUtils
500 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
502 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
503 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
504 expectedPropertyList);
505 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
506 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
511 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
512 * (p1) CP(VF inst) (p5)
515 public void serviceWithNestedResourceProperty3LevelsAndCp() throws Exception {
517 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
518 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
519 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
520 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
521 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
522 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
523 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
526 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
527 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
529 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
530 cpStringProperty.setName("Different Name");
531 cpStringProperty.setPropertyDefaultValue("Different value from default");
532 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
533 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
534 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
535 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
536 // create VF + add RI
537 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
539 ComponentInstance componentInstDetails = AtomicOperationUtils
540 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
542 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
543 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
545 componentInstDetails = AtomicOperationUtils
546 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
547 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
548 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
549 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, cp, expectedPropertyList,
552 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
553 componentInstDetails = AtomicOperationUtils
554 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
556 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
557 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
558 expectedPropertyList);
559 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
560 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
565 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
569 public void serviceWithNestedResourceProperty3LevelsAndCpResInst() throws Exception {
571 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
572 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
573 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
574 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
575 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
576 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
577 // expectedPropertyList =
578 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
579 // expectedPropertyList);
582 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
583 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
585 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
586 cpStringProperty.setName("Different Name");
587 cpStringProperty.setPropertyDefaultValue("Different value from default");
588 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
589 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
590 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
591 // create VF + add RI
592 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
594 ComponentInstance componentInstDetails = AtomicOperationUtils
595 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
597 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
598 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
601 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
602 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
603 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
605 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
607 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
608 componentInstDetails = AtomicOperationUtils
609 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
611 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
612 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
613 expectedPropertyList);
614 componentInstDetails = AtomicOperationUtils
615 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
616 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
617 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
618 expectedPropertyList);
619 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
620 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
625 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3) (p2) (p1)
626 * | (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
628 * VF2(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) | (p3') (p2') (p1') |
629 * (VFC(inst)-->VFC-->VFC-->VFC) (p3) (p2) (p1)
632 public void serviceNestedVfResourceProperty3Levels2SameResInstances() throws Exception {
634 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
635 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
636 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
637 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
638 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
639 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
641 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
642 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1, expectedPropertyList);
644 // create VF + add RI
645 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
647 ComponentInstance componentInstDetails = AtomicOperationUtils
648 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
650 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
652 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
655 componentInstDetails = AtomicOperationUtils
656 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
658 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
659 PropertyRestUtils.updatePropertyListWithPathOnResource(componentInstDetails, vfc2FromVfc1, expectedPropertyList,
661 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
662 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
663 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, actualPropertyList, null);
664 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
667 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
668 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
669 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
671 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
673 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
674 componentInstDetails = AtomicOperationUtils
675 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
677 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
678 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
679 expectedPropertyList);
680 componentInstDetails = AtomicOperationUtils
681 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
683 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
684 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
685 expectedPropertyList);
686 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
687 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
688 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
692 // service test template
694 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
698 public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty() throws Exception {
700 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
701 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
702 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
703 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
704 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
705 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
707 // create VF + add RI
708 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
710 ComponentInstance componentInstDetails = AtomicOperationUtils
711 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
713 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
714 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
715 newProp.setName(newStringPropName);
716 newProp.setPropertyDefaultValue(newStringPropValue);
717 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
718 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
719 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
722 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
723 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
724 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
726 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
727 componentInstDetails = AtomicOperationUtils
728 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
730 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
731 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
732 expectedPropertyList);
733 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
734 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
735 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
740 * update property(p4)
743 * VFC(p1) ^ | VFC(p2) ^ | Service-->VF(inst)-->VF-->(VFC(inst)-->VFC(p3)
747 public void serviceNestedVfResourceProperty3LevelsAndSelfVfProperty_UpdateVfproperty() throws Exception {
748 // Create VFC(check-in state) derived from another resource
749 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
750 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
751 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
752 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
753 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
754 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
756 // create VF + add RI
757 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
759 ComponentInstance componentInstDetails = AtomicOperationUtils
760 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
763 // add property to VF
764 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
765 newProp.setName(newStringPropName);
766 newProp.setPropertyDefaultValue(newStringPropValue);
767 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
768 .addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
769 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
770 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
771 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
772 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
775 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
776 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
777 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
779 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
780 componentInstDetails = AtomicOperationUtils
781 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
783 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
784 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
785 expectedPropertyList);
787 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
788 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
789 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
791 // update VF instance property
792 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
793 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
794 expectedUpdatePropDetails.setValue(updatedStringValue);
795 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
796 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
797 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
798 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
799 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
800 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
802 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
804 actualPropertyList = new ArrayList<>();
805 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
807 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
808 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
809 assertTrue("property was not updated propely",
810 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
815 * update property(p1)
816 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
820 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance1LevelProperty()
823 basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
824 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
826 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
827 .addDefaultPropertyToResource(PropertyTypeEnum.STRING, basicVFC, UserRoleEnum.DESIGNER, true);
828 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
829 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
830 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
831 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
832 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
833 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
834 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
835 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
837 // create VF + add RI
838 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
840 ComponentInstance componentInstDetails = AtomicOperationUtils
841 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
844 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
845 newProp.setName(newStringPropName);
846 newProp.setPropertyDefaultValue(newStringPropValue);
847 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
848 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
849 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
852 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
853 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
854 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
856 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
857 componentInstDetails = AtomicOperationUtils
858 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
860 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
861 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
862 expectedPropertyList);
864 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
865 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
866 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
868 // update VF property
869 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
870 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
871 expectedUpdatePropDetails.setValue(updatedStringValue);
872 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
873 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
874 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
875 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
876 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
877 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
879 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
881 actualPropertyList = new ArrayList<>();
882 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
884 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
885 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
886 assertTrue("property was not updated propely",
887 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
892 * update property(p2)
893 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
897 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance2LevelProperty()
900 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
901 vfc1FromBasicVFC = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
902 basicVFC, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left().value();
903 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
904 .addCustomPropertyToResource(ElementFactory.getDefaultIntegerProperty(), vfc1FromBasicVFC,
905 UserRoleEnum.DESIGNER, true);
906 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
907 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
908 AtomicOperationUtils.changeComponentState(vfc1FromBasicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY,
910 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
911 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
912 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
914 // create VF + add RI
915 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
917 ComponentInstance componentInstDetails = AtomicOperationUtils
918 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
922 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
923 newProp.setName(newStringPropName);
924 newProp.setPropertyDefaultValue(newStringPropValue);
925 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
926 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
927 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
930 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
931 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
932 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
934 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
935 componentInstDetails = AtomicOperationUtils
936 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
938 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
939 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
940 expectedPropertyList);
942 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
943 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
944 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
946 // update VF property
947 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
948 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
949 expectedUpdatePropDetails.setValue(updatedIntegerValue);
950 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
951 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
952 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
953 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
954 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
955 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
957 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
958 actualPropertyList = new ArrayList<>();
959 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
960 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
961 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
962 assertTrue("property was not updated propely",
963 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
968 * update property(p3)
969 * Service-->VF(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
973 public void serviceNestedVfResourceProperty3LevelsAndSelfVfPropertyUpdateVfInheritance3LevelProperty()
976 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
977 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
978 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
979 vfc2FromVfc1 = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
980 vfc1FromBasicVFC, ResourceCategoryEnum.GENERIC_DATABASE, UserRoleEnum.DESIGNER, true).left().value();
981 Either<ComponentInstanceProperty, RestResponse> propDetailsToUpdate = AtomicOperationUtils
982 .addCustomPropertyToResource(ElementFactory.getDefaultBooleanProperty(), vfc2FromVfc1,
983 UserRoleEnum.DESIGNER, true);
984 String propNameToUpdate = propDetailsToUpdate.left().value().getName();
985 String propTypeToUpdate = propDetailsToUpdate.left().value().getType();
986 AtomicOperationUtils.changeComponentState(vfc2FromVfc1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN,
988 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
990 // create VF + add RI
991 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
993 ComponentInstance componentInstDetails = AtomicOperationUtils
994 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
997 PropertyReqDetails newProp = ElementFactory.getDefaultStringProperty();
998 newProp.setName(newStringPropName);
999 newProp.setPropertyDefaultValue(newStringPropValue);
1000 AtomicOperationUtils.addCustomPropertyToResource(newProp, vfResource, UserRoleEnum.DESIGNER, true);
1001 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1002 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1005 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1006 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1007 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1009 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1010 componentInstDetails = AtomicOperationUtils
1011 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1013 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1014 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1015 expectedPropertyList);
1017 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1018 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1019 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1021 // update VF property
1022 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils
1023 .getPropFromListByPropNameAndType(actualPropertyList, propNameToUpdate, propTypeToUpdate);
1024 expectedUpdatePropDetails.setValue(updatedBooleanValue);
1025 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1026 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1027 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1028 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1029 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1030 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1032 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1034 actualPropertyList = new ArrayList<>();
1035 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1037 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1038 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, null);
1039 assertTrue("property was not updated propely",
1040 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1045 * update property p5'
1046 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
1047 * (p1) CP(inst on VF) (p5) CP(inst) (p5')
1050 public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfService() throws Exception {
1051 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
1052 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
1053 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
1054 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
1055 LifeCycleStatesEnum.CHECKIN, vfc1FromBasicVFC);
1056 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
1057 // expectedPropertyList =
1058 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
1059 // expectedPropertyList);
1062 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
1063 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1065 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
1066 cpStringProperty.setName("Different Name");
1067 cpStringProperty.setPropertyDefaultValue("Different value from default");
1068 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
1069 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1070 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
1071 // create VF + add RI
1072 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
1074 ComponentInstance componentInstDetails = AtomicOperationUtils
1075 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1077 componentInstDetails = AtomicOperationUtils
1078 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
1079 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1080 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1083 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1084 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1085 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1087 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
1089 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1090 componentInstDetails = AtomicOperationUtils
1091 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1093 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1094 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1095 expectedPropertyList);
1097 componentInstDetails = AtomicOperationUtils
1098 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
1099 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1100 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1101 expectedPropertyList);
1103 // service = AtomicOperationUtils.getServiceObject(service,
1104 // UserRoleEnum.DESIGNER);
1105 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1106 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1108 String propNameToUpdate = "cidr";
1109 String propTypeToUpdate = "string";
1111 // update CP property
1112 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
1113 service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
1114 expectedUpdatePropDetails.setValue(updatedStringValue);
1115 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1116 List<String> path = expectedUpdatePropDetails.getPath();
1117 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1118 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1119 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1120 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1121 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1123 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1125 actualPropertyList = new ArrayList<>();
1126 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1128 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1129 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
1130 assertTrue("property was not updated propely",
1131 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1135 * update property p5
1136 * Service-->VF1(inst)-->VF-->(VFC(inst)-->VFC-->VFC-->VFC) (p4) (p3) (p2)
1137 * (p1) CP(inst on VF) (p5) CP(inst) (p5')
1140 public void serviceWithNestedResourceProperty3LevelsAndCpOnVfUpdateCpInstanceOfVf() throws Exception {
1141 basicVFC = createResourceWithProperty(ElementFactory.getDefaultStringProperty(), LifeCycleStatesEnum.CERTIFY);
1142 vfc1FromBasicVFC = createResourceWithPropertyDerivedFromOtherResource(
1143 ElementFactory.getDefaultIntegerProperty(), LifeCycleStatesEnum.CERTIFY, basicVFC);
1144 vfc2FromVfc1 = createResourceWithPropertyDerivedFromOtherResource(ElementFactory.getDefaultBooleanProperty(),
1145 LifeCycleStatesEnum.CERTIFY, vfc1FromBasicVFC);
1146 vfc2FromVfc1 = AtomicOperationUtils.getResourceObject(vfc2FromVfc1, UserRoleEnum.DESIGNER);
1147 // expectedPropertyList =
1148 // PropertyRestUtils.addResourcePropertiesToList(vfc2FromVfc1,
1149 // expectedPropertyList);
1152 Resource cp = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.CP,
1153 NormativeTypesEnum.NETWORK, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1155 PropertyReqDetails cpStringProperty = ElementFactory.getDefaultStringProperty();
1156 cpStringProperty.setName("Different Name");
1157 cpStringProperty.setPropertyDefaultValue("Different value from default");
1158 AtomicOperationUtils.addCustomPropertyToResource(cpStringProperty, cp, UserRoleEnum.DESIGNER, true);
1159 AtomicOperationUtils.changeComponentState(cp, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1160 // create VF + add RI
1161 cp = AtomicOperationUtils.getResourceObject(cp, UserRoleEnum.DESIGNER);
1162 vfResource = AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true).left()
1164 ComponentInstance componentInstDetails = AtomicOperationUtils
1165 .addComponentInstanceToComponentContainer(vfc2FromVfc1, vfResource, UserRoleEnum.DESIGNER, true).left()
1167 componentInstDetails = AtomicOperationUtils
1168 .addComponentInstanceToComponentContainer(cp, vfResource, UserRoleEnum.DESIGNER, true).left().value();
1169 AtomicOperationUtils.changeComponentState(vfResource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1170 vfResource = AtomicOperationUtils.getResourceObject(vfResource, UserRoleEnum.DESIGNER);
1173 expectedPropertyList = new ArrayList<ComponentInstanceProperty>();
1174 actualPropertyList = new ArrayList<ComponentInstanceProperty>();
1175 expectedPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(vfResource, expectedPropertyList,
1177 expectedPropertyList = PropertyRestUtils.addResourcePropertiesToList(cp, expectedPropertyList);
1179 Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
1180 componentInstDetails = AtomicOperationUtils
1181 .addComponentInstanceToComponentContainer(vfResource, service, UserRoleEnum.DESIGNER, true).left()
1183 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1184 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1185 expectedPropertyList);
1187 componentInstDetails = AtomicOperationUtils
1188 .addComponentInstanceToComponentContainer(cp, service, UserRoleEnum.DESIGNER, true).left().value();
1189 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1190 PropertyRestUtils.updatePropertyListWithPathOnComponentInstance(componentInstDetails, service,
1191 expectedPropertyList);
1193 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1194 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1195 PropertyRestUtils.comparePropertyLists(expectedPropertyList, actualPropertyList, false);
1197 String propNameToUpdate = "cidr";
1198 String propTypeToUpdate = "string";
1200 // update CP property
1201 ComponentInstanceProperty expectedUpdatePropDetails = PropertyRestUtils.getCompPropInstListByInstIdAndPropName(
1202 service, componentInstDetails, propNameToUpdate, propTypeToUpdate);
1203 expectedUpdatePropDetails.setValue(updatedStringValue);
1204 String propUniqeId = expectedUpdatePropDetails.getUniqueId();
1205 List<String> path = expectedUpdatePropDetails.getPath();
1206 RestResponse updatePropertyValueOnResourceInstance = ComponentInstanceRestUtils
1207 .updatePropertyValueOnResourceInstance(service, componentInstDetails,
1208 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), expectedUpdatePropDetails);
1209 assertTrue("expected updatePropertyValueOnResourceInstance response code: " + BaseRestUtils.STATUS_CODE_SUCCESS,
1210 updatePropertyValueOnResourceInstance.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS);
1212 service = AtomicOperationUtils.getServiceObject(service, UserRoleEnum.DESIGNER);
1214 actualPropertyList = new ArrayList<>();
1215 actualPropertyList = PropertyRestUtils.addComponentInstPropertiesToList(service, actualPropertyList, null);
1217 ComponentInstanceProperty actualUpdatedPropDetails = PropertyRestUtils
1218 .getPropFromListByPropIdAndPath(actualPropertyList, propUniqeId, path);
1219 assertTrue("property was not updated propely",
1220 PropertyRestUtils.comparePropertyObjects(expectedUpdatePropDetails, actualUpdatedPropDetails, true));
1223 // -------------------Methods--------------------------
1224 public static PropertyDataDefinition convertToPropertyDataDefinitionObject(PropertyReqDetails prop) {
1225 PropertyDataDefinition propDataDef = new PropertyDataDefinition();
1226 propDataDef.setDefaultValue(prop.getPropertyDefaultValue());
1227 propDataDef.setType(prop.getPropertyType());
1228 propDataDef.setPassword(prop.getPropertyPassword());
1229 propDataDef.setDescription(prop.getPropertyDescription());
1233 protected Resource createResourceWithPropertyDerivedFromOtherResource(PropertyReqDetails propertyReqDetails,
1234 LifeCycleStatesEnum state, Resource derivedFromResource) throws Exception {
1235 Resource resource = AtomicOperationUtils.createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC,
1236 derivedFromResource, ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true).left()
1238 if (propertyReqDetails != null) {
1239 AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
1241 AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, state, true);
1242 return AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);
1246 protected Resource createResourceWithProperty(PropertyReqDetails propertyReqDetails, LifeCycleStatesEnum state)
1248 Resource resource = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1249 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1251 if (propertyReqDetails != null) {
1252 AtomicOperationUtils.addCustomPropertyToResource(propertyReqDetails, resource, UserRoleEnum.DESIGNER, true);
1254 AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, state, true);
1255 return AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);