2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 * Modifications copyright (c) 2019 Nokia
20 * ================================================================================
23 package org.openecomp.sdc.be.servlets;
25 import static org.assertj.core.api.Assertions.assertThat;
26 import static org.mockito.ArgumentMatchers.any;
27 import static org.mockito.ArgumentMatchers.eq;
28 import static org.mockito.Mockito.reset;
29 import static org.mockito.Mockito.when;
31 import fj.data.Either;
32 import java.util.ArrayList;
33 import java.util.HashMap;
34 import java.util.List;
36 import javax.servlet.ServletContext;
37 import javax.servlet.http.HttpServletRequest;
38 import javax.servlet.http.HttpSession;
39 import javax.ws.rs.client.Entity;
40 import javax.ws.rs.core.Application;
41 import javax.ws.rs.core.MediaType;
42 import javax.ws.rs.core.Response;
43 import org.apache.commons.text.StrSubstitutor;
44 import org.apache.http.HttpStatus;
45 import org.glassfish.hk2.utilities.binding.AbstractBinder;
46 import org.glassfish.jersey.server.ResourceConfig;
47 import org.glassfish.jersey.test.JerseyTest;
48 import org.glassfish.jersey.test.TestProperties;
49 import org.junit.jupiter.api.AfterEach;
50 import org.junit.jupiter.api.BeforeAll;
51 import org.junit.jupiter.api.BeforeEach;
52 import org.junit.jupiter.api.Test;
53 import org.mockito.Mockito;
54 import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
55 import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
56 import org.openecomp.sdc.be.components.impl.ElementBusinessLogic;
57 import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
58 import org.openecomp.sdc.be.components.impl.ResourceImportManager;
59 import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException;
60 import org.openecomp.sdc.be.components.impl.exceptions.ComponentException;
61 import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLogic;
62 import org.openecomp.sdc.be.config.Configuration;
63 import org.openecomp.sdc.be.config.ConfigurationManager;
64 import org.openecomp.sdc.be.config.SpringConfig;
65 import org.openecomp.sdc.be.dao.api.ActionStatus;
66 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
67 import org.openecomp.sdc.be.impl.ComponentsUtils;
68 import org.openecomp.sdc.be.impl.ServletUtils;
69 import org.openecomp.sdc.be.impl.WebAppContextWrapper;
70 import org.openecomp.sdc.be.model.ArtifactType;
71 import org.openecomp.sdc.be.model.PropertyScope;
72 import org.openecomp.sdc.be.model.Resource;
73 import org.openecomp.sdc.be.model.Tag;
74 import org.openecomp.sdc.be.model.User;
75 import org.openecomp.sdc.be.model.catalog.CatalogComponent;
76 import org.openecomp.sdc.be.model.category.CategoryDefinition;
77 import org.openecomp.sdc.be.model.category.GroupingDefinition;
78 import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
79 import org.openecomp.sdc.be.ui.model.UiCategories;
80 import org.openecomp.sdc.be.user.Role;
81 import org.openecomp.sdc.be.user.UserBusinessLogic;
82 import org.openecomp.sdc.common.api.ConfigurationSource;
83 import org.openecomp.sdc.common.api.Constants;
84 import org.openecomp.sdc.common.impl.ExternalConfiguration;
85 import org.openecomp.sdc.common.impl.FSConfigurationSource;
86 import org.openecomp.sdc.exception.ResponseFormat;
87 import org.springframework.context.ApplicationContext;
88 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
89 import org.springframework.web.context.WebApplicationContext;
91 class ElementServletTest extends JerseyTest {
93 public static final HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
94 public static final HttpSession session = Mockito.mock(HttpSession.class);
95 public static final ResourceImportManager resourceImportManager = Mockito.mock(ResourceImportManager.class);
96 public static final ResourceBusinessLogic resourceBusinessLogic = Mockito.mock(ResourceBusinessLogic.class);
97 public static final BeGenericServlet beGenericServlet = Mockito.mock(BeGenericServlet.class);
98 public static final Resource resource = Mockito.mock(Resource.class);
99 public static final UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class);
100 public static final ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito
101 .mock(ComponentInstanceBusinessLogic.class);
102 public static final ArtifactsBusinessLogic artifactsBusinessLogic = Mockito.mock(ArtifactsBusinessLogic.class);
104 private static final ServletContext servletContext = Mockito.mock(ServletContext.class);
105 public static final WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class);
106 private static final WebApplicationContext webApplicationContext = Mockito.mock(WebApplicationContext.class);
107 private static final ServletUtils servletUtils = Mockito.mock(ServletUtils.class);
108 private static final UserBusinessLogic userAdmin = Mockito.mock(UserBusinessLogic.class);
109 private static final ComponentsUtils componentUtils = Mockito.mock(ComponentsUtils.class);
110 private static final ComponentsCleanBusinessLogic componentsCleanBusinessLogic = Mockito
111 .mock(ComponentsCleanBusinessLogic.class);
112 private static final ElementBusinessLogic elementBusinessLogic = Mockito.mock(ElementBusinessLogic.class);
114 private static final ResponseFormat okResponseFormat = new ResponseFormat(HttpStatus.SC_OK);
115 private static final ResponseFormat conflictResponseFormat = new ResponseFormat(HttpStatus.SC_CONFLICT);
116 private static final ResponseFormat generalErrorResponseFormat = new ResponseFormat(
117 HttpStatus.SC_INTERNAL_SERVER_ERROR);
118 private static final ResponseFormat createdResponseFormat = new ResponseFormat(HttpStatus.SC_CREATED);
119 private static final ResponseFormat noContentResponseFormat = new ResponseFormat(HttpStatus.SC_NO_CONTENT);
120 private static final ResponseFormat unauthorizedResponseFormat = Mockito.mock(ResponseFormat.class);
121 private static final ResponseFormat notFoundResponseFormat = Mockito.mock(ResponseFormat.class);
122 private static final ResponseFormat badRequestResponseFormat = Mockito.mock(ResponseFormat.class);
123 private static final String EMPTY_JSON = "{}";
124 private static final String COMPONENT_TYPE = "componentType";
125 private static final String CATEGORY_UNIQUE_ID = "categoryUniqueId";
126 private static final String CATEGORY_ID = "categoryId";
127 private static final String SUB_CATEGORY_UNIQUE_ID = "subCategoryUniqueId";
128 private static final String SUB_CATEGORY_ID = "subCategoryId";
129 private static final String GROUPING_UNIQUE_ID = "groupingUniqueId";
132 private static User designerUser = new User("designer", "designer", "designer", "designer@email.com",
133 Role.DESIGNER.name(), System
134 .currentTimeMillis());
136 private static ConfigurationManager configurationManager;
139 public static void setup() {
141 //Needed for User Authorization
142 when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR))
143 .thenReturn(webAppContextWrapper);
144 when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webApplicationContext);
145 when(webApplicationContext.getBean(ServletUtils.class)).thenReturn(servletUtils);
146 when(servletUtils.getUserAdmin()).thenReturn(userAdmin);
147 when(servletUtils.getComponentsUtils()).thenReturn(componentUtils);
148 when(componentUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION))
149 .thenReturn(unauthorizedResponseFormat);
150 when(unauthorizedResponseFormat.getStatus()).thenReturn(HttpStatus.SC_UNAUTHORIZED);
152 when(componentUtils.getResponseFormat(ActionStatus.OK)).thenReturn(okResponseFormat);
153 when(componentUtils.getResponseFormat(ActionStatus.CREATED)).thenReturn(createdResponseFormat);
154 when(componentUtils.getResponseFormat(ActionStatus.NO_CONTENT)).thenReturn(noContentResponseFormat);
155 when(componentUtils.getResponseFormat(ActionStatus.INVALID_CONTENT)).thenReturn(badRequestResponseFormat);
156 when(componentUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(generalErrorResponseFormat);
157 when(componentUtils.getResponseFormat(any(ComponentException.class)))
158 .thenReturn(generalErrorResponseFormat);
160 ByResponseFormatComponentException ce = Mockito.mock(ByResponseFormatComponentException.class);
161 when(ce.getResponseFormat()).thenReturn(unauthorizedResponseFormat);
163 //Needed for error configuration
164 when(notFoundResponseFormat.getStatus()).thenReturn(HttpStatus.SC_NOT_FOUND);
165 when(badRequestResponseFormat.getStatus()).thenReturn(HttpStatus.SC_BAD_REQUEST);
166 when(componentUtils.getResponseFormat(eq(ActionStatus.RESOURCE_NOT_FOUND), any()))
167 .thenReturn(notFoundResponseFormat);
168 when(componentUtils.getResponseFormat(eq(ActionStatus.COMPONENT_VERSION_NOT_FOUND), any()))
169 .thenReturn(notFoundResponseFormat);
170 when(componentUtils.getResponseFormat(eq(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND), any()))
171 .thenReturn(notFoundResponseFormat);
172 when(componentUtils.getResponseFormat(eq(ActionStatus.EXT_REF_NOT_FOUND), any()))
173 .thenReturn(notFoundResponseFormat);
174 when(componentUtils.getResponseFormat(eq(ActionStatus.MISSING_X_ECOMP_INSTANCE_ID), any()))
175 .thenReturn(badRequestResponseFormat);
176 when(request.getSession()).thenReturn(session);
177 when(session.getServletContext()).thenReturn(servletContext);
178 when(beGenericServlet.getElementBL(any())).thenReturn(elementBusinessLogic);
179 when(webApplicationContext.getBean(ElementBusinessLogic.class)).thenReturn(elementBusinessLogic);
180 when(webApplicationContext.getBean(ComponentsUtils.class)).thenReturn(componentUtils);
181 when(beGenericServlet.getComponentsUtils()).thenReturn(componentUtils);
183 Either<User, ActionStatus> designerEither = Either.left(designerUser);
185 when(userAdmin.getUser(designerUser.getUserId(), false)).thenReturn(designerUser);
187 String appConfigDir = "src/test/resources/config/catalog-be";
188 ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
190 configurationManager = new ConfigurationManager(configurationSource);
192 org.openecomp.sdc.be.config.Configuration configuration = new org.openecomp.sdc.be.config.Configuration();
193 configuration.setJanusGraphInMemoryGraph(true);
194 Configuration.HeatDeploymentArtifactTimeout testHeatDeploymentArtifactTimeout = new Configuration.HeatDeploymentArtifactTimeout();
195 testHeatDeploymentArtifactTimeout.setDefaultMinutes(1);
196 configuration.setHeatArtifactDeploymentTimeout(testHeatDeploymentArtifactTimeout);
198 configurationManager.setConfiguration(configuration);
199 ExternalConfiguration.setAppName("catalog-be");
205 public void before() throws Exception {
207 reset(elementBusinessLogic);
211 public void tearDown() throws Exception {
216 void getComponentCategoriesNoCategoryFoundTest() {
217 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
218 Map<String, String> parametersMap = new HashMap<>();
219 parametersMap.put(COMPONENT_TYPE, componentType);
221 String formatEndpoint = "/v1/categories/{componentType}";
222 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
224 ResponseFormat notFoundResponseFormat = new ResponseFormat(HttpStatus.SC_NOT_FOUND);
225 Either<List<CategoryDefinition>, ResponseFormat> getAllCategoriesEither = Either.right(notFoundResponseFormat);
227 when(elementBusinessLogic.getAllCategories(componentType, designerUser.getUserId()))
228 .thenReturn(getAllCategoriesEither);
230 Response response = target()
233 .accept(MediaType.APPLICATION_JSON)
234 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
237 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
241 void getComponentCategoriesExceptionDuringProcessingTest() {
242 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
243 Map<String, String> parametersMap = new HashMap<>();
244 parametersMap.put(COMPONENT_TYPE, componentType);
246 String formatEndpoint = "/v1/categories/{componentType}";
247 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
249 when(elementBusinessLogic.getAllCategories(componentType, designerUser.getUserId()))
250 .thenThrow(new RuntimeException("Test exception: getComponentCategories"));
252 Response response = target()
255 .accept(MediaType.APPLICATION_JSON)
256 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
259 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
263 void getComponentCategoriesTest() {
264 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
265 Map<String, String> parametersMap = new HashMap<>();
266 parametersMap.put(COMPONENT_TYPE, componentType);
268 String formatEndpoint = "/v1/categories/{componentType}";
269 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
271 Either<List<CategoryDefinition>, ResponseFormat> getAllCategoriesEither = Either.left(new ArrayList<>());
273 when(elementBusinessLogic.getAllCategories(componentType, designerUser.getUserId()))
274 .thenReturn(getAllCategoriesEither);
276 Response response = target()
279 .accept(MediaType.APPLICATION_JSON)
280 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
283 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
287 void getAllCategoriesNoCategoryFoundTest() {
288 String path = "/v1/categories";
290 ResponseFormat notFoundResponseFormat = new ResponseFormat(HttpStatus.SC_NOT_FOUND);
291 Either<UiCategories, ResponseFormat> getAllCategoriesEither = Either.right(notFoundResponseFormat);
293 when(elementBusinessLogic.getAllCategories(designerUser.getUserId()))
294 .thenReturn(getAllCategoriesEither);
296 Response response = target()
299 .accept(MediaType.APPLICATION_JSON)
300 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
303 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
307 void getAllCategoriesExceptionDuringProcessingTest() {
308 String path = "/v1/setup/ui";
309 when(elementBusinessLogic.getAllCategories(designerUser.getUserId()))
310 .thenThrow(new RuntimeException("Test exception: getAllCategories"));
312 Response response = target()
315 .accept(MediaType.APPLICATION_JSON)
316 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
319 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
323 void getAllCategoriesTest() {
324 String path = "/v1/setup/ui";
325 Either<UiCategories, ResponseFormat> getAllCategoriesEither = Either.left(new UiCategories());
326 Either<List<ArtifactType>, ActionStatus> otherEither = Either.left(new ArrayList<>());
327 when(elementBusinessLogic.getDefaultHeatTimeout())
328 .thenReturn(Either.left(configurationManager.getConfiguration().getHeatArtifactDeploymentTimeout()));
329 when(elementBusinessLogic.getResourceTypesMap()).thenReturn(Either.left(new HashMap<String, String>()));
330 when(elementBusinessLogic.getAllArtifactTypes(designerUser.getUserId()))
331 .thenReturn(otherEither);
333 when(elementBusinessLogic.getAllCategories(designerUser.getUserId()))
334 .thenReturn(getAllCategoriesEither);
336 Response response = target()
339 .accept(MediaType.APPLICATION_JSON)
340 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
343 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
347 void createComponentCategoryCreationFailedTest() {
348 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
349 Map<String, String> parametersMap = new HashMap<>();
350 parametersMap.put(COMPONENT_TYPE, componentType);
352 String formatEndpoint = "/v1/category/{componentType}";
353 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
355 Either<CategoryDefinition, ResponseFormat> createComponentCategoryEither = Either.right(conflictResponseFormat);
357 when(elementBusinessLogic.createCategory(any(), eq(componentType), eq(designerUser.getUserId())))
358 .thenReturn(createComponentCategoryEither);
360 Response response = target()
363 .accept(MediaType.APPLICATION_JSON)
364 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
365 .post(Entity.json(EMPTY_JSON));
367 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CONFLICT);
371 void createComponentCategoryExceptionDuringCreationTest() {
372 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
373 Map<String, String> parametersMap = new HashMap<>();
374 parametersMap.put(COMPONENT_TYPE, componentType);
376 String formatEndpoint = "/v1/category/{componentType}";
377 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
379 when(elementBusinessLogic.createCategory(any(), eq(componentType), eq(designerUser.getUserId())))
380 .thenThrow(new RuntimeException("Test exception: createComponentCategory"));
382 Response response = target()
385 .accept(MediaType.APPLICATION_JSON)
386 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
387 .post(Entity.json(EMPTY_JSON));
389 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
393 void createComponentCategoryTest() {
394 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
395 Map<String, String> parametersMap = new HashMap<>();
396 parametersMap.put(COMPONENT_TYPE, componentType);
398 String formatEndpoint = "/v1/category/{componentType}";
399 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
401 Either<CategoryDefinition, ResponseFormat> createComponentCategoryEither = Either
402 .left(new CategoryDefinition());
404 when(elementBusinessLogic.createCategory(any(), eq(componentType), eq(designerUser.getUserId())))
405 .thenReturn(createComponentCategoryEither);
407 Response response = target()
410 .accept(MediaType.APPLICATION_JSON)
411 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
412 .post(Entity.json(EMPTY_JSON));
414 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CREATED);
418 void deleteComponentCategoryNoCategoryFoundTest() {
419 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
420 String categoryUniqueId = "categoryUniqueId";
421 Map<String, String> parametersMap = new HashMap<>();
422 parametersMap.put(COMPONENT_TYPE, componentType);
423 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
425 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}";
426 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
428 ResponseFormat notFoundResponseFormat = new ResponseFormat(HttpStatus.SC_NOT_FOUND);
429 Either<CategoryDefinition, ResponseFormat> deleteComponentCategoryEither = Either.right(notFoundResponseFormat);
431 when(elementBusinessLogic.deleteCategory(categoryUniqueId, componentType, designerUser.getUserId()))
432 .thenReturn(deleteComponentCategoryEither);
434 Response response = target()
437 .accept(MediaType.APPLICATION_JSON)
438 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
441 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
445 void deleteComponentCategoryExceptionDuringProcessingTest() {
446 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
447 String categoryUniqueId = "categoryUniqueId";
448 Map<String, String> parametersMap = new HashMap<>();
449 parametersMap.put(COMPONENT_TYPE, componentType);
450 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
452 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}";
453 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
455 when(elementBusinessLogic.deleteCategory(categoryUniqueId, componentType, designerUser.getUserId()))
456 .thenThrow(new RuntimeException("Test exception: deleteComponentCategory"));
458 Response response = target()
461 .accept(MediaType.APPLICATION_JSON)
462 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
465 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
469 void deleteComponentCategoryTest() {
470 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
471 String categoryUniqueId = "categoryUniqueId";
472 Map<String, String> parametersMap = new HashMap<>();
473 parametersMap.put(COMPONENT_TYPE, componentType);
474 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
476 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}";
477 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
479 Either<CategoryDefinition, ResponseFormat> deleteComponentCategoryEither = Either
480 .left(new CategoryDefinition());
481 when(elementBusinessLogic.deleteCategory(categoryUniqueId, componentType, designerUser.getUserId()))
482 .thenReturn(deleteComponentCategoryEither);
484 Response response = target()
487 .accept(MediaType.APPLICATION_JSON)
488 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
491 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
495 void createComponentSubCategoryCreationFailedTest() {
496 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
497 String categoryId = "categoryId";
498 Map<String, String> parametersMap = new HashMap<>();
499 parametersMap.put(COMPONENT_TYPE, componentType);
500 parametersMap.put(CATEGORY_ID, categoryId);
502 String formatEndpoint = "/v1/category/{componentType}/{categoryId}/subCategory";
503 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
505 Either<SubCategoryDefinition, ResponseFormat> createComponentSubCategoryEither = Either
506 .right(conflictResponseFormat);
508 when(elementBusinessLogic
509 .createSubCategory(any(), eq(componentType), eq(categoryId), eq(designerUser.getUserId())))
510 .thenReturn(createComponentSubCategoryEither);
512 Response response = target()
515 .accept(MediaType.APPLICATION_JSON)
516 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
517 .post(Entity.json(EMPTY_JSON));
519 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CONFLICT);
523 void createComponentSubCategoryExceptionDuringCreationTest() {
524 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
525 String categoryId = "categoryId";
526 Map<String, String> parametersMap = new HashMap<>();
527 parametersMap.put(COMPONENT_TYPE, componentType);
528 parametersMap.put(CATEGORY_ID, categoryId);
530 String formatEndpoint = "/v1/category/{componentType}/{categoryId}/subCategory";
531 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
533 when(elementBusinessLogic
534 .createSubCategory(any(), eq(componentType), eq(categoryId), eq(designerUser.getUserId())))
535 .thenThrow(new RuntimeException("Test exception: createComponentSubCategory"));
537 Response response = target()
540 .accept(MediaType.APPLICATION_JSON)
541 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
542 .post(Entity.json(EMPTY_JSON));
544 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
548 void createComponentSubCategoryTest() {
549 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
550 String categoryId = "categoryId";
551 Map<String, String> parametersMap = new HashMap<>();
552 parametersMap.put(COMPONENT_TYPE, componentType);
553 parametersMap.put(CATEGORY_ID, categoryId);
555 String formatEndpoint = "/v1/category/{componentType}/{categoryId}/subCategory";
556 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
558 Either<SubCategoryDefinition, ResponseFormat> createComponentSubCategoryEither = Either
559 .left(new SubCategoryDefinition());
561 when(elementBusinessLogic
562 .createSubCategory(any(), eq(componentType), eq(categoryId), eq(designerUser.getUserId())))
563 .thenReturn(createComponentSubCategoryEither);
565 Response response = target()
568 .accept(MediaType.APPLICATION_JSON)
569 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
570 .post(Entity.json(EMPTY_JSON));
572 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CREATED);
576 void deleteComponentSubCategoryCreationFailedTest() {
577 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
578 String categoryUniqueId = "categoryUniqueId";
579 String subCategoryUniqueId = "subCategoryUniqueId";
580 Map<String, String> parametersMap = new HashMap<>();
581 parametersMap.put(COMPONENT_TYPE, componentType);
582 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
583 parametersMap.put(SUB_CATEGORY_UNIQUE_ID, subCategoryUniqueId);
585 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}/subCategory/{subCategoryUniqueId}";
586 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
588 Either<SubCategoryDefinition, ResponseFormat> deleteComponentSubCategoryEither = Either
589 .right(conflictResponseFormat);
591 when(elementBusinessLogic
592 .deleteSubCategory(eq(subCategoryUniqueId), eq(componentType), eq(designerUser.getUserId())))
593 .thenReturn(deleteComponentSubCategoryEither);
595 Response response = target()
598 .accept(MediaType.APPLICATION_JSON)
599 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
602 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CONFLICT);
606 void deleteComponentSubCategoryExceptionDuringCreationTest() {
607 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
608 String categoryUniqueId = "categoryUniqueId";
609 String subCategoryUniqueId = "subCategoryUniqueId";
610 Map<String, String> parametersMap = new HashMap<>();
611 parametersMap.put(COMPONENT_TYPE, componentType);
612 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
613 parametersMap.put(SUB_CATEGORY_UNIQUE_ID, subCategoryUniqueId);
615 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}/subCategory/{subCategoryUniqueId}";
616 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
618 when(elementBusinessLogic
619 .deleteSubCategory(eq(subCategoryUniqueId), eq(componentType), eq(designerUser.getUserId())))
620 .thenThrow(new RuntimeException("Test exception: deleteComponentSubCategory"));
622 Response response = target()
625 .accept(MediaType.APPLICATION_JSON)
626 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
629 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
633 void deleteComponentSubCategoryTest() {
634 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
635 String categoryUniqueId = "categoryUniqueId";
636 String subCategoryUniqueId = "subCategoryUniqueId";
637 Map<String, String> parametersMap = new HashMap<>();
638 parametersMap.put(COMPONENT_TYPE, componentType);
639 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
640 parametersMap.put(SUB_CATEGORY_UNIQUE_ID, subCategoryUniqueId);
642 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}/subCategory/{subCategoryUniqueId}";
643 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
645 Either<SubCategoryDefinition, ResponseFormat> deleteComponentSubCategoryEither = Either
646 .left(new SubCategoryDefinition());
648 when(elementBusinessLogic
649 .deleteSubCategory(eq(subCategoryUniqueId), eq(componentType), eq(designerUser.getUserId())))
650 .thenReturn(deleteComponentSubCategoryEither);
652 Response response = target()
655 .accept(MediaType.APPLICATION_JSON)
656 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
659 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
663 void createComponentGroupingCreationFailedTest() {
664 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
665 String categoryId = "categoryUniqueId";
666 String subCategoryId = "subCategoryId";
667 Map<String, String> parametersMap = new HashMap<>();
668 parametersMap.put(COMPONENT_TYPE, componentType);
669 parametersMap.put(CATEGORY_ID, categoryId);
670 parametersMap.put(SUB_CATEGORY_ID, subCategoryId);
672 String formatEndpoint = "/v1/category/{componentType}/{categoryId}/subCategory/{subCategoryId}/grouping";
673 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
675 Either<GroupingDefinition, ResponseFormat> createComponentGroupingEither = Either.right(conflictResponseFormat);
677 when(elementBusinessLogic
678 .createGrouping(any(), eq(componentType), eq(categoryId), eq(subCategoryId), eq(designerUser.getUserId())))
679 .thenReturn(createComponentGroupingEither);
681 Response response = target()
684 .accept(MediaType.APPLICATION_JSON)
685 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
686 .post(Entity.json(EMPTY_JSON));
688 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CONFLICT);
692 void createComponentGroupingExceptionDuringCreationTest() {
693 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
694 String categoryId = "categoryUniqueId";
695 String subCategoryId = "subCategoryId";
696 Map<String, String> parametersMap = new HashMap<>();
697 parametersMap.put(COMPONENT_TYPE, componentType);
698 parametersMap.put(CATEGORY_ID, categoryId);
699 parametersMap.put(SUB_CATEGORY_ID, subCategoryId);
701 String formatEndpoint = "/v1/category/{componentType}/{categoryId}/subCategory/{subCategoryId}/grouping";
702 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
704 when(elementBusinessLogic
705 .createGrouping(any(), eq(componentType), eq(categoryId), eq(subCategoryId), eq(designerUser.getUserId())))
706 .thenThrow(new RuntimeException("Test exception: createComponentGrouping"));
708 Response response = target()
711 .accept(MediaType.APPLICATION_JSON)
712 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
713 .post(Entity.json(EMPTY_JSON));
715 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
719 void createComponentGroupingTest() {
720 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
721 String categoryId = "categoryUniqueId";
722 String subCategoryId = "subCategoryId";
723 Map<String, String> parametersMap = new HashMap<>();
724 parametersMap.put(COMPONENT_TYPE, componentType);
725 parametersMap.put(CATEGORY_ID, categoryId);
726 parametersMap.put(SUB_CATEGORY_ID, subCategoryId);
728 String formatEndpoint = "/v1/category/{componentType}/{categoryId}/subCategory/{subCategoryId}/grouping";
729 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
731 Either<GroupingDefinition, ResponseFormat> createComponentGroupingEither = Either
732 .left(new GroupingDefinition());
734 when(elementBusinessLogic
735 .createGrouping(any(), eq(componentType), eq(categoryId), eq(subCategoryId), eq(designerUser.getUserId())))
736 .thenReturn(createComponentGroupingEither);
738 Response response = target()
741 .accept(MediaType.APPLICATION_JSON)
742 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
743 .post(Entity.json(EMPTY_JSON));
745 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CREATED);
749 void deleteComponentGroupingCreationFailedTest() {
750 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
751 String categoryUniqueId = "categoryUniqueId";
752 String subCategoryUniqueId = "subCategoryUniqueId";
753 String groupingUniqueId = "groupingUniqueId";
754 Map<String, String> parametersMap = new HashMap<>();
755 parametersMap.put(COMPONENT_TYPE, componentType);
756 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
757 parametersMap.put(SUB_CATEGORY_UNIQUE_ID, subCategoryUniqueId);
758 parametersMap.put(GROUPING_UNIQUE_ID, groupingUniqueId);
760 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}/subCategory/{subCategoryUniqueId}/grouping/{groupingUniqueId}";
761 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
763 Either<GroupingDefinition, ResponseFormat> deleteComponentGroupingEither = Either.right(conflictResponseFormat);
765 when(elementBusinessLogic.deleteGrouping(eq(groupingUniqueId), eq(componentType), eq(designerUser.getUserId())))
766 .thenReturn(deleteComponentGroupingEither);
768 Response response = target()
771 .accept(MediaType.APPLICATION_JSON)
772 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
775 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CONFLICT);
779 void deleteComponentGroupingExceptionDuringCreationTest() {
780 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
781 String categoryUniqueId = "categoryUniqueId";
782 String subCategoryUniqueId = "subCategoryUniqueId";
783 String groupingUniqueId = "groupingUniqueId";
784 Map<String, String> parametersMap = new HashMap<>();
785 parametersMap.put(COMPONENT_TYPE, componentType);
786 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
787 parametersMap.put(SUB_CATEGORY_UNIQUE_ID, subCategoryUniqueId);
788 parametersMap.put(GROUPING_UNIQUE_ID, groupingUniqueId);
790 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}/subCategory/{subCategoryUniqueId}/grouping/{groupingUniqueId}";
791 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
793 when(elementBusinessLogic.deleteGrouping(eq(groupingUniqueId), eq(componentType), eq(designerUser.getUserId())))
794 .thenThrow(new RuntimeException("Test exception: deleteComponentGrouping"));
796 Response response = target()
799 .accept(MediaType.APPLICATION_JSON)
800 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
803 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
807 void deleteComponentGroupingTest() {
808 String componentType = ComponentTypeEnum.SERVICE_PARAM_NAME;
809 String categoryUniqueId = "categoryUniqueId";
810 String subCategoryUniqueId = "subCategoryUniqueId";
811 String groupingUniqueId = "groupingUniqueId";
812 Map<String, String> parametersMap = new HashMap<>();
813 parametersMap.put(COMPONENT_TYPE, componentType);
814 parametersMap.put(CATEGORY_UNIQUE_ID, categoryUniqueId);
815 parametersMap.put(SUB_CATEGORY_UNIQUE_ID, subCategoryUniqueId);
816 parametersMap.put(GROUPING_UNIQUE_ID, groupingUniqueId);
818 String formatEndpoint = "/v1/category/{componentType}/{categoryUniqueId}/subCategory/{subCategoryUniqueId}/grouping/{groupingUniqueId}";
819 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{", "}");
821 Either<GroupingDefinition, ResponseFormat> deleteComponentGroupingEither = Either
822 .left(new GroupingDefinition());
824 when(elementBusinessLogic.deleteGrouping(eq(groupingUniqueId), eq(componentType), eq(designerUser.getUserId())))
825 .thenReturn(deleteComponentGroupingEither);
827 Response response = target()
830 .accept(MediaType.APPLICATION_JSON)
831 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
834 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
838 void tagsNoTagsFoundTest() {
839 String path = "/v1/tags";
840 Either<List<Tag>, ActionStatus> tagsEither = Either.right(ActionStatus.NO_CONTENT);
842 when(elementBusinessLogic.getAllTags(designerUser.getUserId()))
843 .thenReturn(tagsEither);
845 Response response = target()
848 .accept(MediaType.APPLICATION_JSON)
849 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
852 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
856 void tagsExceptionDuringProcessingTest() {
857 String path = "/v1/tags";
858 when(elementBusinessLogic.getAllTags(designerUser.getUserId()))
859 .thenThrow(new RuntimeException("Test exception: tags"));
861 Response response = target()
864 .accept(MediaType.APPLICATION_JSON)
865 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
868 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
873 String path = "/v1/tags";
874 Either<List<Tag>, ActionStatus> tagsEither = Either.left(new ArrayList<>());
875 when(elementBusinessLogic.getAllTags(designerUser.getUserId()))
876 .thenReturn(tagsEither);
878 Response response = target()
881 .accept(MediaType.APPLICATION_JSON)
882 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
885 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
889 void propertyScopesNoPropertyScopesFoundTest() {
890 String path = "/v1/propertyScopes";
891 Either<List<PropertyScope>, ActionStatus> propertyScopesEither = Either.right(ActionStatus.NO_CONTENT);
893 when(elementBusinessLogic.getAllPropertyScopes(designerUser.getUserId()))
894 .thenReturn(propertyScopesEither);
896 Response response = target()
899 .accept(MediaType.APPLICATION_JSON)
900 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
903 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
907 void propertyScopesExceptionDuringProcessingTest() {
908 String path = "/v1/propertyScopes";
909 when(elementBusinessLogic.getAllPropertyScopes(designerUser.getUserId()))
910 .thenThrow(new RuntimeException("Test exception: propertyScopes"));
912 Response response = target()
915 .accept(MediaType.APPLICATION_JSON)
916 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
919 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
923 void propertyScopesTest() {
924 String path = "/v1/propertyScopes";
925 Either<List<PropertyScope>, ActionStatus> propertyScopesEither = Either.left(new ArrayList<>());
926 when(elementBusinessLogic.getAllPropertyScopes(designerUser.getUserId()))
927 .thenReturn(propertyScopesEither);
929 Response response = target()
932 .accept(MediaType.APPLICATION_JSON)
933 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
936 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
940 void artifactTypesNoartifactTypesFoundTest() {
941 String path = "/v1/artifactTypes";
942 Either<List<ArtifactType>, ActionStatus> artifactTypesEither = Either.right(ActionStatus.NO_CONTENT);
944 when(elementBusinessLogic.getAllArtifactTypes(designerUser.getUserId()))
945 .thenReturn(artifactTypesEither);
947 Response response = target()
950 .accept(MediaType.APPLICATION_JSON)
951 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
954 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
958 void artifactTypesExceptionDuringProcessingTest() {
959 String path = "/v1/artifactTypes";
960 when(elementBusinessLogic.getAllArtifactTypes(designerUser.getUserId()))
961 .thenThrow(new RuntimeException("Test exception: artifactTypes"));
963 Response response = target()
966 .accept(MediaType.APPLICATION_JSON)
967 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
970 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
974 void artifactTypesTest() {
975 String path = "/v1/artifactTypes";
976 Either<List<ArtifactType>, ActionStatus> artifactTypesEither = Either.left(new ArrayList<>());
977 when(elementBusinessLogic.getAllArtifactTypes(designerUser.getUserId()))
978 .thenReturn(artifactTypesEither);
980 Response response = target()
983 .accept(MediaType.APPLICATION_JSON)
984 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
987 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
991 void configurationNoConfigurationFoundTest() {
992 String path = "/v1/setup/ui";
994 Either<List<ArtifactType>, ActionStatus> otherEither = Either.left(new ArrayList<>());
995 Configuration.HeatDeploymentArtifactTimeout heatDeploymentArtifactTimeout = new Configuration.HeatDeploymentArtifactTimeout();
996 heatDeploymentArtifactTimeout.setDefaultMinutes(1);
997 Either<Configuration.HeatDeploymentArtifactTimeout, ActionStatus> defaultHeatTimeoutEither = Either
998 .left(heatDeploymentArtifactTimeout);
999 Either<Map<String, String>, ActionStatus> resourceTypesMapEither = Either.left(new HashMap<>());
1001 when(elementBusinessLogic.getAllArtifactTypes(designerUser.getUserId()))
1002 .thenReturn(otherEither);
1003 when(elementBusinessLogic.getDefaultHeatTimeout())
1004 .thenReturn(defaultHeatTimeoutEither);
1005 when(elementBusinessLogic.getResourceTypesMap())
1006 .thenReturn(resourceTypesMapEither);
1008 Response response = target()
1011 .accept(MediaType.APPLICATION_JSON)
1012 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
1015 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
1019 void configurationExceptionDuringProcessingTest() {
1020 String path = "/v1/setup/ui";
1021 when(elementBusinessLogic.getAllArtifactTypes(designerUser.getUserId()))
1022 .thenThrow(new RuntimeException("Test exception: artifactTypes"));
1024 Response response = target()
1027 .accept(MediaType.APPLICATION_JSON)
1028 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
1031 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
1035 void screenNoCatalogComponentsFoundTest() {
1036 String path = "/v1/screen";
1038 Either<Map<String, List<CatalogComponent>>, ResponseFormat> screenEither = Either
1039 .right(badRequestResponseFormat);
1040 when(elementBusinessLogic.getCatalogComponents(eq(designerUser.getUserId()), any()))
1041 .thenReturn(screenEither);
1043 Response response = target()
1046 .accept(MediaType.APPLICATION_JSON)
1047 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
1050 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_BAD_REQUEST);
1054 void screenExceptionDuringProcessingTest() {
1055 String path = "/v1/screen";
1057 when(elementBusinessLogic.getCatalogComponents(eq(designerUser.getUserId()), any()))
1058 .thenThrow(new RuntimeException("Test exception: screen"));
1060 Response response = target()
1063 .accept(MediaType.APPLICATION_JSON)
1064 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
1067 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
1072 String path = "/v1/screen";
1074 Either<Map<String, List<CatalogComponent>>, ResponseFormat> screenEither = Either.left(new HashMap<>());
1075 when(elementBusinessLogic.getCatalogComponents(eq(designerUser.getUserId()), any()))
1076 .thenReturn(screenEither);
1078 Response response = target()
1081 .accept(MediaType.APPLICATION_JSON)
1082 .header(Constants.USER_ID_HEADER, designerUser.getUserId())
1085 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
1089 protected Application configure() {
1090 ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
1091 forceSet(TestProperties.CONTAINER_PORT, "0");
1092 return new ResourceConfig(ElementServlet.class)
1093 .register(new AbstractBinder() {
1096 protected void configure() {
1097 bind(request).to(HttpServletRequest.class);
1098 bind(userBusinessLogic).to(UserBusinessLogic.class);
1099 bind(componentUtils).to(ComponentsUtils.class);
1100 bind(componentsCleanBusinessLogic).to(ComponentsCleanBusinessLogic.class);
1101 bind(elementBusinessLogic).to(ElementBusinessLogic.class);
1102 bind(artifactsBusinessLogic).to(ArtifactsBusinessLogic.class);
1105 .property("contextConfig", context);