Fix for radio buttons
[sdc.git] / asdc-tests / src / main / java / org / openecomp / sdc / ci / tests / execute / category / CategoriesTests.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.category;
22
23 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.PRODUCT_COMPONENT_TYPE;
24 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.RESOURCE_COMPONENT_TYPE;
25 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.SERVICE_COMPONENT_TYPE;
26 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_ALREADY_EXISTS;
27 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_CREATED;
28 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_INVALID_CONTENT;
29 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_MISSING_INFORMATION;
30 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RESTRICTED_OPERATION;
31 import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS;
32 import static org.testng.AssertJUnit.assertEquals;
33 import static org.testng.AssertJUnit.assertTrue;
34
35 import java.io.File;
36 import java.util.ArrayList;
37 import java.util.Arrays;
38 import java.util.HashMap;
39 import java.util.List;
40 import java.util.Map;
41
42 import org.apache.commons.lang3.text.WordUtils;
43 import org.apache.http.entity.mime.MultipartEntityBuilder;
44 import org.apache.http.entity.mime.content.FileBody;
45 import org.json.JSONArray;
46 import org.junit.Rule;
47 import org.junit.rules.TestName;
48 import org.openecomp.sdc.be.dao.api.ActionStatus;
49 import org.openecomp.sdc.be.model.User;
50 import org.openecomp.sdc.be.model.category.CategoryDefinition;
51 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
52 import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
53 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
54 import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit;
55 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
56 import org.openecomp.sdc.ci.tests.utils.DbUtils;
57 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
58 import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
59 import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
60 import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
61 import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
62 import org.openecomp.sdc.ci.tests.utils.validation.CategoryValidationUtils;
63 import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
64 import org.testng.annotations.BeforeMethod;
65 import org.testng.annotations.Test;
66
67 public class CategoriesTests extends CategoriesBaseTest {
68
69         private static final String GET_CATEGORY_HIERARCHY = "GetCategoryHierarchy";
70         protected static final String ADD_CATEGORY = "AddCategory";
71         protected static final String DELETE_CATEGORY = "DeleteCategory";
72
73         public CategoriesTests() {
74                 super(name, CategoriesTests.class.getName());
75         }
76
77         @Rule
78         public static TestName name = new TestName();
79         private CategoryDefinition categoryDefinition;
80         private List<CategoryDefinition> categoryList;
81         private List<SubCategoryDefinition> subCategoryList;
82         private Map<String, List<String>> subCategoriesToDeleteMap;
83
84         @BeforeMethod
85         public void init() throws Exception {
86                 subCategoriesToDeleteMap = new HashMap<String, List<String>>();
87                 DbUtils.deleteFromEsDbByPattern("_all");
88
89                 categoryDefinition = new CategoryDefinition();
90                 categoryDefinition.setName("Abcd");
91                 categoryList = defineCategories();
92                 subCategoryList = defineSubCategories(categoryList.size());
93         }
94
95         // pass
96         @Test
97         public void createServiceCategorySuccessFlow() throws Exception {
98                 // Add New category
99                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
100                                 SERVICE_COMPONENT_TYPE);
101                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
102                                 createCategotyRest.getErrorCode().intValue());
103                 categoryDefinition.setNormalizedName("abcd");
104                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
105                 // Audit validation
106                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
107                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
108                 // get service category and validate that category added as defined
109                 // (also set catalog uniqeId)
110                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
111                                 SERVICE_COMPONENT_TYPE);
112                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
113                                 getAllCategoriesRest.getErrorCode().intValue());
114                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition); // also
115                                                                                                                                                                                                                         // set
116                                                                                                                                                                                                                         // catalog
117                                                                                                                                                                                                                         // uniqeId
118
119         }
120
121         // pass
122         @Test
123         public void createResourceCategorySuccessFlow() throws Exception {
124                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
125                                 RESOURCE_COMPONENT_TYPE);
126                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
127                                 createCategotyRest.getErrorCode().intValue());
128                 categoryDefinition.setNormalizedName("abcd");
129                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
130                 // Get Category
131                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
132                                 RESOURCE_COMPONENT_TYPE);
133                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
134                                 getAllCategoriesRest.getErrorCode().intValue());
135                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
136                 // Audit validation
137                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
138                                 STATUS_CODE_CREATED, AUDIT_RESOURCE_TYPE);
139         }
140
141         // pass
142         @Test
143         public void createProductCategorySuccessFlow() throws Exception {
144                 // Add Category by Product-strategist
145                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition,
146                                 sdncProductStrategistUserDetails, PRODUCT_COMPONENT_TYPE);
147                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
148                                 createCategotyRest.getErrorCode().intValue());
149                 categoryDefinition.setNormalizedName("abcd");
150                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
151
152                 // Get Category
153                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
154                                 PRODUCT_COMPONENT_TYPE);
155                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
156                                 getAllCategoriesRest.getErrorCode().intValue());
157                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
158                 // Audit validation
159                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncProductStrategistUserDetails,
160                                 STATUS_CODE_CREATED, AUDIT_PRODUCT_TYPE);
161         }
162
163         @Test
164         public void CategoryNameValidation_FirstWordStartWithAlphaNumeric_01() throws Exception { // category
165                                                                                                                                                                                                 // for
166                                                                                                                                                                                                 // service
167                 categoryDefinition.setName("Category14AadE  &&&---+++.'''###=:@@@____");
168                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
169                                 SERVICE_COMPONENT_TYPE);
170                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
171                                 createCategotyRest.getErrorCode().intValue());
172                 categoryDefinition.setName("Category14AadE &-+.'#=:@_");
173                 categoryDefinition.setNormalizedName("category14aade &-+.'#=:@_");
174                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
175                 // Get service category and validate that category added as defined
176                 // (also set catalog uniqeId)
177                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
178                                 SERVICE_COMPONENT_TYPE);
179                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
180                                 getAllCategoriesRest.getErrorCode().intValue());
181                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
182                 // Audit validation
183                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
184                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
185         }
186
187         @Test
188         public void categoryNameValidation_FirstWordStartWithAlphaNumeric_02() throws Exception { // category
189                                                                                                                                                                                                 // for
190                                                                                                                                                                                                 // resource
191                 categoryDefinition.setName("Category14AadE  &&&---+++.'''###=:@@@____");
192                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
193                                 RESOURCE_COMPONENT_TYPE);
194                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
195                                 createCategotyRest.getErrorCode().intValue());
196                 categoryDefinition.setName("Category14AadE &-+.'#=:@_");
197                 categoryDefinition.setNormalizedName("category14aade &-+.'#=:@_");
198                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
199                 // Get service category and validate that category added as defined
200                 // (also set catalog uniqeId)
201                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
202                                 RESOURCE_COMPONENT_TYPE);
203                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
204                                 getAllCategoriesRest.getErrorCode().intValue());
205                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
206                 // Audit validation
207                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
208                                 STATUS_CODE_CREATED, AUDIT_RESOURCE_TYPE);
209         }
210
211         @Test
212         public void categoryNameValidation_FirstWordStartWithAlphaNumeric_03() throws Exception { // category
213                                                                                                                                                                                                 // for
214                                                                                                                                                                                                 // resource
215                 categoryDefinition.setName("Category14AadE  &&&---+++.'''###=:@@@____");
216                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition,
217                                 sdncProductStrategistUserDetails, PRODUCT_COMPONENT_TYPE);
218                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
219                                 createCategotyRest.getErrorCode().intValue());
220                 categoryDefinition.setName("Category14AadE &-+.'#=:@_");
221                 categoryDefinition.setNormalizedName("category14aade &-+.'#=:@_");
222                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
223                 // Get service category and validate that category added as defined
224                 // (also set catalog uniqeId)
225                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
226                                 PRODUCT_COMPONENT_TYPE);
227                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
228                                 getAllCategoriesRest.getErrorCode().intValue());
229                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
230                 // Audit validation
231                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncProductStrategistUserDetails,
232                                 STATUS_CODE_CREATED, AUDIT_PRODUCT_TYPE);
233         }
234
235         // pass
236         @Test
237         public void createServiceCategoryByNonAdminUser() throws Exception {
238                 // Add New category
239                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition,
240                                 sdncProductStrategistUserDetails, SERVICE_COMPONENT_TYPE);
241                 assertEquals("Check response code after create Category", STATUS_CODE_RESTRICTED_OPERATION,
242                                 createCategotyRest.getErrorCode().intValue());
243                 // get service category and validate that category was not added
244                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
245                                 SERVICE_COMPONENT_TYPE);
246                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
247                                 getAllCategoriesRest.getErrorCode().intValue());
248                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
249                 // Audit validation
250                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncProductStrategistUserDetails,
251                                 ActionStatus.RESTRICTED_OPERATION, STATUS_CODE_RESTRICTED_OPERATION, AUDIT_SERVICE_TYPE);
252         }
253
254         // pass
255         @Test
256         public void createResourceCategoryByNonAdminUser() throws Exception {
257                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition,
258                                 sdncProductStrategistUserDetails, RESOURCE_COMPONENT_TYPE);
259                 assertEquals("Check response code after create Category", STATUS_CODE_RESTRICTED_OPERATION,
260                                 createCategotyRest.getErrorCode().intValue());
261                 // get service category and validate that category was not added
262                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
263                                 RESOURCE_COMPONENT_TYPE);
264                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
265                                 getAllCategoriesRest.getErrorCode().intValue());
266                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
267                 // Audit validation
268                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncProductStrategistUserDetails,
269                                 ActionStatus.RESTRICTED_OPERATION, STATUS_CODE_RESTRICTED_OPERATION, AUDIT_RESOURCE_TYPE);
270         }
271
272         // pass
273         @Test
274         public void createProductCategoryByNonProductStrategistUser() throws Exception {
275                 // Add New product category not by Product-Strategist
276                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
277                                 PRODUCT_COMPONENT_TYPE);
278                 assertEquals("Check response code after create Category", STATUS_CODE_RESTRICTED_OPERATION,
279                                 createCategotyRest.getErrorCode().intValue());
280                 // get service category and validate that category was not added
281                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
282                                 PRODUCT_COMPONENT_TYPE);
283                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
284                                 getAllCategoriesRest.getErrorCode().intValue());
285                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
286                 // Audit validation
287                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
288                                 ActionStatus.RESTRICTED_OPERATION, STATUS_CODE_RESTRICTED_OPERATION, AUDIT_PRODUCT_TYPE);
289
290         }
291
292         // pass
293         @Test
294         public void addCategoryByNonExistingUser() throws Exception {
295                 User sdncAdminUserDetailsNonExisting = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
296                 sdncAdminUserDetailsNonExisting.setUserId("bt555h");
297                 // Add New category
298                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition,
299                                 sdncAdminUserDetailsNonExisting, SERVICE_COMPONENT_TYPE);
300                 assertEquals("Check response code after create Category", STATUS_CODE_RESTRICTED_OPERATION,
301                                 createCategotyRest.getErrorCode().intValue());
302                 // get service category and validate that category was not added
303                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
304                                 SERVICE_COMPONENT_TYPE);
305                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
306                                 getAllCategoriesRest.getErrorCode().intValue());
307                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
308                 // Audit validation
309                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
310                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
311                 expectedCatrgoryAuditJavaObject.setAction(ADD_CATEGORY);
312                 expectedCatrgoryAuditJavaObject.setModifier("(" + sdncAdminUserDetailsNonExisting.getUserId() + ")");
313                 expectedCatrgoryAuditJavaObject.setCategoryName(categoryDefinition.getName());
314                 expectedCatrgoryAuditJavaObject.setSubCategoryName("");
315                 expectedCatrgoryAuditJavaObject.setGroupingName("");
316                 expectedCatrgoryAuditJavaObject.setResourceType(AUDIT_SERVICE_TYPE);
317                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_RESTRICTED_OPERATION));
318                 expectedCatrgoryAuditJavaObject.setDesc(errorInfo.getAuditDesc());
319                 AuditValidationUtils.validateCategoryAudit(expectedCatrgoryAuditJavaObject, ADD_CATEGORY);
320         }
321
322         @Test
323         public void addServiceCategoryAllowedcharacters_01() throws Exception {
324                 categoryDefinition.setName("1234AbcdE&");
325                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
326                                 SERVICE_COMPONENT_TYPE);
327                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
328                                 createCategotyRest.getErrorCode().intValue());
329                 categoryDefinition.setNormalizedName("1234abcde&"); // normalization
330                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
331                 // Get service category and validate that category added as defined
332                 // (also set catalog uniqeId)
333                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
334                                 SERVICE_COMPONENT_TYPE);
335                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
336                                 getAllCategoriesRest.getErrorCode().intValue());
337                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
338                 // Audit validation
339                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
340                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
341         }
342
343         @Test
344         public void addServiceCategoryAllowedcharacters_02() throws Exception {
345                 categoryDefinition.setName("1234AbcdE-");
346                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
347                                 SERVICE_COMPONENT_TYPE);
348                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
349                                 createCategotyRest.getErrorCode().intValue());
350                 categoryDefinition.setNormalizedName("1234abcde-"); // normalization
351                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
352                 // Get service category and validate that category added as defined
353                 // (also set catalog uniqeId)
354                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
355                                 SERVICE_COMPONENT_TYPE);
356                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
357                                 getAllCategoriesRest.getErrorCode().intValue());
358                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
359                 // Audit validation
360                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
361                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
362         }
363
364         @Test
365         public void addServiceCategoryAllowedcharacters_03() throws Exception {
366                 categoryDefinition.setName("1234AbcdE+");
367                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
368                                 SERVICE_COMPONENT_TYPE);
369                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
370                                 createCategotyRest.getErrorCode().intValue());
371                 categoryDefinition.setNormalizedName("1234abcde+"); // normalization
372                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
373                 // Get service category and validate that category added as defined
374                 // (also set catalog uniqeId)
375                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
376                                 SERVICE_COMPONENT_TYPE);
377                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
378                                 getAllCategoriesRest.getErrorCode().intValue());
379                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
380                 // Audit validation
381                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
382                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
383         }
384
385         @Test
386         public void addServiceCategoryAllowedcharacters_04() throws Exception {
387                 categoryDefinition.setName("1234AbcdE.");
388                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
389                                 SERVICE_COMPONENT_TYPE);
390                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
391                                 createCategotyRest.getErrorCode().intValue());
392                 categoryDefinition.setNormalizedName("1234abcde."); // normalization
393                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
394                 // Get service category and validate that category added as defined
395                 // (also set catalog uniqeId)
396                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
397                                 SERVICE_COMPONENT_TYPE);
398                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
399                                 getAllCategoriesRest.getErrorCode().intValue());
400                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
401                 // Audit validation
402                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
403                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
404         }
405
406         @Test
407         public void addServiceCategoryAllowedcharacters_05() throws Exception {
408                 categoryDefinition.setName("1234AbcdE'");
409                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
410                                 SERVICE_COMPONENT_TYPE);
411                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
412                                 createCategotyRest.getErrorCode().intValue());
413                 categoryDefinition.setNormalizedName("1234abcde'");
414                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
415                 // Get service category and validate that category added as defined
416                 // (also set catalog uniqeId)
417                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
418                                 SERVICE_COMPONENT_TYPE);
419                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
420                                 getAllCategoriesRest.getErrorCode().intValue());
421                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
422                 // Audit validation
423                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
424                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
425         }
426
427         @Test
428         public void addServiceCategoryAllowedcharacters_06() throws Exception {
429                 categoryDefinition.setName("1234AbcdE=");
430                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
431                                 SERVICE_COMPONENT_TYPE);
432                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
433                                 createCategotyRest.getErrorCode().intValue());
434                 categoryDefinition.setNormalizedName("1234abcde="); // normalization
435                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
436                 // Get service category and validate that category added as defined
437                 // (also set catalog uniqeId)
438                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
439                                 SERVICE_COMPONENT_TYPE);
440                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
441                                 getAllCategoriesRest.getErrorCode().intValue());
442                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
443                 // Audit validation
444                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
445                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
446         }
447
448         @Test
449         public void addServiceCategoryAllowedcharacters_07() throws Exception {
450                 categoryDefinition.setName("1234AbcdE:");
451                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
452                                 SERVICE_COMPONENT_TYPE);
453                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
454                                 createCategotyRest.getErrorCode().intValue());
455                 categoryDefinition.setNormalizedName("1234abcde:"); // normalization
456                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
457                 // Get service category and validate that category added as defined
458                 // (also set catalog uniqeId)
459                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
460                                 SERVICE_COMPONENT_TYPE);
461                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
462                                 getAllCategoriesRest.getErrorCode().intValue());
463                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
464                 // Audit validation
465                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
466                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
467         }
468
469         @Test
470         public void addServiceCategoryAllowedcharacters_08() throws Exception {
471                 categoryDefinition.setName("1234AbcdE@");
472                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
473                                 SERVICE_COMPONENT_TYPE);
474                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
475                                 createCategotyRest.getErrorCode().intValue());
476                 categoryDefinition.setNormalizedName("1234abcde@"); // normalization
477                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
478                 // Get service category and validate that category added as defined
479                 // (also set catalog uniqeId)
480                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
481                                 SERVICE_COMPONENT_TYPE);
482                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
483                                 getAllCategoriesRest.getErrorCode().intValue());
484                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
485                 // Audit validation
486                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
487                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
488         }
489
490         @Test
491         public void addServiceCategoryAllowedcharacters_09() throws Exception {
492                 categoryDefinition.setName("1234AbcdE_");
493                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
494                                 SERVICE_COMPONENT_TYPE);
495                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
496                                 createCategotyRest.getErrorCode().intValue());
497                 categoryDefinition.setNormalizedName("1234abcde_"); // normalization
498                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
499                 // Get service category and validate that category added as defined
500                 // (also set catalog uniqeId)
501                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
502                                 SERVICE_COMPONENT_TYPE);
503                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
504                                 getAllCategoriesRest.getErrorCode().intValue());
505                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
506                 // Audit validation
507                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
508                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
509         }
510
511         @Test
512         public void addServiceCategoryAllowedcharacters_10() throws Exception {
513                 categoryDefinition.setName("1234AbcdE#");
514                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
515                                 SERVICE_COMPONENT_TYPE);
516                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
517                                 createCategotyRest.getErrorCode().intValue());
518                 categoryDefinition.setNormalizedName("1234abcde#"); // normalization
519                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
520                 // Get service category and validate that category added as defined
521                 // (also set catalog uniqeId)
522                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
523                                 SERVICE_COMPONENT_TYPE);
524                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
525                                 getAllCategoriesRest.getErrorCode().intValue());
526                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
527                 // Audit validation
528                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
529                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
530         }
531
532         @Test
533         public void addServiceCategoryAllowedcharacters_11() throws Exception {
534                 categoryDefinition.setName("1234AbcdE d");
535                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
536                                 SERVICE_COMPONENT_TYPE);
537                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
538                                 createCategotyRest.getErrorCode().intValue());
539                 categoryDefinition.setNormalizedName("1234abcde d"); // normalization
540                 categoryDefinition.setName("1234AbcdE D");
541                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
542                 // Get service category and validate that category added as defined
543                 // (also set catalog uniqeId)
544                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
545                                 SERVICE_COMPONENT_TYPE);
546                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
547                                 getAllCategoriesRest.getErrorCode().intValue());
548                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
549                 // Audit validation
550                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
551                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
552         }
553
554         @Test
555         public void addServiceCategoryAllowedcharacters_12() throws Exception {
556                 categoryDefinition.setName("1234AbcdE   &_=+.-'#:@ d");
557                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
558                                 SERVICE_COMPONENT_TYPE);
559                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
560                                 createCategotyRest.getErrorCode().intValue());
561                 categoryDefinition.setNormalizedName("1234abcde &_=+.-'#:@ d"); // normalization
562                 categoryDefinition.setName("1234AbcdE &_=+.-'#:@ D");
563                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
564                 // Get service category and validate that category added as defined
565                 // (also set catalog uniqeId)
566                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
567                                 SERVICE_COMPONENT_TYPE);
568                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
569                                 getAllCategoriesRest.getErrorCode().intValue());
570                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
571                 // Audit validation
572                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
573                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
574         }
575
576         @Test
577         public void categoryNameValidation_RemoveSpaceFromBeginning() throws Exception {
578                 categoryDefinition.setName("  Category01");
579                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
580                                 SERVICE_COMPONENT_TYPE);
581                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
582                                 createCategotyRest.getErrorCode().intValue());
583                 categoryDefinition.setNormalizedName("category01"); // normalization
584                 categoryDefinition.setName("Category01");
585                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
586                 // Get service category and validate that category added as defined
587                 // (also set catalog uniqeId)
588                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
589                                 SERVICE_COMPONENT_TYPE);
590                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
591                                 getAllCategoriesRest.getErrorCode().intValue());
592                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
593                 // Audit validation
594                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
595                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
596         }
597
598         @Test
599         public void categoryNameValidation_RemoveSpaceFromEnd() throws Exception {
600                 categoryDefinition.setName("Category01    ");
601                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
602                                 SERVICE_COMPONENT_TYPE);
603                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
604                                 createCategotyRest.getErrorCode().intValue());
605                 categoryDefinition.setNormalizedName("category01"); // normalization
606                 categoryDefinition.setName("Category01");
607                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
608                 // Get service category and validate that category added as defined
609                 // (also set catalog uniqeId)
610                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
611                                 SERVICE_COMPONENT_TYPE);
612                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
613                                 getAllCategoriesRest.getErrorCode().intValue());
614                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
615                 // Audit validation
616                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
617                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
618         }
619
620         @Test
621         public void categoryNameValidation_RemoveExtraSpace() throws Exception {
622                 categoryDefinition.setName("Category    02");
623                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
624                                 SERVICE_COMPONENT_TYPE);
625                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
626                                 createCategotyRest.getErrorCode().intValue());
627                 categoryDefinition.setNormalizedName("category 02"); // normalization
628                 categoryDefinition.setName("Category 02");
629                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
630                 // Get service category and validate that category added as defined
631                 // (also set catalog uniqeId)
632                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
633                                 SERVICE_COMPONENT_TYPE);
634                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
635                                 getAllCategoriesRest.getErrorCode().intValue());
636                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
637                 // Audit validation
638                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
639                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
640         }
641
642         @Test
643         public void categoryNameValidation_RemoveExtraAmpersand() throws Exception {
644                 categoryDefinition.setName("Category&& &02");
645                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
646                                 SERVICE_COMPONENT_TYPE);
647                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
648                                 createCategotyRest.getErrorCode().intValue());
649                 categoryDefinition.setNormalizedName("category& &02"); // normalization
650                 categoryDefinition.setName("Category& &02");
651                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
652                 // Get service category and validate that category added as defined
653                 // (also set catalog uniqeId)
654                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
655                                 SERVICE_COMPONENT_TYPE);
656                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
657                                 getAllCategoriesRest.getErrorCode().intValue());
658                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
659                 // Audit validation
660                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
661                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
662         }
663
664         @Test
665         public void categoryNameValidation_RemoveExtraDash() throws Exception {
666                 categoryDefinition.setName("CategorY-- --02");
667                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
668                                 SERVICE_COMPONENT_TYPE);
669                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
670                                 createCategotyRest.getErrorCode().intValue());
671                 categoryDefinition.setName("CategorY- -02");
672                 categoryDefinition.setNormalizedName("category- -02");
673                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
674                 // Get service category and validate that category added as defined
675                 // (also set catalog uniqeId)
676                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
677                                 SERVICE_COMPONENT_TYPE);
678                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
679                                 getAllCategoriesRest.getErrorCode().intValue());
680                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
681                 // Audit validation
682                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
683                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
684         }
685
686         @Test
687         public void categoryNameValidation_RemoveExtraPlus() throws Exception {
688                 categoryDefinition.setName("CateGory++++ +02");
689                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
690                                 SERVICE_COMPONENT_TYPE);
691                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
692                                 createCategotyRest.getErrorCode().intValue());
693                 categoryDefinition.setName("CateGory+ +02");
694                 categoryDefinition.setNormalizedName("category+ +02");
695                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
696                 // Get service category and validate that category added as defined
697                 // (also set catalog uniqeId)
698                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
699                                 SERVICE_COMPONENT_TYPE);
700                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
701                                 getAllCategoriesRest.getErrorCode().intValue());
702                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
703                 // Audit validation
704                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
705                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
706         }
707
708         @Test
709         public void categoryNameValidation_RemoveExtraPeriod() throws Exception {
710                 categoryDefinition.setName("Category.... .02");
711                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
712                                 SERVICE_COMPONENT_TYPE);
713                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
714                                 createCategotyRest.getErrorCode().intValue());
715                 categoryDefinition.setName("Category. .02");
716                 categoryDefinition.setNormalizedName("category. .02");
717                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
718                 // Get service category and validate that category added as defined
719                 // (also set catalog uniqeId)
720                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
721                                 SERVICE_COMPONENT_TYPE);
722                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
723                                 getAllCategoriesRest.getErrorCode().intValue());
724                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
725                 // Audit validation
726                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
727                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
728         }
729
730         @Test
731         public void categoryNameValidation_RemoveExtraApostrophe() throws Exception {
732                 categoryDefinition.setName("CaTegory''' '02");
733                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
734                                 SERVICE_COMPONENT_TYPE);
735                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
736                                 createCategotyRest.getErrorCode().intValue());
737                 categoryDefinition.setName("CaTegory' '02");
738                 categoryDefinition.setNormalizedName("category' '02");
739                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
740                 // Get service category and validate that category added as defined
741                 // (also set catalog uniqeId)
742                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
743                                 SERVICE_COMPONENT_TYPE);
744                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
745                                 getAllCategoriesRest.getErrorCode().intValue());
746                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
747                 // Audit validation
748                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
749                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
750         }
751
752         @Test
753         public void categoryNameValidation_RemoveExtraHashtag() throws Exception {
754                 categoryDefinition.setName("Category### #02");
755                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
756                                 SERVICE_COMPONENT_TYPE);
757                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
758                                 createCategotyRest.getErrorCode().intValue());
759                 categoryDefinition.setName("Category# #02");
760                 categoryDefinition.setNormalizedName("category# #02");
761                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
762                 // Get service category and validate that category added as defined
763                 // (also set catalog uniqeId)
764                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
765                                 SERVICE_COMPONENT_TYPE);
766                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
767                                 getAllCategoriesRest.getErrorCode().intValue());
768                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
769                 // Audit validation
770                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
771                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
772         }
773
774         @Test
775         public void categoryNameValidation_RemoveExtrEequal() throws Exception {
776                 categoryDefinition.setName("Category=== =02");
777                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
778                                 SERVICE_COMPONENT_TYPE);
779                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
780                                 createCategotyRest.getErrorCode().intValue());
781                 categoryDefinition.setName("Category= =02");
782                 categoryDefinition.setNormalizedName("category= =02");
783                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
784                 // Get service category and validate that category added as defined
785                 // (also set catalog uniqeId)
786                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
787                                 SERVICE_COMPONENT_TYPE);
788                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
789                                 getAllCategoriesRest.getErrorCode().intValue());
790                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
791                 // Audit validation
792                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
793                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
794         }
795
796         @Test
797         public void categoryNameValidation_RemoveExtrColon() throws Exception {
798                 categoryDefinition.setName("Category::: :02");
799                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
800                                 SERVICE_COMPONENT_TYPE);
801                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
802                                 createCategotyRest.getErrorCode().intValue());
803                 categoryDefinition.setName("Category: :02");
804                 categoryDefinition.setNormalizedName("category: :02");
805                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
806                 // Get service category and validate that category added as defined
807                 // (also set catalog uniqeId)
808                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
809                                 SERVICE_COMPONENT_TYPE);
810                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
811                                 getAllCategoriesRest.getErrorCode().intValue());
812                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
813                 // Audit validation
814                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
815                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
816         }
817
818         @Test
819         public void categoryNameValidation_RemoveExtrAt() throws Exception {
820                 categoryDefinition.setName("Category@@@ @a2");
821                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
822                                 SERVICE_COMPONENT_TYPE);
823                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
824                                 createCategotyRest.getErrorCode().intValue());
825                 categoryDefinition.setName("Category@ @a2");
826                 categoryDefinition.setNormalizedName("category@ @a2");
827                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
828                 // Get service category and validate that category added as defined
829                 // (also set catalog uniqeId)
830                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
831                                 SERVICE_COMPONENT_TYPE);
832                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
833                                 getAllCategoriesRest.getErrorCode().intValue());
834                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
835                 // Audit validation
836                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
837                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
838         }
839
840         @Test
841         public void categoryNameValidation_RemoveExtraUnderscore() throws Exception {
842                 categoryDefinition.setName("Category___ _22");
843                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
844                                 SERVICE_COMPONENT_TYPE);
845                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
846                                 createCategotyRest.getErrorCode().intValue());
847                 categoryDefinition.setName("Category_ _22");
848                 categoryDefinition.setNormalizedName("category_ _22");
849                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
850                 // Get service category and validate that category added as defined
851                 // (also set catalog uniqeId)
852                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
853                                 SERVICE_COMPONENT_TYPE);
854                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
855                                 getAllCategoriesRest.getErrorCode().intValue());
856                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
857                 // Audit validation
858                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
859                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
860         }
861
862         @Test
863         public void categoryNameValidation_FirstWordStartWithNumber() throws Exception {
864                 categoryDefinition.setName("1Category one");
865                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
866                                 SERVICE_COMPONENT_TYPE);
867                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
868                                 createCategotyRest.getErrorCode().intValue());
869                 categoryDefinition.setName("1Category One");
870                 categoryDefinition.setNormalizedName("1category one");
871                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
872                 // Get service category and validate that category added as defined
873                 // (also set catalog uniqeId)
874                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
875                                 SERVICE_COMPONENT_TYPE);
876                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
877                                 getAllCategoriesRest.getErrorCode().intValue());
878                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
879                 // Audit validation
880                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
881                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
882         }
883
884         @Test
885         public void categoryNameValidation_FirstWordStartWithNonAlphaNumeric() throws Exception { // The
886                                                                                                                                                                                                 // first
887                                                                                                                                                                                                 // word
888                                                                                                                                                                                                 // must
889                                                                                                                                                                                                 // start
890                                                                                                                                                                                                 // with
891                                                                                                                                                                                                 // an
892                                                                                                                                                                                                 // alpha-numeric
893                                                                                                                                                                                                 // character
894                                                                                                                                                                                                 // [a-Z
895                                                                                                                                                                                                 // A..Z,
896                                                                                                                                                                                                 // 0..9]
897                 char invalidChars[] = { '&', '-', '+', '.', '\'', '#', '=', ':', '@', '_' };
898                 for (int i = 0; i < invalidChars.length; i++) {
899                         DbUtils.deleteFromEsDbByPattern("_all");
900                         categoryDefinition.setName(invalidChars[i] + "AbcD123");
901                         categoryDefinition.setNormalizedName((invalidChars[i] + "AbcD123").toLowerCase());
902                         RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition,
903                                         sdncAdminUserDetails1, SERVICE_COMPONENT_TYPE);
904                         assertEquals("Check response code after create Category", STATUS_CODE_INVALID_CONTENT,
905                                         createCategotyRest.getErrorCode().intValue());
906
907                         // get service category and validate that category was not added
908                         RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
909                                         SERVICE_COMPONENT_TYPE);
910                         assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
911                                         getAllCategoriesRest.getErrorCode().intValue());
912                         CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
913                         // Audit validation
914                         AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails1,
915                                         ActionStatus.COMPONENT_ELEMENT_INVALID_NAME_FORMAT, STATUS_CODE_INVALID_CONTENT, AUDIT_SERVICE_TYPE,
916                                         "Service", "category");
917
918                 }
919         }
920
921         @Test
922         public void addServiceCategoryAlreadyExist_uniqueness() throws Exception { // Verify
923                                                                                                                                                                 // category
924                                                                                                                                                                 // name
925                                                                                                                                                                 // duplication
926                                                                                                                                                                 // ("uniqueness")
927                                                                                                                                                                 // as
928                                                                                                                                                                 // non-case-sensitive,
929                                                                                                                                                                 // so
930                                                                                                                                                                 // we
931                                                                                                                                                                 // don’t
932                                                                                                                                                                 // create
933                                                                                                                                                                 // duplicate
934                                                                                                                                                                 // names
935                                                                                                                                                                 // with
936                                                                                                                                                                 // upper/lower
937                                                                                                                                                                 // case
938                                                                                                                                                                 // inconsistency.
939                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
940                                 SERVICE_COMPONENT_TYPE);
941                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
942                                 createCategotyRest.getErrorCode().intValue());
943                 categoryDefinition.setNormalizedName("abcd");
944                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
945                 // get service category and validate that category added as defined
946                 // (also set catalog uniqeId)
947                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
948                                 SERVICE_COMPONENT_TYPE);
949                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
950                                 getAllCategoriesRest.getErrorCode().intValue());
951                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition); // also
952                                                                                                                                                                                                                         // set
953                                                                                                                                                                                                                         // catalog
954                                                                                                                                                                                                                         // uniqeId
955                 // Audit validation
956                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
957                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
958                 // Create same category name again
959                 DbUtils.deleteFromEsDbByPattern("_all");
960                 CategoryDefinition categoryDataDefinition2 = new CategoryDefinition();
961                 categoryDataDefinition2.setName(categoryDefinition.getName());
962                 RestResponse addDuplicateCategoryRest = CategoryRestUtils.createCategory(categoryDataDefinition2,
963                                 sdncAdminUserDetails, SERVICE_COMPONENT_TYPE);
964                 assertEquals("Check response code after create Category", STATUS_CODE_ALREADY_EXISTS,
965                                 addDuplicateCategoryRest.getErrorCode().intValue());
966                 // Audit validation
967                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDataDefinition2, sdncAdminUserDetails,
968                                 ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS, STATUS_CODE_ALREADY_EXISTS, AUDIT_SERVICE_TYPE,
969                                 "Service", categoryDefinition.getName());
970                 // Get Category and verify that category was created is not deleted
971                 getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, SERVICE_COMPONENT_TYPE);
972                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
973                                 getAllCategoriesRest.getErrorCode().intValue());
974                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
975
976         }
977
978         @Test
979         public void categoryNameValidation_ReplaceAndWithAmpersand_01() throws Exception {
980                 categoryDefinition.setName("At and T");
981                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
982                                 SERVICE_COMPONENT_TYPE);
983                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
984                                 createCategotyRest.getErrorCode().intValue());
985                 categoryDefinition.setName("At & T");
986                 categoryDefinition.setNormalizedName("at & t");
987                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
988                 // Get service category and validate that category added as defined
989                 // (also set catalog uniqeId)
990                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
991                                 SERVICE_COMPONENT_TYPE);
992                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
993                                 getAllCategoriesRest.getErrorCode().intValue());
994                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
995                 // Audit validation
996                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
997                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
998         }
999
1000         @Test
1001         public void categoryNameValidation_ReplaceAndWithAmpersand_02() throws Exception {
1002                 categoryDefinition.setName("At and t");
1003                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1004                                 SERVICE_COMPONENT_TYPE);
1005                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1006                                 createCategotyRest.getErrorCode().intValue());
1007                 categoryDefinition.setName("At & T");
1008                 categoryDefinition.setNormalizedName("at & t");
1009                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1010                 // Get service category and validate that category added as defined
1011                 // (also set catalog uniqeId)
1012                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1013                                 SERVICE_COMPONENT_TYPE);
1014                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1015                                 getAllCategoriesRest.getErrorCode().intValue());
1016                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1017                 // Audit validation
1018                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1019                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1020         }
1021
1022         @Test
1023         public void categoryNameValidation_ReplaceAndWithAmpersand_03() throws Exception {
1024                 categoryDefinition.setName("Atand T");
1025                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1026                                 SERVICE_COMPONENT_TYPE);
1027                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1028                                 createCategotyRest.getErrorCode().intValue());
1029                 categoryDefinition.setNormalizedName("atand t");
1030                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1031                 // Get service category and validate that category added as defined
1032                 // (also set catalog uniqeId)
1033                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1034                                 SERVICE_COMPONENT_TYPE);
1035                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1036                                 getAllCategoriesRest.getErrorCode().intValue());
1037                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1038                 // Audit validation
1039                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1040                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1041         }
1042
1043         @Test
1044         public void categoryNameValidation_ReplaceAndWithAmpersand_04() throws Exception {
1045                 categoryDefinition.setName("At andT");
1046                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1047                                 SERVICE_COMPONENT_TYPE);
1048                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1049                                 createCategotyRest.getErrorCode().intValue());
1050                 categoryDefinition.setNormalizedName("at andt");
1051                 categoryDefinition.setName("At AndT");
1052                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1053                 // Get service category and validate that category added as defined
1054                 // (also set catalog uniqeId)
1055                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1056                                 SERVICE_COMPONENT_TYPE);
1057                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1058                                 getAllCategoriesRest.getErrorCode().intValue());
1059                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1060                 // Audit validation
1061                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1062                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1063         }
1064
1065         @Test
1066         public void categoryNameValidation_ReplaceAndWithAmpersand_05() throws Exception {
1067                 categoryDefinition.setName(" and AttT");
1068                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1069                                 SERVICE_COMPONENT_TYPE);
1070                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1071                                 createCategotyRest.getErrorCode().intValue());
1072                 categoryDefinition.setNormalizedName("and attt");
1073                 categoryDefinition.setName("And AttT");
1074                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1075                 // Get service category and validate that category added as defined
1076                 // (also set catalog uniqeId)
1077                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1078                                 SERVICE_COMPONENT_TYPE);
1079                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1080                                 getAllCategoriesRest.getErrorCode().intValue());
1081                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1082                 // Audit validation
1083                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1084                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1085         }
1086
1087         @Test
1088         public void categoryNameValidation_ReplaceAndWithAmpersand_06() throws Exception {
1089                 categoryDefinition.setName("AttT and ");
1090                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1091                                 SERVICE_COMPONENT_TYPE);
1092                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1093                                 createCategotyRest.getErrorCode().intValue());
1094                 categoryDefinition.setNormalizedName("attt and");
1095                 categoryDefinition.setName("AttT And");
1096                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1097                 // Get service category and validate that category added as defined
1098                 // (also set catalog uniqeId)
1099                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1100                                 SERVICE_COMPONENT_TYPE);
1101                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1102                                 getAllCategoriesRest.getErrorCode().intValue());
1103                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1104                 // Audit validation
1105                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1106                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1107         }
1108
1109         // Bug
1110         @Test
1111         public void categoryNameValidation_ReplaceAndWithAmpersand_07() throws Exception {
1112                 categoryDefinition.setName(" and a");
1113                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1114                                 SERVICE_COMPONENT_TYPE);
1115                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1116                                 createCategotyRest.getErrorCode().intValue());
1117                 categoryDefinition.setNormalizedName("and a");
1118                 categoryDefinition.setName("And a");
1119                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1120                 // Get service category and validate that category added as defined
1121                 // (also set catalog uniqeId)
1122                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1123                                 SERVICE_COMPONENT_TYPE);
1124                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1125                                 getAllCategoriesRest.getErrorCode().intValue());
1126                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1127                 // Audit validation
1128                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1129                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1130         }
1131
1132         @Test
1133         public void categoryNameValidationMaxLength() throws Exception {
1134                 categoryDefinition.setName("AsdfghjQ234567890@#.&:+-_");
1135                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1136                                 SERVICE_COMPONENT_TYPE);
1137                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1138                                 createCategotyRest.getErrorCode().intValue());
1139                 categoryDefinition.setNormalizedName("asdfghjq234567890@#.&:+-_");
1140                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1141                 // Get service category and validate that category added as defined
1142                 // (also set catalog uniqeId)
1143                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1144                                 SERVICE_COMPONENT_TYPE);
1145                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1146                                 getAllCategoriesRest.getErrorCode().intValue());
1147                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1148                 // Audit validation
1149                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1150                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1151
1152         }
1153
1154         @Test
1155         public void categoryNameValidationMaxLengthAfterNormalization() throws Exception {
1156                 categoryDefinition.setName("  A jQ234 @@@___ +++ At and T and and ");
1157                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1158                                 SERVICE_COMPONENT_TYPE);
1159                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1160                                 createCategotyRest.getErrorCode().intValue());
1161                 categoryDefinition.setName("A JQ234 @_ + At & T & And");
1162                 categoryDefinition.setNormalizedName("a jq234 @_ + at & t & and");
1163                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1164                 // Get service category and validate that category added as defined
1165                 // (also set catalog uniqeId)
1166                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1167                                 SERVICE_COMPONENT_TYPE);
1168                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1169                                 getAllCategoriesRest.getErrorCode().intValue());
1170                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1171                 // Audit validation
1172                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1173                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1174
1175         }
1176
1177         @Test
1178         public void categoryNameValidationExceedMaxLengthAfterNormalization() throws Exception {
1179                 categoryDefinition.setName("  AbdfghBCVa jQ234 @@___ +++ At and T   ");
1180                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1181                                 SERVICE_COMPONENT_TYPE);
1182                 assertEquals("Check response code after create Category", STATUS_CODE_INVALID_CONTENT,
1183                                 createCategotyRest.getErrorCode().intValue());
1184                 categoryDefinition.setNormalizedName("abdfghbcva jq234 @_ + at&t");
1185                 // get service category and validate that category was not added
1186                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1187                                 SERVICE_COMPONENT_TYPE);
1188                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1189                                 getAllCategoriesRest.getErrorCode().intValue());
1190                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1191                 // Audit validation
1192                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1193                                 ActionStatus.COMPONENT_ELEMENT_INVALID_NAME_LENGTH, STATUS_CODE_INVALID_CONTENT, AUDIT_SERVICE_TYPE,
1194                                 "Service", "category");
1195         }
1196
1197         @Test
1198         public void categoryNameValidationMinLengthAfterNormalization() throws Exception { // MinLengthAfterNormalization
1199                                                                                                                                                                                 // =
1200                                                                                                                                                                                 // 4
1201                                                                                                                                                                                 // characters
1202                 categoryDefinition.setName("  At and  T   ");
1203                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1204                                 SERVICE_COMPONENT_TYPE);
1205                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1206                                 createCategotyRest.getErrorCode().intValue());
1207                 categoryDefinition.setName("At & T");
1208                 categoryDefinition.setNormalizedName("at & t");
1209                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1210                 // Get service category and validate that category added as defined
1211                 // (also set catalog uniqeId)
1212                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1213                                 SERVICE_COMPONENT_TYPE);
1214                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1215                                 getAllCategoriesRest.getErrorCode().intValue());
1216                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1217                 // Audit validation
1218                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1219                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1220         }
1221
1222         @Test
1223         public void categoryNameValidationLessThanMinLengthAfterNormalization() throws Exception {
1224                 categoryDefinition.setName("  A&&&&&&&&&&&&&&&&&T   ");
1225                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1226                                 SERVICE_COMPONENT_TYPE);
1227                 assertEquals("Check response code after create Category", STATUS_CODE_INVALID_CONTENT,
1228                                 createCategotyRest.getErrorCode().intValue());
1229                 categoryDefinition.setNormalizedName("a&t");
1230                 // get service category and validate that category was not added
1231                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1232                                 SERVICE_COMPONENT_TYPE);
1233                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1234                                 getAllCategoriesRest.getErrorCode().intValue());
1235                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1236                 // Audit validation
1237                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1238                                 ActionStatus.COMPONENT_ELEMENT_INVALID_NAME_LENGTH, STATUS_CODE_INVALID_CONTENT, AUDIT_SERVICE_TYPE,
1239                                 "Service", "category");
1240         }
1241
1242         @Test
1243         public void categoryNameValidationIsNull() throws Exception {
1244                 categoryDefinition.setName(null);
1245                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1246                                 SERVICE_COMPONENT_TYPE);
1247                 assertEquals("Check response code after create Category", STATUS_CODE_INVALID_CONTENT,
1248                                 createCategotyRest.getErrorCode().intValue());
1249                 // get service category and validate that category was not added
1250                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1251                                 SERVICE_COMPONENT_TYPE);
1252                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1253                                 getAllCategoriesRest.getErrorCode().intValue());
1254                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1255                 // Audit validation
1256                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1257                                 ActionStatus.COMPONENT_ELEMENT_INVALID_NAME_LENGTH, STATUS_CODE_INVALID_CONTENT, AUDIT_SERVICE_TYPE,
1258                                 "Service", "category");
1259         }
1260
1261         @Test
1262         public void categoryNameValidationIsEmpty() throws Exception {
1263                 categoryDefinition.setName("");
1264                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1265                                 SERVICE_COMPONENT_TYPE);
1266                 assertEquals("Check response code after create Category", STATUS_CODE_INVALID_CONTENT,
1267                                 createCategotyRest.getErrorCode().intValue());
1268                 categoryDefinition.setNormalizedName("");
1269                 // get service category and validate that category was not added
1270                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1271                                 SERVICE_COMPONENT_TYPE);
1272                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1273                                 getAllCategoriesRest.getErrorCode().intValue());
1274                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1275                 // Audit validation
1276                 AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1277                                 ActionStatus.COMPONENT_ELEMENT_INVALID_NAME_FORMAT, STATUS_CODE_INVALID_CONTENT, AUDIT_SERVICE_TYPE,
1278                                 "Service", "category");
1279         }
1280
1281         @Test
1282         public void categoryNameValidationInvalidCharacters() throws Exception {
1283                 char invalidChars[] = { '~', '!', '$', '%', '^', '*', '(', ')', '"', '{', '}', '[', ']', '?', '>', '<', '/',
1284                                 '|', '\\', ',' };
1285                 for (int i = 0; i < invalidChars.length; i++) {
1286                         DbUtils.deleteFromEsDbByPattern("_all");
1287                         // DbUtils.cleanAllAudits();
1288                         categoryDefinition.setName("AbcD123" + invalidChars[i]);
1289                         RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1290                                         SERVICE_COMPONENT_TYPE);
1291                         assertEquals("Check response code after create Category", STATUS_CODE_INVALID_CONTENT,
1292                                         createCategotyRest.getErrorCode().intValue());
1293                         categoryDefinition.setNormalizedName("");
1294                         // get service category and validate that category was not added
1295                         RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1296                                         SERVICE_COMPONENT_TYPE);
1297                         assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1298                                         getAllCategoriesRest.getErrorCode().intValue());
1299                         CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1300                         // Audit validation
1301                         AuditValidationUtils.categoryAuditFailure(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1302                                         ActionStatus.COMPONENT_ELEMENT_INVALID_NAME_FORMAT, STATUS_CODE_INVALID_CONTENT, AUDIT_SERVICE_TYPE,
1303                                         "Service", "category");
1304                 }
1305         }
1306
1307         @Test
1308         public void categoryNameValidationSameNameDifferentResourceType() throws Exception { // same
1309                                                                                                                                                                                         // Catalog
1310                                                                                                                                                                                         // Name
1311                                                                                                                                                                                         // for
1312                                                                                                                                                                                         // service/resource/product
1313                                                                                                                                                                                         // is
1314                                                                                                                                                                                         // allowed
1315                 String name = ("Abcd");
1316                 CategoryDefinition categoryDataDefinition1 = new CategoryDefinition();
1317                 CategoryDefinition categoryDataDefinition2 = new CategoryDefinition();
1318                 CategoryDefinition categoryDataDefinition3 = new CategoryDefinition();
1319                 categoryDataDefinition1.setName(name);
1320                 categoryDataDefinition2.setName(name);
1321                 categoryDataDefinition3.setName(name);
1322                 // CREATE CATEGORY FOR SERVICE
1323                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDataDefinition1,
1324                                 sdncAdminUserDetails, SERVICE_COMPONENT_TYPE);
1325                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1326                                 createCategotyRest.getErrorCode().intValue());
1327                 categoryDataDefinition1.setNormalizedName("abcd");
1328                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDataDefinition1);
1329                 // get service category and validate that category added as defined
1330                 // (also set catalog uniqeId)
1331                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1332                                 SERVICE_COMPONENT_TYPE);
1333                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
1334                                 getAllCategoriesRest.getErrorCode().intValue());
1335                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDataDefinition1); // also
1336                                                                                                                                                                                                                                         // set
1337                                                                                                                                                                                                                                         // catalog
1338                                                                                                                                                                                                                                         // uniqeId
1339                 // Audit validation
1340                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDataDefinition1, sdncAdminUserDetails,
1341                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1342                 // CREATE CATEGORY FOR RESOURCE_COMPONENT_TYPE
1343                 DbUtils.deleteFromEsDbByPattern("_all");
1344                 createCategotyRest = CategoryRestUtils.createCategory(categoryDataDefinition2, sdncAdminUserDetails,
1345                                 RESOURCE_COMPONENT_TYPE);
1346                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1347                                 createCategotyRest.getErrorCode().intValue());
1348                 categoryDataDefinition2.setNormalizedName("abcd");
1349                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDataDefinition2);
1350                 // Get Category
1351                 getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, RESOURCE_COMPONENT_TYPE);
1352                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
1353                                 getAllCategoriesRest.getErrorCode().intValue());
1354                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDataDefinition2);
1355                 // Audit validation
1356                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDataDefinition2, sdncAdminUserDetails,
1357                                 STATUS_CODE_CREATED, AUDIT_RESOURCE_TYPE);
1358                 // CREATE CATEGORY FOR PRODUCT
1359                 DbUtils.deleteFromEsDbByPattern("_all");
1360                 RestResponse addCategotyRest = CategoryRestUtils.createCategory(categoryDataDefinition3,
1361                                 sdncProductStrategistUserDetails, PRODUCT_COMPONENT_TYPE);
1362                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1363                                 addCategotyRest.getErrorCode().intValue());
1364                 categoryDataDefinition3.setNormalizedName("abcd");
1365                 CategoryValidationUtils.validateCreateCategoryResponse(addCategotyRest, categoryDataDefinition3);
1366
1367                 // Get Category
1368                 getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, PRODUCT_COMPONENT_TYPE);
1369                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1370                                 getAllCategoriesRest.getErrorCode().intValue());
1371                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDataDefinition3);
1372                 // Audit validation
1373                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncProductStrategistUserDetails,
1374                                 STATUS_CODE_CREATED, AUDIT_PRODUCT_TYPE);
1375         }
1376
1377         @Test
1378         public void categoryNameValidationFirstLetterOfKeyWordsCapitalized() throws Exception { // First
1379                                                                                                                                                                                         // letter
1380                                                                                                                                                                                         // of
1381                                                                                                                                                                                         // key
1382                                                                                                                                                                                         // words
1383                                                                                                                                                                                         // are
1384                                                                                                                                                                                         // capitalized
1385                 categoryDefinition.setName("beNNy shaY michEl");
1386                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1387                                 SERVICE_COMPONENT_TYPE);
1388                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1389                                 createCategotyRest.getErrorCode().intValue());
1390                 categoryDefinition.setName("BeNNy ShaY MichEl");
1391                 categoryDefinition.setNormalizedName("benny shay michel");
1392                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1393                 // Get service category and validate that category added as defined
1394                 // (also set catalog uniqeId)
1395                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1396                                 SERVICE_COMPONENT_TYPE);
1397                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1398                                 getAllCategoriesRest.getErrorCode().intValue());
1399                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1400                 // Audit validation
1401                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1402                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1403         }
1404
1405         @Test
1406         public void categoryNameValidationConjunctions_01() throws Exception { // Normalize
1407                                                                                                                                                         // the
1408                                                                                                                                                         // category
1409                                                                                                                                                         // name
1410                                                                                                                                                         // conjunctions
1411                                                                                                                                                         // ('of',
1412                                                                                                                                                         // 'to',
1413                                                                                                                                                         // 'for',
1414                                                                                                                                                         // 'as',
1415                                                                                                                                                         // 'a',
1416                                                                                                                                                         // 'an'
1417                                                                                                                                                         // ,
1418                                                                                                                                                         // 'the')
1419                                                                                                                                                         // are
1420                                                                                                                                                         // lower
1421                                                                                                                                                         // case.
1422                 categoryDefinition.setName(" bank OF america  ");
1423                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1424                                 SERVICE_COMPONENT_TYPE);
1425                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1426                                 createCategotyRest.getErrorCode().intValue());
1427                 categoryDefinition.setName("Bank of America");
1428                 categoryDefinition.setNormalizedName("bank of america");
1429                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1430                 // Get service category and validate that category added as defined
1431                 // (also set catalog uniqeId)
1432                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1433                                 SERVICE_COMPONENT_TYPE);
1434                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1435                                 getAllCategoriesRest.getErrorCode().intValue());
1436                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1437                 // Audit validation
1438                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1439                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1440         }
1441
1442         @Test
1443         public void categoryNameValidationConjunctions_02() throws Exception { // Normalize
1444                                                                                                                                                         // the
1445                                                                                                                                                         // category
1446                                                                                                                                                         // name
1447                                                                                                                                                         // conjunctions
1448                                                                                                                                                         // ('of',
1449                                                                                                                                                         // 'to',
1450                                                                                                                                                         // 'for',
1451                                                                                                                                                         // 'as',
1452                                                                                                                                                         // 'a',
1453                                                                                                                                                         // 'an'
1454                                                                                                                                                         // ,
1455                                                                                                                                                         // 'the')
1456                                                                                                                                                         // are
1457                                                                                                                                                         // lower
1458                                                                                                                                                         // case.
1459                 categoryDefinition.setName("THE america bank   ");
1460                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1461                                 SERVICE_COMPONENT_TYPE);
1462                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1463                                 createCategotyRest.getErrorCode().intValue());
1464                 categoryDefinition.setName("THE America Bank");
1465                 categoryDefinition.setNormalizedName("the america bank");
1466                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1467                 // Get service category and validate that category added as defined
1468                 // (also set catalog uniqeId)
1469                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1470                                 SERVICE_COMPONENT_TYPE);
1471                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1472                                 getAllCategoriesRest.getErrorCode().intValue());
1473                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1474                 // Audit validation
1475                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1476                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1477         }
1478
1479         @Test
1480         public void categoryNameValidationConjunctions_03() throws Exception { // Normalize
1481                                                                                                                                                         // the
1482                                                                                                                                                         // category
1483                                                                                                                                                         // name
1484                                                                                                                                                         // conjunctions
1485                                                                                                                                                         // ('of',
1486                                                                                                                                                         // 'to',
1487                                                                                                                                                         // 'for',
1488                                                                                                                                                         // 'as',
1489                                                                                                                                                         // 'a',
1490                                                                                                                                                         // 'an'
1491                                                                                                                                                         // ,
1492                                                                                                                                                         // 'the')
1493                                                                                                                                                         // are
1494                                                                                                                                                         // lower
1495                                                                                                                                                         // case.
1496                 categoryDefinition.setName("   A bank OF america  ");
1497                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1498                                 SERVICE_COMPONENT_TYPE);
1499                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1500                                 createCategotyRest.getErrorCode().intValue());
1501                 categoryDefinition.setName("A Bank of America");
1502                 categoryDefinition.setNormalizedName("a bank of america");
1503                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1504                 // Get service category and validate that category added as defined
1505                 // (also set catalog uniqeId)
1506                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1507                                 SERVICE_COMPONENT_TYPE);
1508                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1509                                 getAllCategoriesRest.getErrorCode().intValue());
1510                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1511                 // Audit validation
1512                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1513                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1514         }
1515
1516         @Test
1517         public void categoryNameValidationConjunctions_04() throws Exception { // Normalize
1518                                                                                                                                                         // the
1519                                                                                                                                                         // category
1520                                                                                                                                                         // name
1521                                                                                                                                                         // conjunctions
1522                                                                                                                                                         // ('of',
1523                                                                                                                                                         // 'to',
1524                                                                                                                                                         // 'for',
1525                                                                                                                                                         // 'as',
1526                                                                                                                                                         // 'a',
1527                                                                                                                                                         // 'an'
1528                                                                                                                                                         // ,
1529                                                                                                                                                         // 'the')
1530                                                                                                                                                         // are
1531                                                                                                                                                         // lower
1532                                                                                                                                                         // case.
1533                 categoryDefinition.setName("  bank  america is A big ban  ");
1534                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1535                                 SERVICE_COMPONENT_TYPE);
1536                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1537                                 createCategotyRest.getErrorCode().intValue());
1538                 categoryDefinition.setName("Bank America Is a Big Ban");
1539                 categoryDefinition.setNormalizedName("bank america is a big ban");
1540                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1541                 // Get service category and validate that category added as defined
1542                 // (also set catalog uniqeId)
1543                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1544                                 SERVICE_COMPONENT_TYPE);
1545                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1546                                 getAllCategoriesRest.getErrorCode().intValue());
1547                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1548                 // Audit validation
1549                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1550                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1551         }
1552
1553         @Test
1554         public void categoryNameValidationConjunctions_05() throws Exception { // Normalize
1555                                                                                                                                                         // the
1556                                                                                                                                                         // category
1557                                                                                                                                                         // name
1558                                                                                                                                                         // conjunctions
1559                                                                                                                                                         // ('of',
1560                                                                                                                                                         // 'to',
1561                                                                                                                                                         // 'for',
1562                                                                                                                                                         // 'as',
1563                                                                                                                                                         // 'a',
1564                                                                                                                                                         // 'an'
1565                                                                                                                                                         // ,
1566                                                                                                                                                         // 'the')
1567                                                                                                                                                         // are
1568                                                                                                                                                         // lower
1569                                                                                                                                                         // case.
1570                 categoryDefinition.setName(" aN apple comPany inC ");
1571                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1572                                 SERVICE_COMPONENT_TYPE);
1573                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1574                                 createCategotyRest.getErrorCode().intValue());
1575                 categoryDefinition.setName("AN Apple ComPany InC");
1576                 categoryDefinition.setNormalizedName("an apple company inc");
1577                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1578                 // Get service category and validate that category added as defined
1579                 // (also set catalog uniqeId)
1580                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1581                                 SERVICE_COMPONENT_TYPE);
1582                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1583                                 getAllCategoriesRest.getErrorCode().intValue());
1584                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1585                 // Audit validation
1586                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1587                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1588         }
1589
1590         @Test
1591         public void categoryNameValidationConjunctions_06() throws Exception { // Normalize
1592                                                                                                                                                         // the
1593                                                                                                                                                         // category
1594                                                                                                                                                         // name
1595                                                                                                                                                         // conjunctions
1596                                                                                                                                                         // ('of',
1597                                                                                                                                                         // 'to',
1598                                                                                                                                                         // 'for',
1599                                                                                                                                                         // 'as',
1600                                                                                                                                                         // 'a',
1601                                                                                                                                                         // 'an'
1602                                                                                                                                                         // ,
1603                                                                                                                                                         // 'the')
1604                                                                                                                                                         // are
1605                                                                                                                                                         // lower
1606                                                                                                                                                         // case.
1607                 categoryDefinition.setName(" eat AN apple ANAN");
1608                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1609                                 SERVICE_COMPONENT_TYPE);
1610                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1611                                 createCategotyRest.getErrorCode().intValue());
1612                 categoryDefinition.setName("Eat an Apple ANAN");
1613                 categoryDefinition.setNormalizedName("eat an apple anan");
1614                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1615                 // Get service category and validate that category added as defined
1616                 // (also set catalog uniqeId)
1617                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1618                                 SERVICE_COMPONENT_TYPE);
1619                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1620                                 getAllCategoriesRest.getErrorCode().intValue());
1621                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1622                 // Audit validation
1623                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1624                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1625         }
1626
1627         @Test
1628         public void categoryNameValidationConjunctions_07() throws Exception { // Normalize
1629                                                                                                                                                         // the
1630                                                                                                                                                         // category
1631                                                                                                                                                         // name
1632                                                                                                                                                         // conjunctions
1633                                                                                                                                                         // ('of',
1634                                                                                                                                                         // 'to',
1635                                                                                                                                                         // 'for',
1636                                                                                                                                                         // 'as',
1637                                                                                                                                                         // 'a',
1638                                                                                                                                                         // 'an'
1639                                                                                                                                                         // ,
1640                                                                                                                                                         // 'the')
1641                                                                                                                                                         // are
1642                                                                                                                                                         // lower
1643                                                                                                                                                         // case.
1644                 categoryDefinition.setName(" united states OF americA ");
1645                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1646                                 SERVICE_COMPONENT_TYPE);
1647                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1648                                 createCategotyRest.getErrorCode().intValue());
1649                 categoryDefinition.setName("United States of AmericA");
1650                 categoryDefinition.setNormalizedName("united states of america");
1651                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1652                 // Get service category and validate that category added as defined
1653                 // (also set catalog uniqeId)
1654                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1655                                 SERVICE_COMPONENT_TYPE);
1656                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1657                                 getAllCategoriesRest.getErrorCode().intValue());
1658                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1659                 // Audit validation
1660                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1661                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1662         }
1663
1664         // need to re-check
1665         @Test
1666         public void categoryNameValidationConjunctions_08() throws Exception { // Normalize
1667                                                                                                                                                         // the
1668                                                                                                                                                         // category
1669                                                                                                                                                         // name
1670                                                                                                                                                         // conjunctions
1671                                                                                                                                                         // ('of',
1672                                                                                                                                                         // 'to',
1673                                                                                                                                                         // 'for',
1674                                                                                                                                                         // 'as',
1675                                                                                                                                                         // 'a',
1676                                                                                                                                                         // 'an'
1677                                                                                                                                                         // ,
1678                                                                                                                                                         // 'the')
1679                                                                                                                                                         // are
1680                                                                                                                                                         // lower
1681                                                                                                                                                         // case.
1682                 categoryDefinition.setName(" oF united states OF amer ");
1683                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1684                                 SERVICE_COMPONENT_TYPE);
1685                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1686                                 createCategotyRest.getErrorCode().intValue());
1687                 categoryDefinition.setName("OF United States of Amer");
1688                 categoryDefinition.setNormalizedName("of united states of amer");
1689                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1690                 // Get service category and validate that category added as defined
1691                 // (also set catalog uniqeId)
1692                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1693                                 SERVICE_COMPONENT_TYPE);
1694                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1695                                 getAllCategoriesRest.getErrorCode().intValue());
1696                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1697                 // Audit validation
1698                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1699                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1700         }
1701
1702         @Test
1703         public void categoryNameValidationConjunctions_09() throws Exception { // Normalize
1704                                                                                                                                                         // the
1705                                                                                                                                                         // category
1706                                                                                                                                                         // name
1707                                                                                                                                                         // conjunctions
1708                                                                                                                                                         // ('of',
1709                                                                                                                                                         // 'to',
1710                                                                                                                                                         // 'for',
1711                                                                                                                                                         // 'as',
1712                                                                                                                                                         // 'a',
1713                                                                                                                                                         // 'an'
1714                                                                                                                                                         // ,
1715                                                                                                                                                         // 'the')
1716                                                                                                                                                         // are
1717                                                                                                                                                         // lower
1718                                                                                                                                                         // case.
1719                 categoryDefinition.setName(" to Apple TO at&T TOO ");
1720                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1721                                 SERVICE_COMPONENT_TYPE);
1722                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1723                                 createCategotyRest.getErrorCode().intValue());
1724                 categoryDefinition.setName("To Apple to At&T TOO");
1725                 categoryDefinition.setNormalizedName("to apple to at&t too");
1726                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1727                 // Get service category and validate that category added as defined
1728                 // (also set catalog uniqeId)
1729                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1730                                 SERVICE_COMPONENT_TYPE);
1731                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1732                                 getAllCategoriesRest.getErrorCode().intValue());
1733                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1734                 // Audit validation
1735                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1736                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1737         }
1738
1739         @Test
1740         public void categoryNameValidationConjunctions_10() throws Exception { // Normalize
1741                                                                                                                                                         // the
1742                                                                                                                                                         // category
1743                                                                                                                                                         // name
1744                                                                                                                                                         // conjunctions
1745                                                                                                                                                         // ('of',
1746                                                                                                                                                         // 'to',
1747                                                                                                                                                         // 'for',
1748                                                                                                                                                         // 'as',
1749                                                                                                                                                         // 'a',
1750                                                                                                                                                         // 'an'
1751                                                                                                                                                         // ,
1752                                                                                                                                                         // 'the')
1753                                                                                                                                                         // are
1754                                                                                                                                                         // lower
1755                                                                                                                                                         // case.
1756                 categoryDefinition.setName(" eat apple AS you liiikeas ");
1757                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1758                                 SERVICE_COMPONENT_TYPE);
1759                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1760                                 createCategotyRest.getErrorCode().intValue());
1761                 categoryDefinition.setName("Eat Apple as You Liiikeas");
1762                 categoryDefinition.setNormalizedName("eat apple as you liiikeas");
1763                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1764                 // Get service category and validate that category added as defined
1765                 // (also set catalog uniqeId)
1766                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1767                                 SERVICE_COMPONENT_TYPE);
1768                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1769                                 getAllCategoriesRest.getErrorCode().intValue());
1770                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1771                 // Audit validation
1772                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1773                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1774         }
1775
1776         @Test
1777         public void categoryNameValidationConjunctions_11() throws Exception { // Normalize
1778                                                                                                                                                         // the
1779                                                                                                                                                         // category
1780                                                                                                                                                         // name
1781                                                                                                                                                         // conjunctions
1782                                                                                                                                                         // ('of',
1783                                                                                                                                                         // 'to',
1784                                                                                                                                                         // 'for',
1785                                                                                                                                                         // 'as',
1786                                                                                                                                                         // 'a',
1787                                                                                                                                                         // 'an'
1788                                                                                                                                                         // ,
1789                                                                                                                                                         // 'the')
1790                                                                                                                                                         // are
1791                                                                                                                                                         // lower
1792                                                                                                                                                         // case.
1793                 categoryDefinition.setName(" as you may want ");
1794                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1795                                 SERVICE_COMPONENT_TYPE);
1796                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1797                                 createCategotyRest.getErrorCode().intValue());
1798                 categoryDefinition.setName("As You May Want");
1799                 categoryDefinition.setNormalizedName("as you may want");
1800                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1801                 // Get service category and validate that category added as defined
1802                 // (also set catalog uniqeId)
1803                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1804                                 SERVICE_COMPONENT_TYPE);
1805                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1806                                 getAllCategoriesRest.getErrorCode().intValue());
1807                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1808                 // Audit validation
1809                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1810                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1811         }
1812
1813         @Test
1814         public void categoryNameValidationConjunctions_12() throws Exception { // Normalize
1815                                                                                                                                                         // the
1816                                                                                                                                                         // category
1817                                                                                                                                                         // name
1818                                                                                                                                                         // conjunctions
1819                                                                                                                                                         // ('of',
1820                                                                                                                                                         // 'to',
1821                                                                                                                                                         // 'for',
1822                                                                                                                                                         // 'as',
1823                                                                                                                                                         // 'a',
1824                                                                                                                                                         // 'an'
1825                                                                                                                                                         // ,
1826                                                                                                                                                         // 'the')
1827                                                                                                                                                         // are
1828                                                                                                                                                         // lower
1829                                                                                                                                                         // case.
1830                 categoryDefinition.setName(" the bank OF america ");
1831                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1832                                 SERVICE_COMPONENT_TYPE);
1833                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1834                                 createCategotyRest.getErrorCode().intValue());
1835                 categoryDefinition.setName("The Bank of America");
1836                 categoryDefinition.setNormalizedName("the bank of america");
1837                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1838                 // Get service category and validate that category added as defined
1839                 // (also set catalog uniqeId)
1840                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1841                                 SERVICE_COMPONENT_TYPE);
1842                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1843                                 getAllCategoriesRest.getErrorCode().intValue());
1844                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1845                 // Audit validation
1846                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1847                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1848         }
1849
1850         // need to recheck
1851         @Test
1852         public void categoryNameValidationConjunctions_13() throws Exception { // Normalize
1853                                                                                                                                                         // the
1854                                                                                                                                                         // category
1855                                                                                                                                                         // name
1856                                                                                                                                                         // conjunctions
1857                                                                                                                                                         // ('of',
1858                                                                                                                                                         // 'to',
1859                                                                                                                                                         // 'for',
1860                                                                                                                                                         // 'as',
1861                                                                                                                                                         // 'a',
1862                                                                                                                                                         // 'an'
1863                                                                                                                                                         // ,
1864                                                                                                                                                         // 'the')
1865                                                                                                                                                         // are
1866                                                                                                                                                         // lower
1867                                                                                                                                                         // case.
1868                 categoryDefinition.setName("  To tel-toto ");
1869                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1870                                 SERVICE_COMPONENT_TYPE);
1871                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1872                                 createCategotyRest.getErrorCode().intValue());
1873                 categoryDefinition.setName("To Tel-toto");
1874                 categoryDefinition.setNormalizedName("to tel-toto");
1875                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1876                 // Get service category and validate that category added as defined
1877                 // (also set catalog uniqeId)
1878                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1879                                 SERVICE_COMPONENT_TYPE);
1880                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1881                                 getAllCategoriesRest.getErrorCode().intValue());
1882                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1883                 // Audit validation
1884                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1885                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1886         }
1887
1888         // recheck
1889         @Test
1890         public void categoryNameValidationConjunctions_14() throws Exception { // Normalize
1891                                                                                                                                                         // the
1892                                                                                                                                                         // category
1893                                                                                                                                                         // name
1894                                                                                                                                                         // conjunctions
1895                                                                                                                                                         // ('of',
1896                                                                                                                                                         // 'to',
1897                                                                                                                                                         // 'for',
1898                                                                                                                                                         // 'as',
1899                                                                                                                                                         // 'a',
1900                                                                                                                                                         // 'an'
1901                                                                                                                                                         // ,
1902                                                                                                                                                         // 'the')
1903                                                                                                                                                         // are
1904                                                                                                                                                         // lower
1905                                                                                                                                                         // case.
1906                 categoryDefinition.setName("   tel-aviv To   la ");
1907                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
1908                                 SERVICE_COMPONENT_TYPE);
1909                 assertEquals("Check response code after create Category", STATUS_CODE_CREATED,
1910                                 createCategotyRest.getErrorCode().intValue());
1911                 categoryDefinition.setName("Tel-aviv to La");
1912                 categoryDefinition.setNormalizedName("tel-aviv to la");
1913                 CategoryValidationUtils.validateCreateCategoryResponse(createCategotyRest, categoryDefinition);
1914                 // Get service category and validate that category added as defined
1915                 // (also set catalog uniqeId)
1916                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1917                                 SERVICE_COMPONENT_TYPE);
1918                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1919                                 getAllCategoriesRest.getErrorCode().intValue());
1920                 CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryDefinition);
1921                 // Audit validation
1922                 AuditValidationUtils.categoryAuditSuccess(ADD_CATEGORY, categoryDefinition, sdncAdminUserDetails,
1923                                 STATUS_CODE_CREATED, AUDIT_SERVICE_TYPE);
1924         }
1925
1926         @Test
1927         public void createServiceCategoryHttpCspUserIdIsEmpty() throws Exception {
1928                 User sdncAdminUserDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
1929                 sdncAdminUserDetails1.setUserId("");
1930                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1931                                 SERVICE_COMPONENT_TYPE);
1932                 assertEquals("Check response code after create Consumer", STATUS_CODE_MISSING_INFORMATION,
1933                                 createCategotyRest.getErrorCode().intValue());
1934                 categoryDefinition.setName("Abcd");
1935                 // get service category and validate that category was not added
1936                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1937                                 SERVICE_COMPONENT_TYPE);
1938                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1939                                 getAllCategoriesRest.getErrorCode().intValue());
1940                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1941                 // Audit validation
1942                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_INFORMATION.name());
1943                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
1944                 expectedCatrgoryAuditJavaObject.setAction(ADD_CATEGORY);
1945                 expectedCatrgoryAuditJavaObject.setModifier("");
1946                 expectedCatrgoryAuditJavaObject.setCategoryName(categoryDefinition.getName());
1947                 expectedCatrgoryAuditJavaObject.setSubCategoryName("");
1948                 expectedCatrgoryAuditJavaObject.setGroupingName("");
1949                 expectedCatrgoryAuditJavaObject.setResourceType(AUDIT_SERVICE_TYPE);
1950                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_MISSING_INFORMATION));
1951                 expectedCatrgoryAuditJavaObject.setDesc(errorInfo.getAuditDesc());
1952                 AuditValidationUtils.validateCategoryAudit(expectedCatrgoryAuditJavaObject, ADD_CATEGORY);
1953         }
1954
1955         @Test
1956         public void createServiceCategorHttpCspUserIdIsNull() throws Exception {
1957                 User sdncAdminUserDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
1958                 sdncAdminUserDetails1.setUserId(null);
1959                 RestResponse createCategotyRest = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails1,
1960                                 SERVICE_COMPONENT_TYPE);
1961                 assertEquals("Check response code after create Consumer", STATUS_CODE_MISSING_INFORMATION,
1962                                 createCategotyRest.getErrorCode().intValue());
1963                 categoryDefinition.setName("Abcd");
1964                 // get service category and validate that category was not added
1965                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1966                                 SERVICE_COMPONENT_TYPE);
1967                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1968                                 getAllCategoriesRest.getErrorCode().intValue());
1969                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1970                 // Audit validation
1971                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_INFORMATION.name());
1972                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
1973                 expectedCatrgoryAuditJavaObject.setAction(ADD_CATEGORY);
1974                 expectedCatrgoryAuditJavaObject.setModifier("");
1975                 expectedCatrgoryAuditJavaObject.setCategoryName(categoryDefinition.getName());
1976                 expectedCatrgoryAuditJavaObject.setSubCategoryName("");
1977                 expectedCatrgoryAuditJavaObject.setGroupingName("");
1978                 expectedCatrgoryAuditJavaObject.setResourceType(AUDIT_SERVICE_TYPE);
1979                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_MISSING_INFORMATION));
1980                 expectedCatrgoryAuditJavaObject.setDesc(errorInfo.getAuditDesc());
1981                 AuditValidationUtils.validateCategoryAudit(expectedCatrgoryAuditJavaObject, ADD_CATEGORY);
1982         }
1983
1984         @Test
1985         public void createSrvcCategoryHttpCspUserIdHeaderIsMissing() throws Exception {
1986                 RestResponse createConsumerRest = CategoryRestUtils
1987                                 .createServiceCategoryHttpCspAtuUidIsMissing(categoryDefinition, sdncAdminUserDetails);
1988                 assertEquals("Check response code after create Consumer", STATUS_CODE_MISSING_INFORMATION,
1989                                 createConsumerRest.getErrorCode().intValue());
1990                 categoryDefinition.setName("Abcd");
1991                 // get service category and validate that category was not added
1992                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
1993                                 SERVICE_COMPONENT_TYPE);
1994                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
1995                                 getAllCategoriesRest.getErrorCode().intValue());
1996                 CategoryValidationUtils.verifyCategoryNotExistsInGetResponse(getAllCategoriesRest, categoryDefinition);
1997                 // Audit validation
1998                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_INFORMATION.name());
1999                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
2000                 expectedCatrgoryAuditJavaObject.setAction(ADD_CATEGORY);
2001                 expectedCatrgoryAuditJavaObject.setModifier("");
2002                 expectedCatrgoryAuditJavaObject.setCategoryName(categoryDefinition.getName());
2003                 expectedCatrgoryAuditJavaObject.setSubCategoryName("");
2004                 expectedCatrgoryAuditJavaObject.setGroupingName("");
2005                 expectedCatrgoryAuditJavaObject.setResourceType(AUDIT_SERVICE_TYPE);
2006                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_MISSING_INFORMATION));
2007                 expectedCatrgoryAuditJavaObject.setDesc(errorInfo.getAuditDesc());
2008                 AuditValidationUtils.validateCategoryAudit(expectedCatrgoryAuditJavaObject, ADD_CATEGORY);
2009         }
2010
2011         @Test
2012         public void getServiceCategoryHierarchySuccessFlow() throws Exception {
2013
2014                 int numOfCategories = 3;
2015                 List<CategoryDefinition> categories = new ArrayList<CategoryDefinition>();
2016                 RestResponse restResponse;
2017                 CategoryDefinition category;
2018                 String categoryName = categoryDefinition.getName();
2019                 for (int i = 0; i < numOfCategories; i++) {
2020                         categoryDefinition.setName(categoryName + i);
2021                         restResponse = CategoryRestUtils.createCategory(categoryDefinition, sdncAdminUserDetails,
2022                                         SERVICE_COMPONENT_TYPE);
2023                         category = ResponseParser.parseToObject(restResponse.getResponse(), CategoryDefinition.class);
2024                         categories.add(category);
2025                 }
2026                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
2027                                 SERVICE_COMPONENT_TYPE);
2028                 assertEquals("Check response code after get all categories ", STATUS_CODE_SUCCESS,
2029                                 getAllCategoriesRest.getErrorCode().intValue());
2030
2031                 AuditValidationUtils.GetCategoryHierarchyAuditSuccess(GET_CATEGORY_HIERARCHY, AUDIT_SERVICE_TYPE,
2032                                 sdncAdminUserDetails, STATUS_CODE_SUCCESS);
2033                 for (CategoryDefinition categoryCurr : categories) {
2034                         CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryCurr);
2035                 }
2036         }
2037
2038         ///////////////////////////////// US570520 /////////////////////////////////
2039         private List<CategoryDefinition> defineCategories() throws Exception {
2040                 String firstCategory = "FirstCategory";
2041                 String secondCategory = "secondCategory";
2042                 String thirdCategory = "ThirdCategory";
2043                 String forthCategory = "forthCategory";
2044                 CategoryDefinition category1 = new CategoryDefinition(categoryDefinition);
2045                 category1.setName(firstCategory);
2046                 CategoryDefinition category2 = new CategoryDefinition(categoryDefinition);
2047                 category2.setName(secondCategory);
2048                 CategoryDefinition category3 = new CategoryDefinition(categoryDefinition);
2049                 category3.setName(thirdCategory);
2050                 CategoryDefinition category4 = new CategoryDefinition(categoryDefinition);
2051                 category4.setName(forthCategory);
2052                 ArrayList<CategoryDefinition> categoryList = new ArrayList<CategoryDefinition>();
2053                 categoryList.add(category1);
2054                 categoryList.add(category2);
2055                 categoryList.add(category3);
2056                 categoryList.add(category4);
2057                 return categoryList;
2058         }
2059
2060         @Test
2061         public void getAllResourceCategoriesHirarchy() throws Exception {
2062                 createAndValidateCategoriesExist(RESOURCE_COMPONENT_TYPE, categoryList);
2063
2064                 for (int i = 0; i < categoryList.size(); i++) {
2065                         List<String> subCategorieUniqueIdList = new ArrayList<String>();
2066                         for (int j = 0; j < subCategoryList.size(); j++) {
2067                                 RestResponse createSubCategory = CategoryRestUtils.createSubCategory(subCategoryList.get(j),
2068                                                 categoryList.get(i), sdncAdminUserDetails, RESOURCE_COMPONENT_TYPE);
2069                                 if (createSubCategory.getErrorCode().intValue() == STATUS_CODE_CREATED) {
2070                                         String subCategoryUniqeId = ResponseParser.getUniqueIdFromResponse(createSubCategory);
2071                                         subCategorieUniqueIdList.add(subCategoryUniqeId);
2072                                         subCategoriesToDeleteMap.put(categoryList.get(i).getUniqueId(), subCategorieUniqueIdList);
2073                                 }
2074                         }
2075                 }
2076
2077                 DbUtils.deleteFromEsDbByPattern("_all");
2078                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
2079                                 RESOURCE_COMPONENT_TYPE);
2080                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
2081                                 getAllCategoriesRest.getErrorCode().intValue());
2082
2083                 for (int i = 0; i < categoryList.size(); i++) {
2084                         for (int j = 0; j < subCategoryList.size(); j++) {
2085                                 CategoryValidationUtils.verifySubCategoryExistInGetResponse(getAllCategoriesRest,
2086                                                 categoryList.get(i).getUniqueId(), subCategoryList.get(j));
2087                         }
2088                 }
2089
2090                 checkAuditSuccess(RESOURCE_COMPONENT_TYPE);
2091         }
2092
2093         private List<SubCategoryDefinition> defineSubCategories(int catListSize) {
2094                 List<SubCategoryDefinition> subCatList = new ArrayList<SubCategoryDefinition>();
2095                 for (int j = 1; j <= catListSize; j++) {
2096                         SubCategoryDefinition subCategory = new SubCategoryDefinition();
2097                         subCategory.setName("SubCategory" + String.valueOf(j));
2098                         subCatList.add(subCategory);
2099                 }
2100                 return subCatList;
2101         }
2102
2103         private void createAndValidateCategoriesExist(String comp, List<CategoryDefinition> categoryList) throws Exception {
2104                 createCategories(comp, categoryList);
2105                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, comp);
2106                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
2107                                 getAllCategoriesRest.getErrorCode().intValue());
2108                 verifyCategoriesExist(categoryList, getAllCategoriesRest);
2109         }
2110
2111         private void verifyCategoriesExist(List<CategoryDefinition> categoryList, RestResponse getAllCategoriesRest) {
2112                 for (int i = 0; i < categoryList.size(); i++) {
2113                         categoryList.get(i).setName(WordUtils.capitalize(categoryList.get(i).getName()));
2114                         CategoryValidationUtils.verifyCategoryExistInGetResponse(getAllCategoriesRest, categoryList.get(i));
2115                 }
2116         }
2117
2118         private void createCategories(String comp, List<CategoryDefinition> categoryList) throws Exception {
2119                 for (int i = 0; i < categoryList.size(); i++) {
2120                         CategoryRestUtils.createCategory(categoryList.get(i), sdncAdminUserDetails, comp);
2121                 }
2122         }
2123
2124         @Test
2125         public void getAllServiceCategoriesHirarchy() throws Exception {
2126                 // deleteCategories(categoryList, SERVICE_COMPONENT_TYPE);
2127                 createAndValidateCategoriesExist(SERVICE_COMPONENT_TYPE, categoryList);
2128                 checkAuditSuccess(SERVICE_COMPONENT_TYPE);
2129                 // deleteCategories(categoryList, SERVICE_COMPONENT_TYPE);
2130         }
2131
2132         @Test
2133         public void getAllResourceCategories_noAttUserHeader() throws Exception {
2134                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(new User(), RESOURCE_COMPONENT_TYPE);
2135                 assertEquals("Check response code after get Category", 403, getAllCategoriesRest.getErrorCode().intValue());
2136                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.MISSING_INFORMATION.name(), new ArrayList<String>(),
2137                                 getAllCategoriesRest.getResponse());
2138
2139                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.MISSING_INFORMATION.name());
2140                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
2141                 expectedCatrgoryAuditJavaObject.setAction(GET_CATEGORY_HIERARCHY);
2142                 expectedCatrgoryAuditJavaObject.setModifierName("");
2143                 expectedCatrgoryAuditJavaObject.setModifierUid("");
2144                 expectedCatrgoryAuditJavaObject.setDetails(RESOURCE_COMPONENT_TYPE);
2145                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_MISSING_INFORMATION));
2146                 expectedCatrgoryAuditJavaObject.setDesc(errorInfo.getAuditDesc());
2147                 AuditValidationUtils.validateGetCategoryHirarchy(expectedCatrgoryAuditJavaObject, GET_CATEGORY_HIERARCHY);
2148         }
2149
2150         @Test
2151         public void getAllResourceCategories_userNotProvisioned() throws Exception {
2152                 User notProvisionedUser = new User();
2153                 notProvisionedUser.setUserId("aa0001");
2154                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(notProvisionedUser,
2155                                 RESOURCE_COMPONENT_TYPE);
2156                 assertEquals("Check response code after get Category", 409, getAllCategoriesRest.getErrorCode().intValue());
2157                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.RESTRICTED_OPERATION.name(), new ArrayList<String>(),
2158                                 getAllCategoriesRest.getResponse());
2159
2160                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.RESTRICTED_OPERATION.name());
2161                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
2162                 expectedCatrgoryAuditJavaObject.setAction(GET_CATEGORY_HIERARCHY);
2163                 expectedCatrgoryAuditJavaObject.setModifierName("");
2164                 expectedCatrgoryAuditJavaObject.setModifierUid(notProvisionedUser.getUserId());
2165                 expectedCatrgoryAuditJavaObject.setDetails(RESOURCE_COMPONENT_TYPE);
2166                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_RESTRICTED_OPERATION));
2167                 expectedCatrgoryAuditJavaObject.setDesc(errorInfo.getAuditDesc());
2168                 AuditValidationUtils.validateGetCategoryHirarchy(expectedCatrgoryAuditJavaObject, GET_CATEGORY_HIERARCHY);
2169         }
2170
2171         @Test
2172         public void getAllResourceCategories_unsupportedComponent() throws Exception {
2173                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, "comp");
2174                 assertEquals("Check response code after get all categories hirarchy", 400,
2175                                 getAllCategoriesRest.getErrorCode().intValue());
2176                 ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.UNSUPPORTED_ERROR.name(),
2177                                 new ArrayList<String>(Arrays.asList("component type")), getAllCategoriesRest.getResponse());
2178
2179                 ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.UNSUPPORTED_ERROR.name());
2180                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
2181                 expectedCatrgoryAuditJavaObject.setAction(GET_CATEGORY_HIERARCHY);
2182                 expectedCatrgoryAuditJavaObject.setModifierUid(sdncAdminUserDetails.getUserId());
2183                 expectedCatrgoryAuditJavaObject.setModifierName(sdncAdminUserDetails.getFullName());
2184                 expectedCatrgoryAuditJavaObject.setDetails("comp");
2185                 expectedCatrgoryAuditJavaObject.setStatus(String.valueOf(STATUS_CODE_INVALID_CONTENT));
2186                 expectedCatrgoryAuditJavaObject.setDesc(AuditValidationUtils.buildAuditDescription(errorInfo,
2187                                 new ArrayList<String>(Arrays.asList("component type"))));
2188                 AuditValidationUtils.validateGetCategoryHirarchy(expectedCatrgoryAuditJavaObject, GET_CATEGORY_HIERARCHY);
2189         }
2190
2191         @Test(enabled = false)
2192         public void getAllResourceCategories_emptyList() throws Exception {
2193                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
2194                                 RESOURCE_COMPONENT_TYPE);
2195                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
2196                                 getAllCategoriesRest.getErrorCode().intValue());
2197                 JSONArray jArr = new JSONArray(getAllCategoriesRest.getResponse());
2198                 assertTrue(jArr.length() == 0);
2199
2200                 checkAuditSuccess(RESOURCE_COMPONENT_TYPE);
2201         }
2202
2203         private void checkAuditSuccess(String componentType) throws Exception {
2204                 ExpectedCategoryAudit expectedCatrgoryAuditJavaObject = new ExpectedCategoryAudit();
2205                 expectedCatrgoryAuditJavaObject.setAction(GET_CATEGORY_HIERARCHY);
2206                 expectedCatrgoryAuditJavaObject.setModifierName(sdncAdminUserDetails.getFullName());
2207                 expectedCatrgoryAuditJavaObject.setModifierUid(sdncAdminUserDetails.getUserId());
2208                 expectedCatrgoryAuditJavaObject.setDetails(componentType);
2209                 expectedCatrgoryAuditJavaObject.setStatus("200");
2210                 expectedCatrgoryAuditJavaObject.setDesc("OK");
2211                 AuditValidationUtils.validateGetCategoryHirarchy(expectedCatrgoryAuditJavaObject, GET_CATEGORY_HIERARCHY);
2212         }
2213
2214         @Test(enabled = false)
2215         public void getAllServiceCategories_emptyList() throws Exception {
2216                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
2217                                 SERVICE_COMPONENT_TYPE);
2218                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
2219                                 getAllCategoriesRest.getErrorCode().intValue());
2220                 JSONArray jArr = new JSONArray(getAllCategoriesRest.getResponse());
2221                 assertTrue(jArr.length() == 0);
2222
2223                 checkAuditSuccess(SERVICE_COMPONENT_TYPE);
2224         }
2225
2226         @Test(enabled = false)
2227         public void getAllProductCategories_emptyList() throws Exception {
2228                 RestResponse getAllCategoriesRest = CategoryRestUtils.getAllCategories(sdncAdminUserDetails,
2229                                 PRODUCT_COMPONENT_TYPE);
2230                 assertEquals("Check response code after get Category", STATUS_CODE_SUCCESS,
2231                                 getAllCategoriesRest.getErrorCode().intValue());
2232                 JSONArray jArr = new JSONArray(getAllCategoriesRest.getResponse());
2233                 assertTrue(jArr.length() == 0);
2234
2235                 checkAuditSuccess(PRODUCT_COMPONENT_TYPE);
2236         }
2237
2238         // @Test
2239         // public void getAllResourceCategories_generalError() throws Exception
2240         // {
2241         // User user = new User();
2242         // RestResponse getAllCategoriesRest =
2243         // CategoryRestUtils.getAllCategories(user, SERVICE_COMPONENT_TYPE);
2244         // assertEquals("Check response code after get Category", 500,
2245         // getAllCategoriesRest.getErrorCode().intValue());
2246         // Utils.checkBodyResponseOnError(ActionStatus.GENERAL_ERROR.name(), new
2247         // ArrayList<String>(), getAllCategoriesRest.getResponse());
2248         // }
2249
2250         //////////////////////////////////////////////////////////////////////////////
2251
2252         @Test
2253         public void importCategories() throws Exception {
2254
2255                 String importResourceDir = config.getImportTypesConfigDir() + File.separator + "categoryTypesTest.zip";
2256
2257                 MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
2258                 mpBuilder.addPart("categoriesZip", new FileBody(new File(importResourceDir)));
2259
2260                 RestResponse importResult = CategoryRestUtils.importCategories(mpBuilder, sdncAdminUserDetails.getUserId());
2261                 assertEquals("Check response code after Import", BaseRestUtils.STATUS_CODE_CREATED,
2262                                 importResult.getErrorCode().intValue());
2263
2264                 Map<String, Object> map = ResponseParser.parseToObjectUsingMapper(importResult.getResponse(), Map.class);
2265                 assertEquals("Check  entries count", 2, map.size());
2266
2267                 List<Map<String, Object>> resources = (List<Map<String, Object>>) map.get("resources");
2268                 assertEquals("Check resource category  entries count", 1, resources.size());
2269
2270                 List<Map<String, Object>> services = (List<Map<String, Object>>) map.get("services");
2271                 assertEquals("Check resource category  entries count", 2, services.size());
2272
2273                 RestResponse allCategories = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, "resources");
2274                 List<CategoryDefinition> resourceCategories = ResponseParser.parseCategories(allCategories);
2275                 for (Map<String, Object> resource : resources) {
2276                         boolean exist = false;
2277
2278                         for (CategoryDefinition categ : resourceCategories) {
2279                                 if (categ.getName().equals(resource.get("name"))) {
2280                                         exist = true;
2281                                         break;
2282                                 }
2283                         }
2284                         assertTrue("Check existance resource category  " + resource.get("name"), exist);
2285                 }
2286
2287                 allCategories = CategoryRestUtils.getAllCategories(sdncAdminUserDetails, "services");
2288                 List<CategoryDefinition> servicesCategories = ResponseParser.parseCategories(allCategories);
2289                 for (Map<String, Object> service : services) {
2290                         boolean exist = false;
2291
2292                         for (CategoryDefinition categ : servicesCategories) {
2293                                 if (categ.getName().equals(service.get("name"))) {
2294                                         exist = true;
2295                                         break;
2296                                 }
2297                         }
2298                         assertTrue("Check existance service category  " + service.get("name"), exist);
2299                 }
2300         }
2301 }