[SDC-29] rebase continue work to align source
[sdc.git] / test-apis-ci / src / main / java / org / openecomp / sdc / ci / tests / execute / property / ComponentProperty.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.execute.property;
22
23 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
24 import static org.testng.AssertJUnit.assertEquals;
25 import static org.testng.AssertJUnit.assertTrue;
26
27 import java.io.IOException;
28 import java.util.ArrayList;
29 import java.util.List;
30
31 import org.junit.Rule;
32 import org.junit.rules.TestName;
33 import org.openecomp.sdc.be.dao.api.ActionStatus;
34 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
35 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
36 import org.openecomp.sdc.be.model.PropertyDefinition;
37 import org.openecomp.sdc.be.model.Resource;
38 import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
39 import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails;
40 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
42 import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
43 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
44 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
45 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
46 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
47 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
48 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
49 import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils;
50 import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
51 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
52 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
53 import org.testng.annotations.DataProvider;
54 import org.testng.annotations.Test;
55
56 public class ComponentProperty extends ComponentBaseTest {
57
58         @Rule
59         public static TestName name = new TestName();
60
61         public ComponentProperty() {
62                 super(name, ComponentProperty.class.getName());
63         }
64
65         @DataProvider
66         private static final Object[][] propertiesListDefaultValueSuccessFlow() throws IOException, Exception {
67                 return new Object[][] {
68                                 // integer
69                                 { "integer", "[1,2]", "[1,2]" },
70                                 { "tosca.datatypes.Credential",
71                                                 "[{\"protocol\":\"protocol1\",\"token\":\"token1\"},{\"protocol\":\"protocol2\",\"token\":\"token2\"}]",
72                                                 "[{\"protocol\":\"protocol1\",\"token\":\"token1\"},{\"protocol\":\"protocol2\",\"token\":\"token2\"}]" },
73                                 { "tosca.datatypes.Credential",
74                                                 "[{\"protocol\":\"protocol1\",\"token\":\"token1\"},{\"protocol\":\"protocol<br>2\",\"token\":\"token2  2\"}]",
75                                                 "[{\"protocol\":\"protocol1\",\"token\":\"token1\"},{\"protocol\":\"protocol2\",\"token\":\"token2 2\"}]" },
76                                 { "tosca.datatypes.Credential", null, null }, { "tosca.datatypes.Credential", "[]", "[]" },
77                                 { "integer", "[1,2,1,2]", "[1,2,1,2]" }, { "integer", "[1,,2]", "[1,2]" },
78                                 { "integer", "[1,null,2]", "[1,2]" }, { "integer", "[1,2,null]", "[1,2]" },
79                                 { "integer", "[null,1,2]", "[1,2]" }, { "integer", "[1,,2]", "[1,2]" },
80                                 { "integer", "[,1,2]", "[1,2]" },
81                                 // {"integer",
82                                 // "[1000000000000000000000000000000000000000000000000000,2]" ,
83                                 // "[1000000000000000000000000000000000000000000000000000,2]"},
84                                 { "integer", "[100000000,2]", "[100000000,2]" }, // Andrey, in
85                                                                                                                                         // success
86                                                                                                                                         // flow
87                                                                                                                                         // integer
88                                                                                                                                         // max value
89                                                                                                                                         // is
90                                                                                                                                         // 2147483647
91                                 { "integer", null, null }, // no default value
92                                 { "integer",
93                                                 "[1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2]",
94                                                 "[1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2]" },
95                                 // boolean
96                                 { "boolean", "[true,false]", "[true,false]" },
97                                 { "boolean", "[true,false,false]", "[true,false,false]" },
98                                 { "boolean", "[null,true,false]", "[true,false]" }, { "boolean", "[true,false,null]", "[true,false]" },
99                                 { "boolean", "[true,,false]", "[true,false]" }, { "boolean", "[true,false,]", "[true,false]" },
100                                 { "boolean", "[,true,false]", "[true,false]" }, { "boolean", null, null },
101                                 // DE199713 - Default value for property type Boolean should
102                                 // support also the following values: "true", "t" , "on" , "1" ,
103                                 // "false", "f" , "off" , "0"
104                                 { "boolean", "[on,off]", "[true,false]" }, { "boolean", "[ON,OFF]", "[true,false]" },
105                                 { "boolean", "[On,Off]", "[true,false]" }, { "boolean", "[yes,no]", "[true,false]" },
106                                 { "boolean", "[YES,NO]", "[true,false]" }, { "boolean", "[Yes,No]", "[true,false]" },
107                                 { "boolean", "[y,n]", "[true,false]" }, { "boolean", "[Y,N]", "[true,false]" },
108                                 // float
109                                 { "float", "[10.0,0.0]", "[10.0,0.0]" }, { "float", "[10,0]", "[10,0]" }, // contain
110                                                                                                                                                                                         // integer
111                                 { "float", "[-10,-5.30]", "[-10,-5.30]" }, // Negative numbers
112                                 { "float", "[10,null,0]", "[10,0]" }, { "float", "[null,10,0]", "[10,0]" },
113                                 { "float", "[10,0,null]", "[10,0]" },
114                                 { "float", "[10,0.1111111111111111111111111111111111111111]",
115                                                 "[10,0.1111111111111111111111111111111111111111]" },
116                                 { "float", "[10,   ,7.3  ]", "[10,7.3]" }, { "float", "[10 , 7.3 , ]", "[10,7.3]" },
117                                 { "float", "[, , 10 , 7.3 , ]", "[10,7.3]" }, { "float", "[4.7f, -5.5f ]", "[4.7,-5.5]" },
118                                 { "float", "[4.7f, 6.3 ,6.3, 4.7f]", "[4.7,6.3,6.3,4.7]" }, // duplicate
119                                                                                                                                                         // value
120                                 { "float", null, null }, { "string", "[aaaa , AAAA  ]", "[\"aaaa\",\"AAAA\"]" },
121
122                                 { "string",
123                                                 "[1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2]",
124                                                 "[\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\",\"1\",\"2\"]" },
125                                 { "string", "[aaaa , AAAA, 1, off , true, false  ]",
126                                                 "[\"aaaa\",\"AAAA\",\"1\",\"off\",\"true\",\"false\"]" },
127                                 { "string", "[aaaa , AAAA, aaaa, Aaaa , aaaa  ]", "[\"aaaa\",\"AAAA\",\"aaaa\",\"Aaaa\",\"aaaa\"]" },
128                                 { "string", "[aaaa , AAAA, ,  ]", "[\"aaaa\",\"AAAA\"]" },
129                                 { "string", "[ , aaaa , AAAA ]", "[\"aaaa\",\"AAAA\"]" },
130                                 { "string", "[ aaaa , ,  AAAA ]", "[\"aaaa\",\"AAAA\"]" },
131                                 { "string", "[ aaaa ,  AAAA, null ]", "[\"aaaa\",\"AAAA\"]" },
132                                 { "string", "[ null,  aaaa ,  AAAA ]", "[\"aaaa\",\"AAAA\"]" },
133                                 { "string", "[  aaaa , null ,  AAAA ]", "[\"aaaa\",\"AAAA\"]" }, { "string", null, null }, // without
134                                                                                                                                                                                                                         // default
135                                                                                                                                                                                                                         // values
136                                                                                                                                                                                                                         // -
137                                                                                                                                                                                                                         // Property
138                                                                                                                                                                                                                         // will
139                                                                                                                                                                                                                         // be
140                                                                                                                                                                                                                         // without
141                                                                                                                                                                                                                         // default
142                                                                                                                                                                                                                         // parameter
143                                 { "string", "[ <b>AAA</b> ]", "[\"AAA\"]" }, // BUG DE199715 -
144                                                                                                                                 // Error 400
145                                                                                                                                 // response
146                                                                                                                                 // received
147                                                                                                                                 // while adding
148                                                                                                                                 // property with
149                                                                                                                                 // default value
150                                                                                                                                 // contain HTML
151                                                                                                                                 // tags.
152                                                                                                                                 // Need to check
153                                                                                                                                 // whether / is
154                                                                                                                                 // legal in yaml
155
156                 };
157         }
158
159         @DataProvider
160         private static final Object[][] invalidListProperties() throws IOException, Exception {
161                 return new Object[][] {
162
163                                 { "integer", "[1,aaa]" },
164                                 { "tosca.datatypes.Credential",
165                                                 "[{\"protocol\":\"protocol1\",\"token\":\"token1\"},{\"protocol\":\"protocol2\",\"token1\":\"token2\"}]" },
166                                 { "integer", "[1,false]" }, { "integer", "[1,3.5]" }, { "integer", "[1,3#]" },
167                                 { "boolean", "[true,3.5]" }, { "boolean", "[true,1000]" }, { "boolean", "[false,trueee]" },
168                                 { "boolean", "[true,false!]" }, { "float", "[5.0000001,true]" }, { "float", "[0.0001,koko]" },
169                                 { "float", "[0.0001,6.3@]" }, { "float", "[0.0001f,6.3x]" }, };
170         }
171
172         @DataProvider
173         private static final Object[][] updatePropertiesListDefaultValueSuccessFlow() throws IOException, Exception {
174                 return new Object[][] {
175                                 // integer
176                                 // Setting --- update properties
177                                 // -----------------------------------------------------------------------
178                                 { "integer", "[1,2]", "[1,2]", "integer", "[200,100]", "[200,100]" },
179                                 { "integer", "[1,2]", "[1,2]", "integer", "[200,100,null]", "[200,100]" },
180                                 { "integer", "[1,2]", "[1,2]", "integer", "[null, 200,100]", "[200,100]" },
181                                 { "integer", "[1,2]", "[1,2]", "integer", "[200,null,100]", "[200,100]" },
182                                 { "integer", "[1,2]", "[1,2]", "integer", "[200,100,    ]", "[200,100]" },
183                                 { "integer", "[1,2]", "[1,2]", "integer", "[  , 200,100 ]", "[200,100]" },
184                                 { "integer", "[1,2]", "[1,2]", "integer", "[200 ,  ,100 ]", "[200,100]" },
185                                 { "integer", "[1,2]", "[1,2]", "integer", null, null },
186                                 { "integer", "[1,2]", "[1,2]", "integer", "[200 , 100 , 200, 100]", "[200,100,200,100]" },
187                                 //
188                                 // ////DE199829 update resource property schema_type is not
189                                 // updated
190                                 { "integer", "[1,2]", "[1,2]", "string", "[aaaa , bbbb ]", "[\"aaaa\",\"bbbb\"]" },
191                                 { "integer", "[1,2]", "[1,2]", "boolean", "[true , false ]", "[true,false]" },
192                                 { "integer", "[1,2]", "[1,2]", "float", "[3.5,4.8f ]", "[3.5,4.8]" },
193                                 // {"string", "[aaa,bbb]" , "[\"aaa\",\"bbb\"]","integer","[100,
194                                 // 200]" , "[\"100\",\"200\"]"},
195                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "integer", "[100, 200]", "[100,200]" },
196                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "float", "[0.1f, 3.01]", "[0.1,3.01]" },
197                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "boolean", "[true, false]", "[true,false]" },
198                                 { "float", "[1.2,2.3]", "[1.2,2.3]", "boolean", "[true, false]", "[true,false]" },
199                                 { "float", "[1.2,2.3]", "[1.2,2.3]", "integer", "[100, 200]", "[100,200]" },
200                                 { "float", "[1.2,2.3]", "[1.2,2.3]", "string", "[koko, moko]", "[\"koko\",\"moko\"]" },
201                                 { "boolean", "[true,false]", "[true,false]", "string", "[koko, moko]", "[\"koko\",\"moko\"]" },
202                                 // {"boolean", "[true,false]" ,
203                                 // "[\"true\",\"false\"]","integer","[100, 300000000000000]" ,
204                                 // "[\"100\",\"300000000000000\"]"},// Andrey, value not valid
205                                 // for integer success flow
206                                 { "boolean", "[true,false]", "[true,false]", "integer", "[100,2147483647]", "[100,2147483647]" }, // Andrey,
207                                                                                                                                                                                                                                         // in
208                                                                                                                                                                                                                                         // success
209                                                                                                                                                                                                                                         // flow
210                                                                                                                                                                                                                                         // integer
211                                                                                                                                                                                                                                         // max
212                                                                                                                                                                                                                                         // value
213                                                                                                                                                                                                                                         // is
214                                                                                                                                                                                                                                         // 2147483647
215                                 { "boolean", "[true,false]", "[true,false]", "float", "[3.000000000000002, 5.67f]",
216                                                 "[3.000000000000002,5.67]" },
217                                 // ////DE199829
218                                 //
219                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[xxx, yyy]", "[\"xxx\",\"yyy\"]" },
220                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[xxx , yyy ,null]", "[\"xxx\",\"yyy\"]" },
221                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[null, xxx, yyy]", "[\"xxx\",\"yyy\"]" },
222                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[xxx ,null,yyy]", "[\"xxx\",\"yyy\"]" },
223                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[xxx ,yyy,    ]", "[\"xxx\",\"yyy\"]" },
224                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[  , xxx,yyy ]", "[\"xxx\",\"yyy\"]" },
225                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[xxx ,  ,yyy ]", "[\"xxx\",\"yyy\"]" },
226                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[ xxx , yyy , xxx , yyy]",
227                                                 "[\"xxx\",\"yyy\",\"xxx\",\"yyy\"]" },
228                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", null, null },
229                                 { "string", "[aaa,bbb]", "[\"aaa\",\"bbb\"]", "string", "[xxx_-x, y__y--y]",
230                                                 "[\"xxx_-x\",\"y__y--y\"]" },
231                                 // DE199715
232                                 // {"string", "[aaa,bbb]" , "[\"aaa\",\"bbb\"]", "string" ,
233                                 // "[\"<b>xxx</b>\", \"<b>yyy</b>\"]" , "[\"xxx\",\"yyy\"]"},
234                                 //
235                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1 , -0.1]", "[2.1,-0.1]" },
236                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1, 0.1 ,null]", "[2.1,0.1]" },
237                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[null , 2.1, 0.1]", "[2.1,0.1]" },
238                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1,null,0.1]", "[2.1,0.1]" },
239                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1,0.1,    ]", "[2.1,0.1]" },
240                                 // {"float", "[1.00,0.02]" , "[1.00,0.02]","float","[ ,
241                                 // 2.00000000000001,0.00000000000000100 ]" ,
242                                 // "[2.00000000000001,0.00000000000000100]"},
243                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1 ,  ,0.1 ]", "[2.1,0.1]" },
244                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", null, null },
245                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1f ,  ,0.1f ]", "[2.1,0.1]" },
246                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[2.1 , 0.1 , 2.1, 0.1]", "[2.1,0.1,2.1,0.1]" },
247                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[200 , 100.11]", "[200,100.11]" },
248                                 { "float", "[1.00,0.02]", "[1.00,0.02]", "float", "[-2.35 , 100.11]", "[-2.35,100.11]" },
249                                 //
250                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[false , false]", "[false,false]" },
251                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[false, true ,null]", "[false,true]" },
252                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[null , false, true]", "[false,true]" },
253                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[false,null,true]", "[false,true]" },
254                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[false ,true ,    ]", "[false,true]" },
255                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[  , false, true ]", "[false,true]" },
256                                 { "boolean", "[true,false]", "[true,false]", "boolean", "[false ,  ,true ]", "[false,true]" },
257                                 { "boolean", "[true,false]", "[true,false]", "boolean", null, null }, { "boolean", "[true,false]",
258                                                 "[true,false]", "boolean", "[false , true , false, true]", "[false,true,false,true]" }, };
259         }
260
261         @DataProvider
262         private static final Object[][] updatePropertiesListDefaultValueFailureFlow() throws IOException, Exception {
263                 return new Object[][] {
264                                 // integer
265                                 // Setting --- update properties
266                                 // -----------------------------------------------------------------------
267                                 { "integer", "[1,2]", "[1,2]", "integer", "[aaa,bbb]" },
268                                 { "integer", "[1,2]", "[1,2]", "integer", "[true,false]" },
269                                 { "integer", "[1,2]", "[1,2]", "integer", "[1.0,100]" },
270                                 { "integer", "[1,2]", "[1,2]", "integer", "[@12,100]" },
271                                 { "float", "[0.11,0.22]", "[0.11,0.22]", "float", "[aaa, bbb]" },
272                                 { "float", "[0.11,0.22]", "[0.11,0.22]", "float", "[0.88, false]" },
273                                 { "float", "[0.11,0.22]", "[0.11,0.22]", "float", "[0.88g, 0.3]" },
274                                 { "float", "[0.11,0.22]", "[0.11,0.22]", "float", "[@0.88, 0.3]" },
275                                 { "boolean", "[true, false]", "[true,false]", "boolean", "[true, 100]" },
276                                 { "boolean", "[true, false]", "[true,false]", "boolean", "[false, 0.01]" },
277                                 { "boolean", "[true, false]", "[true,false]", "boolean", "[koko, true]" },
278                                 { "boolean", "[true, false]", "[true,false]", "boolean", "[@false, true]" },
279
280                 };
281         }
282
283         // Map properties
284         @DataProvider
285         private static final Object[][] updatePropertiesMapDefaultValueSuccessFlow() throws IOException, Exception {
286                 return new Object[][] {
287                                 // entrySchemaType , propertyDefaultValues ,
288                                 // expectedDefaultValue , newEntrySchemaType ,
289                                 // newPropertyDefaultValue , newExpectedDefaultValue
290                                 // integer
291                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "integer",
292                                                 "{\"key1\":200,\"key2\":null , \"key3\":300}", "{\"key1\":200,\"key2\":null,\"key3\":300}" },
293                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "integer",
294                                                 "{\"key1\":null,\"key2\":200 , \"key3\":100}", "{\"key1\":null,\"key2\":200,\"key3\":100}" },
295                                 // string
296                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "string",
297                                                 "{\"key1\":\"aaaa\" , \"key2\":\"aaaa\"}", "{\"key1\":\"aaaa\",\"key2\":\"aaaa\"}" },
298                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "boolean",
299                                                 "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}" },
300                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "float",
301                                                 "{\"key1\":3.5 , \"key2\":4.8f}", "{\"key1\":3.5,\"key2\":4.8}" },
302                                 // string
303                                 { "string", "{\"key1\":aaa , \"key2\":bbb}", "{\"key1\":\"aaa\",\"key2\":\"bbb\"}", "string",
304                                                 "{\"key1\":xxx , \"key2\":yyy}", "{\"key1\":\"xxx\",\"key2\":\"yyy\"}" },
305                                 // float
306                                 { "float", "{\"key1\":1.00 , \"key2\":0.02}", "{\"key1\":1.00,\"key2\":0.02}", "float",
307                                                 "{\"key1\":2.1, \"key2\":-0.1}", "{\"key1\":2.1,\"key2\":-0.1}" },
308                                 { "float", "{\"key1\":1.00 , \"key2\":0.02}", "{\"key1\":1.00,\"key2\":0.02}", "float",
309                                                 "{\"key1\":2.1 , \"key2\":0.1 , \"key3\":null}", "{\"key1\":2.1,\"key2\":0.1,\"key3\":null}" },
310                                 // boolean
311                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
312                                                 "{\"key1\":false , \"key2\":false}", "{\"key1\":false,\"key2\":false}" },
313                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
314                                                 "{\"key1\":false , \"key2\":true , \"key3\":null}",
315                                                 "{\"key1\":false,\"key2\":true,\"key3\":null}" },
316                                 // null
317                                 { "boolean", "{\"key1\":null , \"key2\":false}", "{\"key1\":null,\"key2\":false}", "boolean",
318                                                 "{\"key1\":false , \"key2\":true , \"key3\":null}",
319                                                 "{\"key1\":false,\"key2\":true,\"key3\":null}" },
320                                 // tosca.datatypes.Credential
321                                 { "tosca.datatypes.Credential",
322                                                 "{\"key1\":{\"protocol\":\"protocol<br>1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}",
323                                                 "{\"key1\":{\"protocol\":\"protocol1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}",
324                                                 "tosca.datatypes.Credential",
325                                                 "{\"key1\":{\"protocol\":\"protocol<br>1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}",
326                                                 "{\"key1\":{\"protocol\":\"protocol1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}" },
327
328                 };
329         }
330
331         @DataProvider
332         private static final Object[][] propertiesMapDefaultValueSuccessFlow() throws IOException, Exception {
333                 return new Object[][] {
334
335                                 // entrySchemaType , propertyDefaultValues ,
336                                 // expectedDefaultValue
337                                 //
338                                 // {"string",
339                                 // "{\"vf_module_id\":{\"get_input\":\"vf_module_id\"},
340                                 // \"vnf_idw\": 2}",
341                                 // "{\"vf_module_id\":{\"get_input\":\"vf_module_id\"},
342                                 // \"vnf_idw\": 2}"},
343
344                                 // tosca.datatypes.Credential
345                                 { "tosca.datatypes.Credential",
346                                                 "{\"key1\":{\"protocol\":\"protocol<br>1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}",
347                                                 "{\"key1\":{\"protocol\":\"protocol1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}" },
348                                 // integer
349                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}" },
350                                 { "integer", "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":2}",
351                                                 "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":2}" },
352                                 { "integer", "{\"key1\":1,\"key2\":null,\"key3\":1,\"key4\":2}",
353                                                 "{\"key1\":1,\"key2\":null,\"key3\":1,\"key4\":2}" },
354                                 { "integer", "{\"key1\":null,\"key2\":1,\"key3\":1,\"key4\":2}",
355                                                 "{\"key1\":null,\"key2\":1,\"key3\":1,\"key4\":2}" },
356                                 { "integer", "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":null}",
357                                                 "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":null}" },
358                                 { "integer", "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":NULL}",
359                                                 "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":null}" },
360                                 { "integer", "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":Null}",
361                                                 "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":null}" },
362                                 { "integer", "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":nuLL}",
363                                                 "{\"key1\":1,\"key2\":2,\"key3\":1,\"key4\":null}" },
364                                 { "integer", null, null }, // no default value
365                                 // //BUG
366                                 //// {"integer",
367                                 // "{\"key1\":1000000000000000000000000000000000000000000000000000,\"key2\":2}"
368                                 // ,"{\"key1\":1000000000000000000000000000000000000000000000000000,\"key2\":2}"},
369                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}" },
370                                 { "boolean", "{\"key1\":true , \"key2\":false, \"key3\":false }",
371                                                 "{\"key1\":true,\"key2\":false,\"key3\":false}" },
372                                 { "boolean", "{\"key1\":null , \"key2\":true, \"key3\":false }",
373                                                 "{\"key1\":null,\"key2\":true,\"key3\":false}" },
374                                 { "boolean", "{\"key1\":true , \"key2\":Null, \"key3\":false }",
375                                                 "{\"key1\":true,\"key2\":null,\"key3\":false}" },
376                                 { "boolean", "{\"key1\":true , \"key2\":false, \"key3\":nULL }",
377                                                 "{\"key1\":true,\"key2\":false,\"key3\":null}" },
378                                 { "boolean", null, null },
379                                 { "boolean", "{\"key1\":on , \"key2\":off}", "{\"key1\":true,\"key2\":false}" },
380                                 { "boolean", "{\"key1\":ON , \"key2\":OFF}", "{\"key1\":true,\"key2\":false}" },
381                                 { "boolean", "{\"key1\":On , \"key2\":Off}", "{\"key1\":true,\"key2\":false}" },
382                                 { "boolean", "{\"key1\":yes , \"key2\":no}", "{\"key1\":true,\"key2\":false}" },
383                                 { "boolean", "{\"key1\":YES , \"key2\":NO}", "{\"key1\":true,\"key2\":false}" },
384                                 { "boolean", "{\"key1\":Yes , \"key2\":No}", "{\"key1\":true,\"key2\":false}" },
385                                 { "boolean", "{\"key1\":y , \"key2\":n}", "{\"key1\":true,\"key2\":false}" },
386                                 { "boolean", "{\"key1\":Y , \"key2\":N}", "{\"key1\":true,\"key2\":false}" },
387                                 { "boolean", "{null:false}", "{\"null\":false}" },
388                                 // float
389                                 { "float", "{\"key1\":10.0 , \"key2\":0.0}", "{\"key1\":10.0,\"key2\":0.0}" },
390                                 { "float", "{\"key1\":10 , \"key2\":0}", "{\"key1\":10,\"key2\":0}" }, // contain
391                                                                                                                                                                                 // integer
392                                 { "float", "{\"key1\":null , \"key2\":Null}", "{\"key1\":null,\"key2\":null}" }, // contain
393                                                                                                                                                                                                         // null
394                                 { "float", "{\"key1\":3.5 , \"key2\":nULL}", "{\"key1\":3.5,\"key2\":null}" },
395                                 // BUG
396                                 { "float", "{\"key1\":3.5 , \"key2\":0.1111111111111111111111111111111111111111}",
397                                                 "{\"key1\":3.5,\"key2\":0.1111111111111111111111111111111111111111}" },
398                                 { "float", "{\"key1\":4.7f , \"key2\":-5.5f}", "{\"key1\":4.7,\"key2\":-5.5}" },
399                                 { "float", "{\"key1\":4.7f , \"key2\":-5.5f, \"key3\":-5.5f}",
400                                                 "{\"key1\":4.7,\"key2\":-5.5,\"key3\":-5.5}" },
401                                 { "boolean", null, null },
402                                 { "string", "{\"key1\":aaaa , \"key2\":AAAA}", "{\"key1\":\"aaaa\",\"key2\":\"AAAA\"}" },
403                                 { "string", "{\"key1\":off , \"key2\":true , \"key3\":1}",
404                                                 "{\"key1\":\"off\",\"key2\":\"true\",\"key3\":\"1\"}" },
405                                 { "string", "{\"key1\":aaaa , \"key2\":Aaaa , \"key3\":aaaa}",
406                                                 "{\"key1\":\"aaaa\",\"key2\":\"Aaaa\",\"key3\":\"aaaa\"}" },
407                                 { "string", "{\"key1\":aaaa , \"key2\":bbbb , \"key3\":null}",
408                                                 "{\"key1\":\"aaaa\",\"key2\":\"bbbb\",\"key3\":null}" },
409                                 { "string", "{\"key1\":NULL , \"key2\":bbbb , \"key3\":aaaa}",
410                                                 "{\"key1\":null,\"key2\":\"bbbb\",\"key3\":\"aaaa\"}" },
411                                 { "string", "{\"key1\":aaaa , \"key2\":Null , \"key3\":bbbb}",
412                                                 "{\"key1\":\"aaaa\",\"key2\":null,\"key3\":\"bbbb\"}" },
413                                 { "string", null, null }, // without default values - Property
414                                                                                         // will be without default parameter
415                                 { "string", "{\"key1\":\"<b>AAAA</b>\" }", "{\"key1\":\"AAAA\"}" },
416
417                 };
418         }
419
420         @DataProvider
421         private static final Object[][] updatePropertiesMapDefaultValueFailureFlow() throws IOException, Exception {
422                 return new Object[][] {
423
424                                 // integer
425                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "integer",
426                                                 "{\"key1\":aaa , \"key2\":bbb}" },
427                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "integer",
428                                                 "{\"key1\":true , \"key2\":false}" },
429                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "integer",
430                                                 "{\"key1\":1.0 , \"key2\":100}" },
431                                 { "integer", "{\"key1\":1 , \"key2\":2}", "{\"key1\":1,\"key2\":2}", "integer",
432                                                 "{\"key1\":12@ , \"key2\":100}" },
433                                 // float
434                                 { "float", "{\"key1\":0.11 , \"key2\":0.22}", "{\"key1\":0.11,\"key2\":0.22}", "float",
435                                                 "{\"key1\":aaa , \"key2\":bbb}" },
436                                 { "float", "{\"key1\":0.11 , \"key2\":0.22}", "{\"key1\":0.11,\"key2\":0.22}", "float",
437                                                 "{\"key1\":0.88 , \"key2\":false}" },
438                                 { "float", "{\"key1\":0.11 , \"key2\":0.22}", "{\"key1\":0.11,\"key2\":0.22}", "float",
439                                                 "{\"key1\":0.88g , \"key2\":0.3}" },
440                                 { "float", "{\"key1\":0.11 , \"key2\":0.22}", "{\"key1\":0.11,\"key2\":0.22}", "float",
441                                                 "{\"key1\":@0.88g , \"key2\":0.3}" },
442                                 // boolean
443                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
444                                                 "{\"key1\":true , \"key2\":100}" },
445                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
446                                                 "{\"key1\":false , \"key2\":0.01}" },
447                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
448                                                 "{\"key1\":koko , \"key2\":true}" },
449                                 { "boolean", "{\"key1\":true , \"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
450                                                 "{\"key1\":@false , \"key2\":true}" },
451                                 { "boolean", "{\"key1\":true,\"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
452                                                 "{:false , \"key2\":true}" },
453                                 { "boolean", "{\"key1\":true,\"key2\":false}", "{\"key1\":true,\"key2\":false}", "boolean",
454                                                 "{\"key1\":true , , \"key2\":false}" },
455                                 // tosca.datatypes.Credential
456                                 { "tosca.datatypes.Credential",
457                                                 "{\"key1\":{\"protocol\":\"protocol<br>1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}",
458                                                 "{\"key1\":{\"protocol\":\"protocol1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token\":\"token2\"}}",
459                                                 "tosca.datatypes.Credential",
460                                                 "{\"key1\":{\"protocol\":\"protocol<br>1\",\"token\":\"token1\"},\"key2\":{\"protocol\":\"protocol2\",\"token2\":\"token2\"}}" },
461
462                 };
463         }
464
465         // US594938 - UPDATE PROPERTY
466         // DE199718
467         @Test(dataProvider = "updatePropertiesListDefaultValueFailureFlow")
468         public void updateDefaultValueOfResourcePropertyListFailureFlow(String entrySchemaType, String propertyDefaltValues,
469                         String expecteddefaultValues, String newEntrySchemaType, String newPropertyDefaltValues) throws Exception {
470                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
471                 propertyDetails.setPropertyDefaultValue(propertyDefaltValues);
472                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
473                 // create resource
474                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
475                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
476                                 .value();
477                 // Add property type list to resource
478                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
479                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
480                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
481                 // verify properties return from response
482                 assertEquals("list", resourcePropertiesFromResponse.getType());
483                 assertEquals(expecteddefaultValues, resourcePropertiesFromResponse.getDefaultValue());
484                 assertEquals(propertyDetails.getSchema().getProperty().getType(),
485                                 resourcePropertiesFromResponse.getSchema().getProperty().getType()); // string/integer/boolean/float
486                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
487                 // Update resource property type = "list"
488                 propertyDetails.setPropertyDefaultValue(newPropertyDefaltValues);
489                 propertyDetails.getSchema().getProperty().setType(newEntrySchemaType);
490                 RestResponse updatePropertyResponse = AtomicOperationUtils
491                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, false)
492                                 .right().value();
493                 assertTrue(updatePropertyResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
494                 ArrayList<String> variables = new ArrayList<>();
495                 variables.add(propertyDetails.getName());
496                 variables.add(propertyDetails.getPropertyType());
497                 variables.add(propertyDetails.getSchema().getProperty().getType());
498                 variables.add(newPropertyDefaltValues);
499                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables,
500                                 updatePropertyResponse.getResponse());
501         }
502
503         @Test
504         public void updatePropertyOfDerivedResource() throws Exception {
505                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty(PropertyTypeEnum.STRING_LIST);
506                 // create resource
507                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
508                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
509                                 .value();
510                 // Add property type list to resource
511                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
512                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
513                 String derivedResourcePropertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
514                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
515                 // second resource derived from basicVFC
516                 Resource vfc1FromBasicVFC = AtomicOperationUtils
517                                 .createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, basicVFC,
518                                                 ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true)
519                                 .left().value();
520                 // add property Type list to second resource
521                 PropertyReqDetails defaultListProperty = ElementFactory.getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
522                 resourcePropertiesFromResponse = AtomicOperationUtils
523                                 .addCustomPropertyToResource(defaultListProperty, vfc1FromBasicVFC, UserRoleEnum.DESIGNER, true).left()
524                                 .value();
525                 // Update property (list) of derived resource
526                 RestResponse updatePropertyResponse = AtomicOperationUtils.updatePropertyOfResource(propertyDetails, basicVFC,
527                                 derivedResourcePropertyUniqueId, UserRoleEnum.DESIGNER, false).right().value();
528                 assertTrue(updatePropertyResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
529                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
530                                 updatePropertyResponse.getResponse());
531                 // Verify resource's priority list did not changed
532                 verifyResourcePropertyList(basicVFC, propertyDetails, "[\"a\",\"b\"]");
533         }
534
535         @Test
536         public void updatePropertyOfNonDerivedResource() throws Exception {
537                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty(PropertyTypeEnum.STRING_LIST);
538                 // create resource
539                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
540                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
541                                 .value();
542                 // Add property type list to resource
543                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
544                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
545                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
546                 // second resource derived from basicVFC
547                 Resource vfc1FromBasicVFC = AtomicOperationUtils
548                                 .createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, basicVFC,
549                                                 ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true)
550                                 .left().value();
551                 // add property Type list to second resource
552                 PropertyReqDetails defaultListProperty = ElementFactory.getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
553                 resourcePropertiesFromResponse = AtomicOperationUtils
554                                 .addCustomPropertyToResource(defaultListProperty, vfc1FromBasicVFC, UserRoleEnum.DESIGNER, true).left()
555                                 .value();
556                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
557                 // Update property (list) of derived resource
558                 defaultListProperty.setPropertyDefaultValue("[1,2,3,4]");
559                 String expectedDefaultValue = "[1,2,3,4]";
560                 ComponentInstanceProperty resourcePropertyAfterUpdate = AtomicOperationUtils
561                                 .updatePropertyOfResource(defaultListProperty, vfc1FromBasicVFC, propertyUniqueId,
562                                                 UserRoleEnum.DESIGNER, true)
563                                 .left().value();
564                 assertEquals(resourcePropertyAfterUpdate.getType(), "list");
565                 assertEquals(resourcePropertyAfterUpdate.getDefaultValue(), expectedDefaultValue);
566                 assertEquals(resourcePropertyAfterUpdate.getSchema().getProperty().getType(),
567                                 defaultListProperty.getSchema().getProperty().getType()); // string/integer/boolean/float
568                 // Get resource and verify updated default value
569                 RestResponse restResponse = ResourceRestUtils.getResource(vfc1FromBasicVFC.getUniqueId());
570                 String expectedDefaultValueFromDerivedResource = "[\"a\",\"b\"]";
571                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
572                 resource.getProperties().get(0).getDefaultValue().equals(expectedDefaultValue);
573                 resource.getProperties().get(1).getDefaultValue().equals(expectedDefaultValueFromDerivedResource);
574         }
575
576         @Test
577         public void updateListPropertyToNonCheckedOutResource() throws Exception {
578                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
579                 String PropertyDefaultValue = "[2,3]";
580                 propertyDetails.setPropertyDefaultValue(PropertyDefaultValue);
581                 propertyDetails.getSchema().getProperty().setType("integer");
582                 // create resource
583                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
584                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
585                                 .value();
586                 // Add property type list to resource
587                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
588                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
589                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
590                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
591                 // Update resource property type = "list"
592                 propertyDetails.setPropertyDefaultValue("[3,4]");
593                 propertyDetails.getSchema().getProperty().setType("integer");
594                 RestResponse updatePropertyResponse = AtomicOperationUtils
595                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, false)
596                                 .right().value();
597                 assertTrue(updatePropertyResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
598                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
599                                 updatePropertyResponse.getResponse());
600                 // Verify resource's priority list did not changed
601                 verifyResourcePropertyList(basicVFC, propertyDetails, "[2,3]");
602         }
603
604         @Test
605         public void updateListPropertyResourceByNonResouceOwner() throws Exception {
606                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
607                 String PropertyDefaultValue = "[2,3]";
608                 propertyDetails.setPropertyDefaultValue(PropertyDefaultValue);
609                 propertyDetails.getSchema().getProperty().setType("integer");
610                 // create resource
611                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
612                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
613                                 .value();
614                 // Add property type list to resource
615                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
616                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
617                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
618                 // AtomicOperationUtils.changeComponentState(basicVFC,
619                 // UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
620                 // Update resource property type = "list"
621                 propertyDetails.setPropertyDefaultValue("[3,4]");
622                 propertyDetails.getSchema().getProperty().setType("integer");
623                 RestResponse updatePropertyResponse = AtomicOperationUtils
624                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER2, false)
625                                 .right().value();
626                 assertTrue(updatePropertyResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
627                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
628                                 updatePropertyResponse.getResponse());
629                 // Verify resource's priority list did not changed
630                 verifyResourcePropertyList(basicVFC, propertyDetails, "[2,3]");
631         }
632
633         @Test
634         public void updateListPropertyResourceByTester() throws Exception {
635                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
636                 String PropertyDefaultValue = "[2,3]";
637                 propertyDetails.setPropertyDefaultValue(PropertyDefaultValue);
638                 propertyDetails.getSchema().getProperty().setType("integer");
639                 // create resource
640                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
641                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
642                                 .value();
643                 // Add property type list to resource
644                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
645                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
646                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
647                 // AtomicOperationUtils.changeComponentState(basicVFC,
648                 // UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
649                 // Update resource property type = "list"
650                 propertyDetails.setPropertyDefaultValue("[3,4]");
651                 propertyDetails.getSchema().getProperty().setType("integer");
652                 RestResponse updatePropertyResponse = AtomicOperationUtils
653                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.TESTER, false)
654                                 .right().value();
655                 assertTrue(updatePropertyResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
656                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
657                                 updatePropertyResponse.getResponse());
658                 // Verify resource's priority list did not changed
659                 verifyResourcePropertyList(basicVFC, propertyDetails, "[2,3]");
660         }
661
662         // DE199964
663         @Test(enabled = false)
664         public void updateListPropertyToNonExistingResource() throws Exception {
665                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
666                 String PropertyDefaultValue = "[2,3]";
667                 propertyDetails.setPropertyDefaultValue(PropertyDefaultValue);
668                 propertyDetails.getSchema().getProperty().setType("integer");
669                 // create resource
670                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
671                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
672                                 .value();
673                 // Add property type list to resource
674                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
675                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
676                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
677                 String resourceUniqueId = basicVFC.getUniqueId();
678                 basicVFC.setUniqueId("1111111");
679                 RestResponse updatePropertyResponse = AtomicOperationUtils
680                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, false)
681                                 .right().value();
682                 assertTrue(updatePropertyResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_NOT_FOUND));
683                 ArrayList<String> variables = new ArrayList<>();
684                 variables.add(basicVFC.getUniqueId());
685                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), variables,
686                                 updatePropertyResponse.getResponse());
687                 // Verify resource's priority list did not changed
688                 basicVFC.setUniqueId(resourceUniqueId);
689                 verifyResourcePropertyList(basicVFC, propertyDetails, "[2,3]");
690         }
691
692         // DE199725
693         @Test
694         public void updateResourcePropertyListNonSupportedPropertyType() throws Exception { // Not
695                                                                                                                                                                                 // "list"
696                                                                                                                                                                                 // type
697                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
698                 String PropertyDefaultValue = "[2,3]";
699                 propertyDetails.setPropertyDefaultValue(PropertyDefaultValue);
700                 propertyDetails.getSchema().getProperty().setType("integer");
701                 // create resource
702                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
703                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
704                                 .value();
705                 // Add property type list to resource
706                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
707                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
708                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
709                 // update resource property
710                 String propertyType = "listttttttt";
711                 propertyDetails.setPropertyType(propertyType);
712                 RestResponse updatePropertyResponse = AtomicOperationUtils
713                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, false)
714                                 .right().value();
715                 ArrayList<String> variables = new ArrayList<>();
716                 variables.add(propertyDetails.getPropertyType()); // property data type
717                                                                                                                         // (koko instead
718                                                                                                                         // list)
719                 variables.add(propertyDetails.getName());
720                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_TYPE.name(), variables,
721                                 updatePropertyResponse.getResponse());
722                 // Verify resource's priority list did not changed
723                 propertyDetails.setPropertyType("list");
724                 verifyResourcePropertyList(basicVFC, propertyDetails, "[2,3]");
725         }
726
727         @Test(enabled = false) // DE199732
728         public void updateResourcePropertyListNonSupportedEntrySchemaType() throws Exception {
729                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
730                 String PropertyDefaultValue = "[2,3]";
731                 propertyDetails.setPropertyDefaultValue(PropertyDefaultValue);
732                 propertyDetails.getSchema().getProperty().setType("integer");
733                 // create resource
734                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
735                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
736                                 .value();
737                 // Add property type list to resource
738                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
739                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
740                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
741                 // update resource property
742                 String EntrySchemaType = "integerrrrrr";
743                 propertyDetails.getSchema().getProperty().setType(EntrySchemaType);
744                 RestResponse updatePropertyResponse = AtomicOperationUtils
745                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, false)
746                                 .right().value();
747                 assertTrue(updatePropertyResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
748                 ArrayList<String> variables = new ArrayList<>();
749                 variables.add(EntrySchemaType);
750                 variables.add(propertyDetails.getName());
751                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_INNER_TYPE.name(), variables,
752                                 updatePropertyResponse.getResponse());
753                 propertyDetails.getSchema().getProperty().setType("integer");
754                 verifyResourcePropertyList(basicVFC, propertyDetails, "[2,3]");
755         }
756
757         @Test(dataProvider = "updatePropertiesListDefaultValueSuccessFlow")
758         public void updateResourcePropertyListSuccessFlow(String entrySchemaType, String propertyDefaltValues,
759                         String expecteddefaultValues, String newEntrySchemaType, String newPropertyDefaltValues,
760                         String newExpecteddefaultValues) throws Exception {
761                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
762                 propertyDetails.setPropertyDefaultValue(propertyDefaltValues);
763                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
764                 // create resource
765                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
766                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
767                                 .value();
768                 // Add property type list to resource
769                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
770                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
771                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
772                 // verify properties return from response
773                 assertEquals("list", resourcePropertiesFromResponse.getType());
774                 assertEquals(expecteddefaultValues, resourcePropertiesFromResponse.getDefaultValue());
775                 assertEquals(propertyDetails.getSchema().getProperty().getType(),
776                                 resourcePropertiesFromResponse.getSchema().getProperty().getType()); // string/integer/boolean/float
777                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
778                 // Update resource property type = "list"
779                 propertyDetails.setPropertyDefaultValue(newPropertyDefaltValues);
780                 propertyDetails.getSchema().getProperty().setType(newEntrySchemaType);
781                 ComponentInstanceProperty resourcePropertyAfterUpdate = AtomicOperationUtils
782                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, true)
783                                 .left().value();
784                 assertEquals("list", resourcePropertyAfterUpdate.getType());
785                 assertEquals(newExpecteddefaultValues, resourcePropertyAfterUpdate.getDefaultValue());
786                 assertEquals(propertyDetails.getSchema().getProperty().getType(),
787                                 resourcePropertyAfterUpdate.getSchema().getProperty().getType()); // string/integer/boolean/float
788                 verifyResourcePropertyList(basicVFC, propertyDetails, newExpecteddefaultValues);
789         }
790
791         // Add property type list to resource
792         // DE199718
793         @Test(dataProvider = "invalidListProperties") // invalid default values
794         public void addListPropertyToResourceFailureFlow(String entrySchemaType, String propertyDefaltValues)
795                         throws Exception {
796                 // String propertyType = "list";
797                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
798                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
799                 propertyDetails.setPropertyDefaultValue(propertyDefaltValues);
800                 // create resource
801                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
802                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
803                                 .value();
804                 // Add property type list to resource
805                 RestResponse addPropertyToResourceResponse = AtomicOperationUtils
806                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
807                 assertTrue(addPropertyToResourceResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
808                 ArrayList<String> variables = new ArrayList<>();
809                 variables.add(propertyDetails.getName());
810                 variables.add(propertyDetails.getPropertyType());
811                 variables.add(propertyDetails.getSchema().getProperty().getType());
812                 variables.add(propertyDefaltValues);
813                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables,
814                                 addPropertyToResourceResponse.getResponse());
815
816         }
817
818         // DE199964
819         @Test
820         public void addListPropertyToNonExistingResource() throws Exception {
821                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
822                 propertyDetails.getSchema().getProperty().setType("integer");
823                 propertyDetails.setPropertyDefaultValue("[1,2]");
824                 // create resource
825                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
826                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
827                                 .value();
828                 // Add property type list to non existing resource
829                 basicVFC.setUniqueId("1111111");
830                 RestResponse addPropertyToResourceResponse = AtomicOperationUtils
831                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
832                 assertTrue(addPropertyToResourceResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_NOT_FOUND));
833                 ArrayList<String> variables = new ArrayList<>();
834                 variables.add("");
835                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), variables,
836                                 addPropertyToResourceResponse.getResponse());
837         }
838
839         @Test
840         public void addListPropertyToNonCheckedOutResource() throws Exception {
841                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
842                 propertyDetails.getSchema().getProperty().setType("integer");
843                 propertyDetails.setPropertyDefaultValue("[1,2]");
844                 // create resource
845                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
846                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
847                                 .value();
848                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
849                 // Add property type list to non Checked-Out resource
850                 RestResponse addPropertyToResourceResponse = AtomicOperationUtils
851                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
852                 assertTrue(addPropertyToResourceResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
853                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
854                                 addPropertyToResourceResponse.getResponse());
855         }
856
857         @Test
858         public void addListPropertyToResourceByNonResourceOwner() throws Exception {
859                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
860                 propertyDetails.getSchema().getProperty().setType("integer");
861                 propertyDetails.setPropertyDefaultValue("[1,2]");
862                 // create resource
863                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
864                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
865                                 .value();
866                 // Add property type list to non Checked-Out resource
867                 RestResponse addPropertyToResourceResponse = AtomicOperationUtils
868                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER2, false).right().value();
869                 assertTrue(addPropertyToResourceResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
870                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
871                                 addPropertyToResourceResponse.getResponse());
872         }
873
874         @Test
875         public void addListPropertyToResourcePropertyAlreadyExists01() throws Exception {
876                 String propertyType = "list";
877                 String propertySchemaType = "integer";
878                 String defaultValues = "[1,2]";
879                 String expecteddefaultValues = "[1,2]";
880                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
881                 propertyDetails.getSchema().getProperty().setType(propertySchemaType);
882                 propertyDetails.setPropertyDefaultValue(defaultValues);
883                 // create resource
884                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
885                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
886                                 .value();
887                 // check-in and check-out resource
888                 RestResponse changeComponentState = LifecycleRestUtils.changeComponentState(basicVFC,
889                                 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKIN);
890                 assertTrue(changeComponentState.getErrorCode().equals(BaseRestUtils.STATUS_CODE_SUCCESS));
891                 changeComponentState = LifecycleRestUtils.changeComponentState(basicVFC,
892                                 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKOUT);
893                 assertTrue(changeComponentState.getErrorCode().equals(BaseRestUtils.STATUS_CODE_SUCCESS));
894                 // Add property type list to resource
895                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
896                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
897                 // verify properties return from response
898                 assertEquals(resourcePropertiesFromResponse.getType(), propertyType);
899                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), expecteddefaultValues);
900                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(), propertySchemaType); // string/integer/boolean/float
901                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
902                 // Add same property again to resource
903                 RestResponse addPropertyRestResponse = AtomicOperationUtils
904                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
905                 assertTrue(addPropertyRestResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_ALREADY_EXISTS));
906                 ArrayList<String> variables = new ArrayList<>();
907                 variables.add("");
908                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PROPERTY_ALREADY_EXIST.name(), variables,
909                                 addPropertyRestResponse.getResponse());
910                 // verify property not deleted
911                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
912         }
913
914         @Test
915         public void addListPropertyToResourcePropertyAlreadyExists02() throws Exception {
916                 String propertyType = "list";
917                 String propertySchemaType = "integer";
918                 String defaultValues = "[1,2]";
919                 String expecteddefaultValues = "[1,2]";
920                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
921                 propertyDetails.getSchema().getProperty().setType(propertySchemaType);
922                 propertyDetails.setPropertyDefaultValue(defaultValues);
923                 // create resource
924                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
925                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
926                                 .value();
927                 // Add property type list to resource
928                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
929                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
930                 // verify properties return from response
931                 assertEquals(resourcePropertiesFromResponse.getType(), propertyType);
932                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), expecteddefaultValues);
933                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(), propertySchemaType); // string/integer/boolean/float
934                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
935                 // check-in and check-out resource
936                 RestResponse changeComponentState = LifecycleRestUtils.changeComponentState(basicVFC,
937                                 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKIN);
938                 assertTrue(changeComponentState.getErrorCode().equals(BaseRestUtils.STATUS_CODE_SUCCESS));
939                 changeComponentState = LifecycleRestUtils.changeComponentState(basicVFC,
940                                 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKOUT);
941                 assertTrue(changeComponentState.getErrorCode().equals(BaseRestUtils.STATUS_CODE_SUCCESS));
942                 // Add same property again to resource
943                 RestResponse addPropertyRestResponse = AtomicOperationUtils
944                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
945                 assertTrue(addPropertyRestResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_ALREADY_EXISTS));
946                 ArrayList<String> variables = new ArrayList<>();
947                 variables.add("");
948                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PROPERTY_ALREADY_EXIST.name(), variables,
949                                 addPropertyRestResponse.getResponse());
950                 // verify property not deleted
951                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
952         }
953
954         @Test // DE199725
955         public void addListPropertyToResourceNonSupportedPropertyType() throws Exception { // Not
956                                                                                                                                                                                 // "list"
957                                                                                                                                                                                 // type
958                 String propertyType = "listttttttt";
959                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
960                 propertyDetails.setPropertyType(propertyType);
961                 // create resource
962                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
963                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
964                                 .value();
965                 // Add property type list to resource
966                 RestResponse addPropertyRestResponse = AtomicOperationUtils
967                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
968                 assertTrue(addPropertyRestResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
969                 ArrayList<String> variables = new ArrayList<>();
970                 variables.add(propertyDetails.getPropertyType()); // property data type
971                                                                                                                         // (koko instead
972                                                                                                                         // list)
973                 variables.add(propertyDetails.getName());
974                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_TYPE.name(), variables,
975                                 addPropertyRestResponse.getResponse());
976         }
977
978         @Test // DE199732
979         public void addListPropertyToResourceNonSupportedEntrySchemaType() throws Exception {
980                 String EntrySchemaType = "stringggg"; // instead "string"
981                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
982                 propertyDetails.getSchema().getProperty().setType(EntrySchemaType);
983                 // create resource
984                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
985                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
986                                 .value();
987                 // Add property type list to resource
988                 RestResponse addPropertyRestResponse = AtomicOperationUtils
989                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
990                 assertTrue(addPropertyRestResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
991                 ArrayList<String> variables = new ArrayList<>();
992                 variables.add(EntrySchemaType);
993                 variables.add(propertyDetails.getName());
994                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_PROPERTY_INNER_TYPE.name(), variables,
995                                 addPropertyRestResponse.getResponse());
996         }
997
998         @Test
999         public void addHundredPropertyListToResourceSuccessFlow() throws Exception {
1000                 String propertyType = "list";
1001                 // create resource
1002                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1003                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1004                                 .value();
1005                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
1006                 String propertyName = propertyDetails.getName();
1007                 int numberOfPropertiesToAddToResource = 100;
1008                 ComponentInstanceProperty resourcePropertiesFromResponse;
1009                 for (int x = 0; x < numberOfPropertiesToAddToResource; x++) {
1010                         propertyDetails.setName(propertyName + x);
1011                         resourcePropertiesFromResponse = AtomicOperationUtils
1012                                         .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1013                         // verify properties return from response
1014                         assertEquals(resourcePropertiesFromResponse.getName(), propertyName + x);
1015                         assertEquals(resourcePropertiesFromResponse.getType(), propertyType);
1016                         assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[\"a\",\"b\"]");
1017                         assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1018                                         propertyDetails.getSchema().getProperty().getType()); // string/integer/boolean/float
1019                 }
1020                 // get resource and verify that 100 properties exist
1021                 Resource resourceObject = AtomicOperationUtils.getResourceObject(basicVFC, UserRoleEnum.DESIGNER);
1022                 assertEquals(numberOfPropertiesToAddToResource, resourceObject.getProperties().size());
1023
1024         }
1025
1026         @Test(dataProvider = "propertiesListDefaultValueSuccessFlow")
1027         public void addListPropertyToResourceSuccessFlow(String entrySchemaType, String propertyDefaltValues,
1028                         String expecteddefaultValues) throws Exception {
1029                 String propertyType = "list";
1030                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
1031                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
1032                 propertyDetails.setPropertyDefaultValue(propertyDefaltValues);
1033                 // create resource
1034                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1035                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1036                                 .value();
1037                 // Add property type list to resource
1038                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
1039                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1040                 // verify properties return from response
1041                 assertEquals(propertyType, resourcePropertiesFromResponse.getType());
1042                 assertEquals(expecteddefaultValues, resourcePropertiesFromResponse.getDefaultValue());
1043                 assertEquals(entrySchemaType, resourcePropertiesFromResponse.getSchema().getProperty().getType()); // string/integer/boolean/float
1044                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
1045
1046                 assertEquals(resourcePropertiesFromResponse.getType(), propertyType);
1047                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), expecteddefaultValues);
1048                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(), entrySchemaType); // string/integer/boolean/float
1049                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
1050         }
1051
1052         // Delete property type list
1053         @Test
1054         public void deleteOneOfTheListPropertiesFromResourceAndAddItAgain() throws Exception {
1055                 ComponentInstanceProperty resourcePropertiesFromResponse;
1056                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1057                                 .getDefaultListProperty(PropertyTypeEnum.STRING_LIST);
1058                 PropertyReqDetails propertyDetailsInteger = ElementFactory
1059                                 .getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
1060                 // create resource
1061                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1062                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1063                                 .value();
1064                 // Add 2 property type list to resource
1065                 resourcePropertiesFromResponse = AtomicOperationUtils
1066                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1067                                 .value();
1068                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1069                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[\"a\",\"b\"]");
1070                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1071                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1072                 resourcePropertiesFromResponse = AtomicOperationUtils
1073                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1074                                 .value();
1075                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1076                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1077                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1,2]");
1078                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1079                                 propertyDetailsInteger.getSchema().getProperty().getType());
1080                 // Get resource and verify updated default value
1081                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1082                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1083                 assertEquals(2, resource.getProperties().size());
1084                 // Delete one resource
1085                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1086                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1087                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1088                 // Get resource and verify updated default value
1089                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1090                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1091                 assertEquals(1, resource.getProperties().size());
1092                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, "[\"a\",\"b\"]");
1093                 // Add deleted property again to resource
1094                 resourcePropertiesFromResponse = AtomicOperationUtils
1095                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1096                                 .value();
1097                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1098                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1,2]");
1099                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1100                                 propertyDetailsInteger.getSchema().getProperty().getType());
1101                 // Get resource and verify updated default value
1102                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1103                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1104                 assertEquals(2, resource.getProperties().size());
1105         }
1106
1107         @Test
1108         public void deletePropertyListTypeInteger() throws Exception {
1109                 ComponentInstanceProperty resourcePropertiesFromResponse;
1110                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1111                                 .getDefaultListProperty(PropertyTypeEnum.STRING_LIST);
1112                 PropertyReqDetails propertyDetailsInteger = ElementFactory
1113                                 .getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
1114                 // create resource
1115                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1116                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1117                                 .value();
1118                 // Add 2 property type list to resource
1119                 resourcePropertiesFromResponse = AtomicOperationUtils
1120                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1121                                 .value();
1122                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1123                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1124                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[\"a\",\"b\"]");
1125                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1126                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1127                 resourcePropertiesFromResponse = AtomicOperationUtils
1128                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1129                                 .value();
1130                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1131                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1,2]");
1132                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1133                                 propertyDetailsInteger.getSchema().getProperty().getType());
1134                 // Get resource and verify updated default value
1135                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1136                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1137                 assertEquals(2, resource.getProperties().size());
1138                 // Delete one resource
1139                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1140                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1141                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1142                 // Get resource and verify updated default value
1143                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1144                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1145                 assertEquals(1, resource.getProperties().size());
1146                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "[1,2]");
1147         }
1148
1149         @Test
1150         public void deletePropertyListTypeBoolean() throws Exception {
1151                 ComponentInstanceProperty resourcePropertiesFromResponse;
1152                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1153                                 .getDefaultListProperty(PropertyTypeEnum.BOOLEAN_LIST);
1154                 PropertyReqDetails propertyDetailsInteger = ElementFactory
1155                                 .getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
1156                 // create resource
1157                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1158                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1159                                 .value();
1160                 // Add 2 property type list to resource
1161                 resourcePropertiesFromResponse = AtomicOperationUtils
1162                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1163                                 .value();
1164                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1165                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1166                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[true,false]");
1167                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1168                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1169                 resourcePropertiesFromResponse = AtomicOperationUtils
1170                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1171                                 .value();
1172                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1173                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1,2]");
1174                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1175                                 propertyDetailsInteger.getSchema().getProperty().getType());
1176                 // Get resource and verify updated default value
1177                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1178                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1179                 assertEquals(2, resource.getProperties().size());
1180                 // Delete one property
1181                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1182                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1183                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1184                 // Get resource and verify updated default value
1185                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1186                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1187                 assertEquals(1, resource.getProperties().size());
1188                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "[1,2]");
1189         }
1190
1191         @Test
1192         public void deletePropertyListTypeFloat() throws Exception {
1193                 ComponentInstanceProperty resourcePropertiesFromResponse;
1194                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1195                                 .getDefaultListProperty(PropertyTypeEnum.FLOAT_LIST);
1196                 PropertyReqDetails propertyDetailsInteger = ElementFactory
1197                                 .getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
1198                 // create resource
1199                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1200                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1201                                 .value();
1202                 // Add 2 property type list to resource
1203                 resourcePropertiesFromResponse = AtomicOperationUtils
1204                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1205                                 .value();
1206                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1207                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1208                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1.0,2.0]");
1209                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1210                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1211                 resourcePropertiesFromResponse = AtomicOperationUtils
1212                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1213                                 .value();
1214                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1215                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1,2]");
1216                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1217                                 propertyDetailsInteger.getSchema().getProperty().getType());
1218                 // Get resource and verify updated default value
1219                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1220                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1221                 assertEquals(2, resource.getProperties().size());
1222                 // Delete one property
1223                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1224                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1225                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1226                 // Get resource and verify updated default value
1227                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1228                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1229                 assertEquals(1, resource.getProperties().size());
1230                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "[1,2]");
1231         }
1232
1233         @Test
1234         public void deletePropertyListAlreadyDeleted() throws Exception {
1235                 ComponentInstanceProperty resourcePropertiesFromResponse;
1236                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1237                                 .getDefaultListProperty(PropertyTypeEnum.FLOAT_LIST);
1238                 PropertyReqDetails propertyDetailsInteger = ElementFactory
1239                                 .getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
1240                 // create resource
1241                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1242                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1243                                 .value();
1244                 // Add 2 property type list to resource
1245                 resourcePropertiesFromResponse = AtomicOperationUtils
1246                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1247                                 .value();
1248                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1249                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1250                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1.0,2.0]");
1251                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1252                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1253                 resourcePropertiesFromResponse = AtomicOperationUtils
1254                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1255                                 .value();
1256                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1257                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), "[1,2]");
1258                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1259                                 propertyDetailsInteger.getSchema().getProperty().getType());
1260                 // Get resource and verify updated default value
1261                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1262                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1263                 assertEquals(2, resource.getProperties().size());
1264                 // Delete one property
1265                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1266                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1267                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1268                 // Get resource and verify updated default value
1269                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1270                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1271                 assertEquals(1, resource.getProperties().size());
1272                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "[1,2]");
1273                 // delete again the same property
1274                 deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1275                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1276                 assertTrue(BaseRestUtils.STATUS_CODE_NOT_FOUND == deletePropertyOfResource.getErrorCode());
1277                 ArrayList<String> variables = new ArrayList<>();
1278                 variables.add("");
1279                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PROPERTY_NOT_FOUND.name(), variables,
1280                                 deletePropertyOfResource.getResponse());
1281         }
1282
1283         @Test
1284         public void deletePropertyListResourceIsNotCheckedOutState() throws Exception {
1285                 ComponentInstanceProperty resourcePropertiesFromResponse;
1286                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1287                                 .getDefaultListProperty(PropertyTypeEnum.FLOAT_LIST);
1288                 String expectedDefaultvalues = "[1.0,2.0]";
1289                 // create resource
1290                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1291                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1292                                 .value();
1293                 // Add property type list to resource
1294                 resourcePropertiesFromResponse = AtomicOperationUtils
1295                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1296                                 .value();
1297                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1298                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1299                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), expectedDefaultvalues);
1300                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1301                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1302                 // Get resource and verify updated default value
1303                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, expectedDefaultvalues);
1304                 // Check-in resource
1305                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true);
1306                 // Delete property
1307                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1308                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1309                 assertTrue(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION == deletePropertyOfResource.getErrorCode());
1310                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
1311                                 deletePropertyOfResource.getResponse());
1312                 // Get resource and verify property is not deleted
1313                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, expectedDefaultvalues);
1314         }
1315
1316         @Test
1317         public void deletePropertyListResourceByNotIsNonResouceOwner() throws Exception {
1318                 ComponentInstanceProperty resourcePropertiesFromResponse;
1319                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1320                                 .getDefaultListProperty(PropertyTypeEnum.FLOAT_LIST);
1321                 String expectedDefaultvalues = "[1.0,2.0]";
1322                 // create resource
1323                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1324                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1325                                 .value();
1326                 // Add property type list to resource
1327                 resourcePropertiesFromResponse = AtomicOperationUtils
1328                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1329                                 .value();
1330                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1331                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1332                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), expectedDefaultvalues);
1333                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1334                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1335                 // Get resource and verify updated default value
1336                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, expectedDefaultvalues);
1337                 // Delete property by non resource owner
1338                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1339                                 propertyUniqueId, UserRoleEnum.DESIGNER2);
1340                 assertTrue(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION == deletePropertyOfResource.getErrorCode());
1341                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
1342                                 deletePropertyOfResource.getResponse());
1343                 // Get resource and verify property is not deleted
1344                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, expectedDefaultvalues);
1345         }
1346
1347         @Test
1348         public void deletePropertyListFromNonExistingResource() throws Exception {
1349                 ComponentInstanceProperty resourcePropertiesFromResponse;
1350                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1351                                 .getDefaultListProperty(PropertyTypeEnum.FLOAT_LIST);
1352                 String expectedDefaultvalues = "[1.0,2.0]";
1353                 // create resource
1354                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1355                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1356                                 .value();
1357                 String actualResourceUniqueId = basicVFC.getUniqueId();
1358                 // Add property type list to resource
1359                 resourcePropertiesFromResponse = AtomicOperationUtils
1360                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1361                                 .value();
1362                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1363                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1364                 assertEquals(resourcePropertiesFromResponse.getDefaultValue(), expectedDefaultvalues);
1365                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1366                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1367                 // Get resource and verify updated default value
1368                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, expectedDefaultvalues);
1369                 // Delete property from non existing resource
1370                 basicVFC.setUniqueId("1111111");
1371                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1372                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1373                 assertTrue(deletePropertyOfResource.getErrorCode().equals(BaseRestUtils.STATUS_CODE_NOT_FOUND));
1374                 ArrayList<String> variables = new ArrayList<>();
1375                 variables.add("");
1376                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), variables,
1377                                 deletePropertyOfResource.getResponse());
1378                 // Get resource and verify property is not deleted
1379                 basicVFC.setUniqueId(actualResourceUniqueId);
1380                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, expectedDefaultvalues);
1381         }
1382
1383         @Test
1384         public void deletePropertyOfDerivedResource() throws Exception {
1385                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty(PropertyTypeEnum.STRING_LIST);
1386                 // create resource
1387                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1388                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1389                                 .value();
1390                 // Add property type list to resource
1391                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
1392                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1393                 String derivedResourcePropertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1394                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1395                 // second resource derived from basicVFC
1396                 Resource vfc1FromBasicVFC = AtomicOperationUtils
1397                                 .createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, basicVFC,
1398                                                 ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true)
1399                                 .left().value();
1400                 // Delete property (list) of derived resource
1401                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(
1402                                 vfc1FromBasicVFC.getUniqueId(), derivedResourcePropertyUniqueId, UserRoleEnum.DESIGNER);
1403                 assertTrue(deletePropertyOfResource.getErrorCode().equals(BaseRestUtils.STATUS_CODE_NOT_FOUND));
1404                 ArrayList<String> variables = new ArrayList<>();
1405                 variables.add("");
1406                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PROPERTY_NOT_FOUND.name(), variables,
1407                                 deletePropertyOfResource.getResponse());
1408                 // Verify resource's priority list did not changed
1409                 verifyResourcePropertyList(vfc1FromBasicVFC, propertyDetails, "[\"a\",\"b\"]");
1410         }
1411
1412         @Test
1413         public void deletePropertyOfNonDerivedResource() throws Exception {
1414                 PropertyReqDetails propertyListString = ElementFactory.getDefaultListProperty(PropertyTypeEnum.STRING_LIST);
1415                 // create resource
1416                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1417                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1418                                 .value();
1419                 // Add property type list to resource
1420                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
1421                                 .addCustomPropertyToResource(propertyListString, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1422                 AtomicOperationUtils.changeComponentState(basicVFC, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
1423                 // second resource derived from basicVFC
1424                 Resource vfc1FromBasicVFC = AtomicOperationUtils
1425                                 .createResourcesByCustomNormativeTypeAndCatregory(ResourceTypeEnum.VFC, basicVFC,
1426                                                 ResourceCategoryEnum.APPLICATION_L4_BORDER, UserRoleEnum.DESIGNER, true)
1427                                 .left().value();
1428                 // add property Type list to second resource
1429                 PropertyReqDetails propertyListInteger = ElementFactory.getDefaultListProperty(PropertyTypeEnum.INTEGER_LIST);
1430                 resourcePropertiesFromResponse = AtomicOperationUtils
1431                                 .addCustomPropertyToResource(propertyListInteger, vfc1FromBasicVFC, UserRoleEnum.DESIGNER, true).left()
1432                                 .value();
1433                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1434                 // Delete property (list) of derived resource
1435                 RestResponse deletePropertyOfResource = AtomicOperationUtils
1436                                 .deletePropertyOfResource(vfc1FromBasicVFC.getUniqueId(), propertyUniqueId, UserRoleEnum.DESIGNER);
1437                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1438                 // Get resource and verify updated default value
1439                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1440                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1441                 assertEquals(1, resource.getProperties().size());
1442                 verifyResourcePropertyList(basicVFC, propertyListString, "[\"a\",\"b\"]");
1443         }
1444
1445         private void verifyResourcePropertyList(Resource resource, PropertyReqDetails expectedProperty,
1446                         String expecteddefaultValues) throws Exception {
1447                 // get resource and verify property from type list
1448                 Resource getResource = AtomicOperationUtils.getResourceObject(resource, UserRoleEnum.DESIGNER);
1449                 List<PropertyDefinition> actualResourceProperties = getResource.getProperties();
1450                 boolean isPropertyAppear = false;
1451                 for (PropertyDefinition pro : actualResourceProperties) {
1452                         if (expectedProperty.getName().equals(pro.getName())) {
1453                                 assertTrue("Check Property Type ", pro.getType().equals(expectedProperty.getPropertyType()));
1454                                 assertEquals("Check Property  default values ", expecteddefaultValues, pro.getDefaultValue());
1455                                 // assertTrue("Check Property default values ",
1456                                 // pro.getDefaultValue().equals(expecteddefaultValues));
1457                                 assertTrue("Check entrySchema Property Type ", pro.getSchema().getProperty().getType()
1458                                                 .equals(expectedProperty.getSchema().getProperty().getType()));
1459                                 isPropertyAppear = true;
1460                         }
1461                 }
1462                 assertTrue(isPropertyAppear);
1463         }
1464
1465         // US656905
1466         // --------------------- Map Property
1467         // ----------------------------------------------------------------
1468         @Test(dataProvider = "updatePropertiesMapDefaultValueFailureFlow")
1469         public void updateDefaultValueOfResourcePropertyMapFailureFlow(String entrySchemaType, String propertyDefaultValues,
1470                         String expectedDefaultValue, String newEntrySchemaType, String newPropertyDefaultValue) throws Exception {
1471                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultMapProperty();
1472                 propertyDetails.setPropertyDefaultValue(propertyDefaultValues);
1473                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
1474                 // create resource
1475                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1476                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1477                                 .value();
1478                 // Add property type list to resource
1479                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
1480                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1481                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1482                 // verify properties return from response
1483                 assertEquals("map", resourcePropertiesFromResponse.getType());
1484                 assertEquals(expectedDefaultValue, resourcePropertiesFromResponse.getDefaultValue());
1485                 assertEquals(propertyDetails.getSchema().getProperty().getType(),
1486                                 resourcePropertiesFromResponse.getSchema().getProperty().getType()); // string/integer/boolean/float
1487                 verifyResourcePropertyList(basicVFC, propertyDetails, expectedDefaultValue);
1488                 // Update resource property type = "map"
1489                 propertyDetails.setPropertyDefaultValue(newPropertyDefaultValue);
1490                 propertyDetails.getSchema().getProperty().setType(newEntrySchemaType);
1491                 RestResponse updatePropertyResponse = AtomicOperationUtils
1492                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, false)
1493                                 .right().value();
1494                 assertTrue(updatePropertyResponse.getErrorCode().equals(STATUS_CODE_INVALID_CONTENT));
1495                 ArrayList<String> variables = new ArrayList<>();
1496                 variables.add(propertyDetails.getName());
1497                 variables.add(propertyDetails.getPropertyType());
1498                 variables.add(propertyDetails.getSchema().getProperty().getType());
1499                 variables.add(newPropertyDefaultValue);
1500                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.INVALID_COMPLEX_DEFAULT_VALUE.name(), variables,
1501                                 updatePropertyResponse.getResponse());
1502         }
1503
1504         @Test(dataProvider = "updatePropertiesMapDefaultValueSuccessFlow")
1505         public void updateResourcePropertyMapSuccessFlow(String entrySchemaType, String propertyDefaultValues,
1506                         String expectedDefaultValue, String newEntrySchemaType, String newPropertyDefaultValue,
1507                         String newExpectedDefaultValue) throws Exception {
1508                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultMapProperty();
1509                 propertyDetails.setPropertyDefaultValue(propertyDefaultValues);
1510                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
1511                 // create resource
1512                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1513                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1514                                 .value();
1515                 // Add property type list to resource
1516                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
1517                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1518                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1519                 // verify properties return from response
1520                 assertEquals("map", resourcePropertiesFromResponse.getType());
1521                 assertEquals(expectedDefaultValue, resourcePropertiesFromResponse.getDefaultValue());
1522                 assertEquals(propertyDetails.getSchema().getProperty().getType(),
1523                                 resourcePropertiesFromResponse.getSchema().getProperty().getType()); // string/integer/boolean/float
1524                 verifyResourcePropertyList(basicVFC, propertyDetails, expectedDefaultValue);
1525                 // Update resource property type = "map"
1526                 propertyDetails.setPropertyDefaultValue(newPropertyDefaultValue);
1527                 propertyDetails.getSchema().getProperty().setType(newEntrySchemaType);
1528                 ComponentInstanceProperty resourcePropertyAfterUpdate = AtomicOperationUtils
1529                                 .updatePropertyOfResource(propertyDetails, basicVFC, propertyUniqueId, UserRoleEnum.DESIGNER, true)
1530                                 .left().value();
1531                 assertEquals("map", resourcePropertyAfterUpdate.getType());
1532                 assertEquals(newExpectedDefaultValue, resourcePropertyAfterUpdate.getDefaultValue());
1533                 assertEquals(propertyDetails.getSchema().getProperty().getType(),
1534                                 resourcePropertyAfterUpdate.getSchema().getProperty().getType()); // string/integer/boolean/float
1535                 verifyResourcePropertyList(basicVFC, propertyDetails, newExpectedDefaultValue);
1536         }
1537
1538         @Test
1539         public void deletePropertyMapTypeString() throws Exception {
1540                 ComponentInstanceProperty resourcePropertiesFromResponse;
1541                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1542                                 .getDefaultMapProperty(PropertyTypeEnum.STRING_MAP);
1543                 PropertyReqDetails propertyDetailsInteger = ElementFactory.getDefaultMapProperty(PropertyTypeEnum.INTEGER_MAP);
1544                 // create resource
1545                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1546                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1547                                 .value();
1548                 // Add 2 property type list to resource
1549                 resourcePropertiesFromResponse = AtomicOperationUtils
1550                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1551                                 .value();
1552                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1553                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1554                 assertEquals("{\"key1\":\"val1\",\"key2\":\"val2\"}", resourcePropertiesFromResponse.getDefaultValue());
1555                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1556                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1557                 resourcePropertiesFromResponse = AtomicOperationUtils
1558                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1559                                 .value();
1560                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1561                 assertEquals("{\"key1\":123,\"key2\":-456}", resourcePropertiesFromResponse.getDefaultValue());
1562                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1563                                 propertyDetailsInteger.getSchema().getProperty().getType());
1564                 // Get resource and verify updated default value
1565                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1566                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1567                 assertEquals(2, resource.getProperties().size());
1568                 // Delete one resource
1569                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1570                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1571                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1572                 // Get resource and verify updated default value
1573                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1574                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1575                 assertEquals(1, resource.getProperties().size());
1576                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "{\"key1\":123,\"key2\":-456}");
1577         }
1578
1579         @Test
1580         public void deletePropertyMapTypeFloat() throws Exception {
1581                 ComponentInstanceProperty resourcePropertiesFromResponse;
1582                 PropertyReqDetails propertyDetailsTypeFloat = ElementFactory.getDefaultMapProperty(PropertyTypeEnum.FLOAT_MAP);
1583                 PropertyReqDetails propertyDetailsInteger = ElementFactory.getDefaultMapProperty(PropertyTypeEnum.INTEGER_MAP);
1584                 // create resource
1585                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1586                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1587                                 .value();
1588                 // Add 2 property type list to resource
1589                 resourcePropertiesFromResponse = AtomicOperationUtils
1590                                 .addCustomPropertyToResource(propertyDetailsTypeFloat, basicVFC, UserRoleEnum.DESIGNER, true).left()
1591                                 .value();
1592                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1593                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeFloat.getPropertyType());
1594                 assertEquals("{\"key1\":0.2123,\"key2\":43.545}", resourcePropertiesFromResponse.getDefaultValue());
1595                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1596                                 propertyDetailsTypeFloat.getSchema().getProperty().getType()); // string/integer/boolean/float
1597                 resourcePropertiesFromResponse = AtomicOperationUtils
1598                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1599                                 .value();
1600                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1601                 assertEquals("{\"key1\":123,\"key2\":-456}", resourcePropertiesFromResponse.getDefaultValue());
1602                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1603                                 propertyDetailsInteger.getSchema().getProperty().getType());
1604                 // Get resource and verify updated default value
1605                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1606                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1607                 assertEquals(2, resource.getProperties().size());
1608                 // Delete one resource
1609                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1610                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1611                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1612                 // Get resource and verify updated default value
1613                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1614                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1615                 assertEquals(1, resource.getProperties().size());
1616                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "{\"key1\":123,\"key2\":-456}");
1617         }
1618
1619         @Test
1620         public void deletePropertyMapTypeBoolean() throws Exception {
1621                 ComponentInstanceProperty resourcePropertiesFromResponse;
1622                 PropertyReqDetails propertyDetailsTypeBoolean = ElementFactory
1623                                 .getDefaultMapProperty(PropertyTypeEnum.BOOLEAN_MAP);
1624                 PropertyReqDetails propertyDetailsInteger = ElementFactory.getDefaultMapProperty(PropertyTypeEnum.INTEGER_MAP);
1625                 // create resource
1626                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1627                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1628                                 .value();
1629                 // Add 2 property type list to resource
1630                 resourcePropertiesFromResponse = AtomicOperationUtils
1631                                 .addCustomPropertyToResource(propertyDetailsTypeBoolean, basicVFC, UserRoleEnum.DESIGNER, true).left()
1632                                 .value();
1633                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1634                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeBoolean.getPropertyType());
1635                 assertEquals("{\"key1\":true,\"key2\":false}", resourcePropertiesFromResponse.getDefaultValue());
1636                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1637                                 propertyDetailsTypeBoolean.getSchema().getProperty().getType()); // string/integer/boolean/float
1638                 resourcePropertiesFromResponse = AtomicOperationUtils
1639                                 .addCustomPropertyToResource(propertyDetailsInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1640                                 .value();
1641                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsInteger.getPropertyType());
1642                 assertEquals("{\"key1\":123,\"key2\":-456}", resourcePropertiesFromResponse.getDefaultValue());
1643                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1644                                 propertyDetailsInteger.getSchema().getProperty().getType());
1645                 // Get resource and verify updated default value
1646                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1647                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1648                 assertEquals(2, resource.getProperties().size());
1649                 // Delete one resource
1650                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1651                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1652                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1653                 // Get resource and verify updated default value
1654                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1655                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1656                 assertEquals(1, resource.getProperties().size());
1657                 verifyResourcePropertyList(basicVFC, propertyDetailsInteger, "{\"key1\":123,\"key2\":-456}");
1658         }
1659
1660         @Test
1661         public void deletePropertyMapTypeInteger() throws Exception {
1662                 ComponentInstanceProperty resourcePropertiesFromResponse;
1663                 PropertyReqDetails propertyDetailsTypeInteger = ElementFactory
1664                                 .getDefaultMapProperty(PropertyTypeEnum.INTEGER_MAP);
1665                 PropertyReqDetails propertyDetailsBoolean = ElementFactory.getDefaultMapProperty(PropertyTypeEnum.BOOLEAN_MAP);
1666                 // create resource
1667                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1668                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1669                                 .value();
1670                 // Add 2 property type list to resource
1671                 resourcePropertiesFromResponse = AtomicOperationUtils
1672                                 .addCustomPropertyToResource(propertyDetailsTypeInteger, basicVFC, UserRoleEnum.DESIGNER, true).left()
1673                                 .value();
1674                 String propertyUniqueId = resourcePropertiesFromResponse.getUniqueId();
1675                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeInteger.getPropertyType());
1676                 assertEquals("{\"key1\":123,\"key2\":-456}", resourcePropertiesFromResponse.getDefaultValue());
1677                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1678                                 propertyDetailsTypeInteger.getSchema().getProperty().getType()); // string/integer/boolean/float
1679                 resourcePropertiesFromResponse = AtomicOperationUtils
1680                                 .addCustomPropertyToResource(propertyDetailsBoolean, basicVFC, UserRoleEnum.DESIGNER, true).left()
1681                                 .value();
1682                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsBoolean.getPropertyType());
1683                 assertEquals("{\"key1\":true,\"key2\":false}", resourcePropertiesFromResponse.getDefaultValue());
1684                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1685                                 propertyDetailsBoolean.getSchema().getProperty().getType());
1686                 // Get resource and verify updated default value
1687                 RestResponse restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1688                 Resource resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1689                 assertEquals(2, resource.getProperties().size());
1690                 // Delete one resource
1691                 RestResponse deletePropertyOfResource = AtomicOperationUtils.deletePropertyOfResource(basicVFC.getUniqueId(),
1692                                 propertyUniqueId, UserRoleEnum.DESIGNER);
1693                 assertTrue(BaseRestUtils.STATUS_CODE_DELETE == deletePropertyOfResource.getErrorCode());
1694                 // Get resource and verify updated default value
1695                 restResponse = ResourceRestUtils.getResource(basicVFC.getUniqueId());
1696                 resource = ResponseParser.convertResourceResponseToJavaObject(restResponse.getResponse());
1697                 assertEquals(1, resource.getProperties().size());
1698                 verifyResourcePropertyList(basicVFC, propertyDetailsBoolean, "{\"key1\":true,\"key2\":false}");
1699         }
1700
1701         @Test(dataProvider = "propertiesMapDefaultValueSuccessFlow")
1702         public void addMapPropertyToResourceSuccessFlow(String entrySchemaType, String propertyDefaltValues,
1703                         String expecteddefaultValues) throws Exception {
1704                 String propertyType = "map";
1705                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultMapProperty();
1706                 propertyDetails.getSchema().getProperty().setType(entrySchemaType);
1707                 propertyDetails.setPropertyDefaultValue(propertyDefaltValues);
1708                 // create resource
1709                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1710                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1711                                 .value();
1712                 // Add property type list to resource
1713                 ComponentInstanceProperty resourcePropertiesFromResponse = AtomicOperationUtils
1714                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, true).left().value();
1715                 // verify properties return from response
1716                 assertEquals(propertyType, resourcePropertiesFromResponse.getType());
1717                 assertEquals(expecteddefaultValues, resourcePropertiesFromResponse.getDefaultValue());
1718                 assertEquals(entrySchemaType, resourcePropertiesFromResponse.getSchema().getProperty().getType()); // string/integer/boolean/float
1719                 verifyResourcePropertyList(basicVFC, propertyDetails, expecteddefaultValues);
1720         }
1721
1722         @Test
1723         public void addMapPropertyToNonExistingResource() throws Exception {
1724                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
1725                 propertyDetails.getSchema().getProperty().setType("integer");
1726                 propertyDetails.setPropertyDefaultValue("{\"key1\":1 , \"key2\":2}");
1727                 // create resource
1728                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1729                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1730                                 .value();
1731                 // Add property type list to non existing resource
1732                 basicVFC.setUniqueId("1111111");
1733                 RestResponse addPropertyToResourceResponse = AtomicOperationUtils
1734                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER, false).right().value();
1735                 assertTrue(addPropertyToResourceResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_NOT_FOUND));
1736                 ArrayList<String> variables = new ArrayList<>();
1737                 variables.add("");
1738                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESOURCE_NOT_FOUND.name(), variables,
1739                                 addPropertyToResourceResponse.getResponse());
1740         }
1741
1742         @Test
1743         public void addMaptPropertyToResourceByNonResourceOwner() throws Exception {
1744                 PropertyReqDetails propertyDetails = ElementFactory.getDefaultListProperty();
1745                 propertyDetails.getSchema().getProperty().setType("integer");
1746                 propertyDetails.setPropertyDefaultValue("{\"key1\":1 , \"key2\":2}");
1747                 // create resource
1748                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1749                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1750                                 .value();
1751                 // Add property type list to non Checked-Out resource
1752                 RestResponse addPropertyToResourceResponse = AtomicOperationUtils
1753                                 .addCustomPropertyToResource(propertyDetails, basicVFC, UserRoleEnum.DESIGNER2, false).right().value();
1754                 assertTrue(addPropertyToResourceResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION));
1755                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
1756                                 addPropertyToResourceResponse.getResponse());
1757         }
1758
1759         @Test
1760         public void addMapPropertyToResourcePropertyAlreadyExists() throws Exception {
1761                 ComponentInstanceProperty resourcePropertiesFromResponse;
1762                 PropertyReqDetails propertyDetailsTypeString = ElementFactory
1763                                 .getDefaultListProperty(PropertyTypeEnum.STRING_MAP);
1764                 // create resource
1765                 Resource basicVFC = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC,
1766                                 NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_ABSTRACT, UserRoleEnum.DESIGNER, true).left()
1767                                 .value();
1768                 // Add 2 property type list to resource
1769                 resourcePropertiesFromResponse = AtomicOperationUtils
1770                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, true).left()
1771                                 .value();
1772                 assertEquals(resourcePropertiesFromResponse.getType(), propertyDetailsTypeString.getPropertyType());
1773                 assertEquals("{\"key1\":\"val1\",\"key2\":\"val2\"}", resourcePropertiesFromResponse.getDefaultValue());
1774                 assertEquals(resourcePropertiesFromResponse.getSchema().getProperty().getType(),
1775                                 propertyDetailsTypeString.getSchema().getProperty().getType()); // string/integer/boolean/float
1776                 // check-in and check-out resource
1777                 RestResponse changeComponentState = LifecycleRestUtils.changeComponentState(basicVFC,
1778                                 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKIN);
1779                 assertTrue(changeComponentState.getErrorCode().equals(BaseRestUtils.STATUS_CODE_SUCCESS));
1780                 changeComponentState = LifecycleRestUtils.changeComponentState(basicVFC,
1781                                 ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), LifeCycleStatesEnum.CHECKOUT);
1782                 assertTrue(changeComponentState.getErrorCode().equals(BaseRestUtils.STATUS_CODE_SUCCESS));
1783                 // Add same property again to resource
1784                 RestResponse addPropertyRestResponse = AtomicOperationUtils
1785                                 .addCustomPropertyToResource(propertyDetailsTypeString, basicVFC, UserRoleEnum.DESIGNER, false).right()
1786                                 .value();
1787                 assertTrue(addPropertyRestResponse.getErrorCode().equals(BaseRestUtils.STATUS_CODE_ALREADY_EXISTS));
1788                 ArrayList<String> variables = new ArrayList<>();
1789                 variables.add("");
1790                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.PROPERTY_ALREADY_EXIST.name(), variables,
1791                                 addPropertyRestResponse.getResponse());
1792                 // verify property not deleted
1793                 verifyResourcePropertyList(basicVFC, propertyDetailsTypeString, "{\"key1\":\"val1\",\"key2\":\"val2\"}");
1794         }
1795
1796 }