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