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 com.google.gson.Gson;
26 import com.google.gson.GsonBuilder;
27 import fj.data.Either;
28 import org.apache.commons.codec.binary.Base64;
29 import org.apache.commons.lang3.tuple.ImmutablePair;
30 import org.apache.commons.text.StrSubstitutor;
31 import org.apache.http.HttpStatus;
32 import org.glassfish.hk2.utilities.binding.AbstractBinder;
33 import org.glassfish.jersey.server.ResourceConfig;
34 import org.glassfish.jersey.test.JerseyTest;
35 import org.glassfish.jersey.test.TestProperties;
36 import org.json.JSONException;
37 import org.junit.Before;
38 import org.junit.BeforeClass;
39 import org.junit.Test;
40 import org.mockito.Mockito;
41 import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
42 import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
43 import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
44 import org.openecomp.sdc.be.components.impl.ResourceImportManager;
45 import org.openecomp.sdc.be.config.ConfigurationManager;
46 import org.openecomp.sdc.be.config.SpringConfig;
47 import org.openecomp.sdc.be.dao.api.ActionStatus;
48 import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum;
49 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
50 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
51 import org.openecomp.sdc.be.impl.ComponentsUtils;
52 import org.openecomp.sdc.be.impl.ServletUtils;
53 import org.openecomp.sdc.be.impl.WebAppContextWrapper;
54 import org.openecomp.sdc.be.model.Resource;
55 import org.openecomp.sdc.be.model.UploadResourceInfo;
56 import org.openecomp.sdc.be.model.User;
57 import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
58 import org.openecomp.sdc.be.user.Role;
59 import org.openecomp.sdc.be.user.UserBusinessLogic;
60 import org.openecomp.sdc.common.api.ConfigurationSource;
61 import org.openecomp.sdc.common.api.Constants;
62 import org.openecomp.sdc.common.impl.ExternalConfiguration;
63 import org.openecomp.sdc.common.impl.FSConfigurationSource;
64 import org.openecomp.sdc.common.util.GeneralUtility;
65 import org.openecomp.sdc.exception.ResponseFormat;
66 import org.springframework.context.ApplicationContext;
67 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
68 import org.springframework.web.context.WebApplicationContext;
70 import javax.servlet.ServletContext;
71 import javax.servlet.http.HttpServletRequest;
72 import javax.servlet.http.HttpSession;
73 import javax.ws.rs.client.Entity;
74 import javax.ws.rs.core.Application;
75 import javax.ws.rs.core.MediaType;
76 import javax.ws.rs.core.Response;
77 import java.io.IOException;
78 import java.util.Arrays;
79 import java.util.Collections;
80 import java.util.HashMap;
81 import java.util.List;
84 import static org.assertj.core.api.Assertions.assertThat;
85 import static org.junit.Assert.assertEquals;
86 import static org.mockito.ArgumentMatchers.any;
87 import static org.mockito.ArgumentMatchers.eq;
88 import static org.mockito.BDDMockito.given;
89 import static org.mockito.Mockito.when;
91 public class ResourceServletTest extends JerseyTest {
92 public static final HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
93 public static final ResourceImportManager resourceImportManager = Mockito.mock(ResourceImportManager.class);
94 private static final HttpSession session = Mockito.mock(HttpSession.class);
95 private static final ServletContext servletContext = Mockito.mock(ServletContext.class);
96 private static final WebAppContextWrapper webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class);
97 private static final WebApplicationContext webApplicationContext = Mockito.mock(WebApplicationContext.class);
98 public static final ServletUtils servletUtils = Mockito.mock(ServletUtils.class);
99 public static final ComponentsUtils componentUtils = Mockito.mock(ComponentsUtils.class);
100 private static final UserBusinessLogic userAdmin = Mockito.mock(UserBusinessLogic.class);
101 private static final UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class);
102 private static final GroupBusinessLogic groupBL = Mockito.mock(GroupBusinessLogic.class);
103 private static final ComponentInstanceBusinessLogic componentInstanceBL = Mockito.mock(ComponentInstanceBusinessLogic.class);
104 private static final ResourceBusinessLogic resourceBusinessLogic = Mockito.mock(ResourceBusinessLogic.class);
105 private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
106 private static final ResponseFormat okResponseFormat = new ResponseFormat(HttpStatus.SC_OK);
107 private static final ResponseFormat conflictResponseFormat = new ResponseFormat(HttpStatus.SC_CONFLICT);
108 private static final ResponseFormat generalErrorResponseFormat = new ResponseFormat(HttpStatus.SC_INTERNAL_SERVER_ERROR);
109 private static final ResponseFormat createdResponseFormat = new ResponseFormat(HttpStatus.SC_CREATED);
110 private static final ResponseFormat noContentResponseFormat = new ResponseFormat(HttpStatus.SC_NO_CONTENT);
111 private static final ResponseFormat notFoundResponseFormat = new ResponseFormat(HttpStatus.SC_NOT_FOUND);
112 private static final ResponseFormat badRequestResponseFormat = new ResponseFormat(HttpStatus.SC_BAD_REQUEST);
113 private static final ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration
114 .getChangeListener(), "src/test/resources/config/catalog-be");
115 private static final ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
116 private static final String RESOURCE_NAME = "resourceName";
117 private static final String VERSION = "version";
118 private static final String RESOURCE_ID = "resourceId";
119 private static final String RESOURCE_VERSION = "resourceVersion";
120 private static final String SUBTYPE = "subtype";
121 private static final String CSAR_UUID = "csaruuid";
122 private static final String EMPTY_JSON = "{}";
123 private static final String NON_UI_IMPORT_JSON = "{\n" +
124 " \"node1\": \"value1\",\n" +
126 " \"level21\": \"value21\",\n" +
127 " \"level22\": \"value22\"\n" +
130 private static User user;
133 public static void setup() {
134 ExternalConfiguration.setAppName("catalog-be");
135 when(request.getSession()).thenReturn(session);
136 when(session.getServletContext()).thenReturn(servletContext);
137 when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper);
138 when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webApplicationContext);
139 when(webApplicationContext.getBean(ResourceImportManager.class)).thenReturn(resourceImportManager);
140 when(webApplicationContext.getBean(ServletUtils.class)).thenReturn(servletUtils);
141 when(servletUtils.getComponentsUtils()).thenReturn(componentUtils);
142 when(servletUtils.getUserAdmin()).thenReturn(userAdmin);
143 String userId = "jh0003";
145 user.setUserId(userId);
146 user.setRole(Role.ADMIN.name());
147 when(userAdmin.getUser(userId)).thenReturn(user);
148 when(request.getHeader(Constants.USER_ID_HEADER)).thenReturn(userId);
150 ImmutablePair<Resource, ActionStatus> pair = new ImmutablePair<>(new Resource(), ActionStatus.OK);
151 when(resourceImportManager.importUserDefinedResource(Mockito.anyString(), Mockito.any(UploadResourceInfo.class), Mockito.any(User.class), Mockito.anyBoolean())).thenReturn(pair);
152 when(webApplicationContext.getBean(ResourceBusinessLogic.class)).thenReturn(resourceBusinessLogic);
157 public void beforeTest() {
158 Mockito.reset(componentUtils);
159 Mockito.reset(resourceBusinessLogic);
161 when(componentUtils.getResponseFormat(ActionStatus.OK)) .thenReturn(okResponseFormat);
162 when(componentUtils.getResponseFormat(ActionStatus.CREATED)).thenReturn(createdResponseFormat);
163 when(componentUtils.getResponseFormat(ActionStatus.NO_CONTENT)).thenReturn(noContentResponseFormat);
164 when(componentUtils.getResponseFormat(ActionStatus.INVALID_CONTENT)).thenReturn(badRequestResponseFormat);
165 when(componentUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)) .thenReturn(generalErrorResponseFormat);
166 when(componentUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND)) .thenReturn(notFoundResponseFormat);
170 public void testHappyScenarioTest() {
171 when(componentUtils.getResponseFormat(ActionStatus.OK)).thenReturn(createdResponseFormat);
173 UploadResourceInfo validJson = buildValidJson();
174 setMD5OnRequest(true, validJson);
175 Response response = target().path("/v1/catalog/resources").request(MediaType.APPLICATION_JSON)
176 .post(Entity.json(gson.toJson(validJson)), Response.class);
177 Mockito.verify(componentUtils, Mockito.times(1)).getResponseFormat(Mockito.any(ActionStatus.class));
178 Mockito.verify(componentUtils, Mockito.times(1)).getResponseFormat(ActionStatus.OK);
179 assertEquals(HttpStatus.SC_CREATED, response.getStatus());
184 public void testNonValidMd5Fail() {
185 UploadResourceInfo validJson = buildValidJson();
187 setMD5OnRequest(false, validJson);
189 Response response = target().path("/v1/catalog/resources").request(MediaType.APPLICATION_JSON).post(Entity.json(gson.toJson(validJson)), Response.class);
190 Mockito.verify(componentUtils, Mockito.times(1)).getResponseFormat(Mockito.any(ActionStatus.class));
191 Mockito.verify(componentUtils, Mockito.times(1)).getResponseFormat(ActionStatus.INVALID_RESOURCE_CHECKSUM);
192 assertEquals(response.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
197 public void testNonValidPayloadNameFail() {
198 UploadResourceInfo mdJson = buildValidJson();
199 mdJson.setPayloadName("myCompute.xml");
201 runAndVerifyActionStatusError(mdJson, ActionStatus.INVALID_TOSCA_FILE_EXTENSION);
206 public void testNullPayloadFail() {
207 UploadResourceInfo mdJson = buildValidJson();
208 mdJson.setPayloadData(null);
209 runAndVerifyActionStatusError(mdJson, ActionStatus.INVALID_RESOURCE_PAYLOAD);
214 public void testNonYmlPayloadFail() {
215 UploadResourceInfo mdJson = buildValidJson();
216 String payload = "{ json : { isNot : yaml } ";
217 encodeAndSetPayload(mdJson, payload);
218 runAndVerifyActionStatusError(mdJson, ActionStatus.INVALID_YAML_FILE);
223 public void testNonToscaPayloadFail() {
224 UploadResourceInfo mdJson = buildValidJson();
226 String payload = "node_types: \r\n" + " org.openecomp.resource.importResource4test:\r\n" + " derived_from: tosca.nodes.Root\r\n" + " description: update update";
227 encodeAndSetPayload(mdJson, payload);
228 runAndVerifyActionStatusError(mdJson, ActionStatus.INVALID_TOSCA_TEMPLATE);
233 public void testServiceToscaPayloadFail() {
234 UploadResourceInfo mdJson = buildValidJson();
236 String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n" + " org.openecomp.resource.importResource4test:\r\n" + " derived_from: tosca.nodes.Root\r\n" + " topology_template: thisIsService\r\n"
237 + " description: update update";
239 encodeAndSetPayload(mdJson, payload);
240 runAndVerifyActionStatusError(mdJson, ActionStatus.NOT_RESOURCE_TOSCA_TEMPLATE);
245 public void testMultipleResourcesInPayloadFail() {
246 UploadResourceInfo mdJson = buildValidJson();
248 String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n" + " org.openecomp.resource.importResource4test2:\r\n" + " derived_from: tosca.nodes.Root\r\n" + " org.openecomp.resource.importResource4test:\r\n"
249 + " derived_from: tosca.nodes.Root\r\n" + " description: update update";
251 encodeAndSetPayload(mdJson, payload);
252 runAndVerifyActionStatusError(mdJson, ActionStatus.NOT_SINGLE_RESOURCE);
257 public void testNonValidNameSpaceInPayloadFail() {
258 UploadResourceInfo mdJson = buildValidJson();
260 String payload = "tosca_definitions_version: tosca_simple_yaml_1_0_0\r\n" + "node_types: \r\n"
261 + " org.openecomp.resourceX.importResource4test:\r\n" + " derived_from: tosca.nodes.Root\r\n"
262 + " description: update update";
264 encodeAndSetPayload(mdJson, payload);
265 runAndVerifyActionStatusError(mdJson, ActionStatus.INVALID_RESOURCE_NAMESPACE);
269 public void deleteResourceTryDeleteNonExistingResourceTest() {
270 String resourceId = "resourceId";
271 Map<String,String> parametersMap = new HashMap<>();
272 parametersMap.put("resourceId", resourceId);
274 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
275 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
277 when(resourceBusinessLogic.deleteResource(any(), any(User.class)))
278 .thenReturn(notFoundResponseFormat);
280 Response response = target()
283 .accept(MediaType.APPLICATION_JSON)
284 .header(Constants.USER_ID_HEADER, user.getUserId())
287 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
291 public void deleteResourceExceptionDuringDeletingTest() {
292 String resourceId = RESOURCE_ID;
293 Map<String,String> parametersMap = new HashMap<>();
294 parametersMap.put(RESOURCE_ID, resourceId);
296 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
297 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
299 when(resourceBusinessLogic.deleteResource(any(), any(User.class)))
300 .thenThrow(new JSONException("Test exception: deleteResource"));
302 Response response = target()
305 .accept(MediaType.APPLICATION_JSON)
306 .header(Constants.USER_ID_HEADER, user.getUserId())
309 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
313 public void deleteResourceCategoryTest() {
314 String resourceId = "resourceId";
315 Map<String,String> parametersMap = new HashMap<>();
316 parametersMap.put("resourceId", resourceId);
318 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
319 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
321 when(resourceBusinessLogic.deleteResource(eq(resourceId.toLowerCase()), any(User.class)))
322 .thenReturn(noContentResponseFormat);
324 Response response = target()
327 .accept(MediaType.APPLICATION_JSON)
328 .header(Constants.USER_ID_HEADER, user.getUserId())
331 assertThat(response.getStatus()).isEqualTo(org.apache.http.HttpStatus.SC_NO_CONTENT);
335 public void deleteResourceByNameAndVersionTryDeleteNonExistingResourceTest() {
336 String resourceName = RESOURCE_NAME;
337 String version = VERSION;
338 Map<String,String> parametersMap = new HashMap<>();
339 parametersMap.put(RESOURCE_NAME, resourceName);
340 parametersMap.put(VERSION, version);
342 String formatEndpoint = "/v1/catalog/resources/{resourceName}/{version}";
343 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
345 when(resourceBusinessLogic.deleteResourceByNameAndVersion(eq(resourceName), eq(version), any(User.class)))
346 .thenReturn(notFoundResponseFormat);
348 Response response = target()
351 .accept(MediaType.APPLICATION_JSON)
352 .header(Constants.USER_ID_HEADER, user.getUserId())
355 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
359 public void deleteResourceByNameAndVersionExceptionDuringDeletingTest() {
360 String resourceName = RESOURCE_NAME;
361 String version = VERSION;
362 Map<String,String> parametersMap = new HashMap<>();
363 parametersMap.put(RESOURCE_NAME, resourceName);
364 parametersMap.put(VERSION, version);
366 String formatEndpoint = "/v1/catalog/resources/{resourceName}/{version}";
367 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
369 when(resourceBusinessLogic.deleteResourceByNameAndVersion(eq(resourceName), eq(version), any(User.class)))
370 .thenThrow(new JSONException("Test exception: deleteResourceByNameAndVersion"));
372 Response response = target()
375 .accept(MediaType.APPLICATION_JSON)
376 .header(Constants.USER_ID_HEADER, user.getUserId())
379 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
383 public void deleteResourceByNameAndVersionCategoryTest() {
384 String resourceName = RESOURCE_NAME;
385 String version = VERSION;
386 Map<String,String> parametersMap = new HashMap<>();
387 parametersMap.put(RESOURCE_NAME, resourceName);
388 parametersMap.put(VERSION, version);
390 String formatEndpoint = "/v1/catalog/resources/{resourceName}/{version}";
391 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
393 when(resourceBusinessLogic.deleteResourceByNameAndVersion(eq(resourceName), eq(version), any(User.class)))
394 .thenReturn(noContentResponseFormat);
396 Response response = target()
399 .accept(MediaType.APPLICATION_JSON)
400 .header(Constants.USER_ID_HEADER, user.getUserId())
403 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NO_CONTENT);
407 public void getResourceByIdTryGetNonExistingResourceTest() {
408 String resourceId = RESOURCE_ID;
409 Map<String,String> parametersMap = new HashMap<>();
410 parametersMap.put(RESOURCE_ID, resourceId);
412 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
413 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
415 Either<Resource, ResponseFormat> getResourceByIdEither = Either.right(notFoundResponseFormat);
416 when(resourceBusinessLogic.getResource(eq(resourceId.toLowerCase()), any(User.class)))
417 .thenReturn(getResourceByIdEither);
419 Response response = target()
422 .accept(MediaType.APPLICATION_JSON)
423 .header(Constants.USER_ID_HEADER, user.getUserId())
426 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
430 public void getResourceByIdExceptionDuringSearchingTest() {
431 String resourceId = RESOURCE_ID;
432 Map<String,String> parametersMap = new HashMap<>();
433 parametersMap.put(RESOURCE_ID, resourceId);
435 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
436 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
438 given(resourceBusinessLogic.getResource(eq(resourceId.toLowerCase()), any(User.class)))
439 .willAnswer( invocation -> { throw new IOException("Test exception: getResourceById"); });
441 Response response = target()
444 .accept(MediaType.APPLICATION_JSON)
445 .header(Constants.USER_ID_HEADER, user.getUserId())
448 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
452 public void getResourceByIdTest() {
453 String resourceId = RESOURCE_ID;
454 Map<String,String> parametersMap = new HashMap<>();
455 parametersMap.put(RESOURCE_ID, resourceId);
457 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
458 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
460 Either<Resource, ResponseFormat> getResourceByIdEither = Either.left(new Resource());
461 when(resourceBusinessLogic.getResource(eq(resourceId.toLowerCase()), any(User.class)))
462 .thenReturn(getResourceByIdEither);
464 Response response = target()
467 .accept(MediaType.APPLICATION_JSON)
468 .header(Constants.USER_ID_HEADER, user.getUserId())
471 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
475 public void getResourceByNameAndVersionTryGetNonExistingResourceTest() {
476 String resourceName = RESOURCE_NAME;
477 String resourceVersion = RESOURCE_VERSION;
478 Map<String,String> parametersMap = new HashMap<>();
479 parametersMap.put(RESOURCE_NAME, resourceName);
480 parametersMap.put(RESOURCE_VERSION, resourceVersion);
482 String formatEndpoint = "/v1/catalog/resources/resourceName/{resourceName}/resourceVersion/{resourceVersion}";
483 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
485 Either<Resource, ResponseFormat> getResourceByNameAndVersionEither = Either.right(notFoundResponseFormat);
486 when(resourceBusinessLogic.getResourceByNameAndVersion(eq(resourceName), eq(resourceVersion), eq(user.getUserId())))
487 .thenReturn(getResourceByNameAndVersionEither);
489 Response response = target()
492 .accept(MediaType.APPLICATION_JSON)
493 .header(Constants.USER_ID_HEADER, user.getUserId())
496 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
500 public void getResourceByNameAndVersionExceptionDuringSearchingTest() {
501 String resourceName = RESOURCE_NAME;
502 String resourceVersion = RESOURCE_VERSION;
503 Map<String,String> parametersMap = new HashMap<>();
504 parametersMap.put(RESOURCE_NAME, resourceName);
505 parametersMap.put(RESOURCE_VERSION, resourceVersion);
507 String formatEndpoint = "/v1/catalog/resources/resourceName/{resourceName}/resourceVersion/{resourceVersion}";
508 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
510 given(resourceBusinessLogic.getResourceByNameAndVersion(eq(resourceName), eq(resourceVersion), eq(user.getUserId())))
511 .willAnswer( invocation -> { throw new IOException("Test exception: getResourceByNameAndVersion"); });
513 Response response = target()
516 .accept(MediaType.APPLICATION_JSON)
517 .header(Constants.USER_ID_HEADER, user.getUserId())
520 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
524 public void getResourceByNameAndVersionTest() {
525 String resourceName = RESOURCE_NAME;
526 String resourceVersion = RESOURCE_VERSION;
527 Map<String,String> parametersMap = new HashMap<>();
528 parametersMap.put(RESOURCE_NAME, resourceName);
529 parametersMap.put(RESOURCE_VERSION, resourceVersion);
531 String formatEndpoint = "/v1/catalog/resources/resourceName/{resourceName}/resourceVersion/{resourceVersion}";
532 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
534 Either<Resource, ResponseFormat> getResourceByNameAndVersionEither = Either.left(new Resource());
535 when(resourceBusinessLogic.getResourceByNameAndVersion(eq(resourceName), eq(resourceVersion), eq(user.getUserId())))
536 .thenReturn(getResourceByNameAndVersionEither);
538 Response response = target()
541 .accept(MediaType.APPLICATION_JSON)
542 .header(Constants.USER_ID_HEADER, user.getUserId())
545 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
549 public void validateResourceNameTryValidateNonExistingResourceTest() {
550 String resourceName = RESOURCE_NAME;
551 String resourceType = "VFC";
552 Map<String,String> parametersMap = new HashMap<>();
553 parametersMap.put(RESOURCE_NAME, resourceName);
555 String formatEndpoint = "/v1/catalog/resources/validate-name/{resourceName}";
556 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
558 Either<Map<String, Boolean>, ResponseFormat> validateResourceNameEither =
559 Either.right(notFoundResponseFormat);
560 ResourceTypeEnum resourceTypeEnum = ResourceTypeEnum.valueOf(resourceType);
561 when(resourceBusinessLogic.validateResourceNameExists(eq(resourceName), eq(resourceTypeEnum), eq(user.getUserId())))
562 .thenReturn(validateResourceNameEither);
564 Response response = target()
566 .queryParam(SUBTYPE, resourceType)
568 .accept(MediaType.APPLICATION_JSON)
569 .header(Constants.USER_ID_HEADER, user.getUserId())
572 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_NOT_FOUND);
576 public void validateResourceNameInvalidContentTest() {
577 String resourceName = RESOURCE_NAME;
578 String resourceType = "ThisIsInvalid";
579 Map<String,String> parametersMap = new HashMap<>();
580 parametersMap.put(RESOURCE_NAME, resourceName);
582 String formatEndpoint = "/v1/catalog/resources/validate-name/{resourceName}";
583 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
585 Response response = target()
587 .queryParam(SUBTYPE, resourceType)
589 .accept(MediaType.APPLICATION_JSON)
590 .header(Constants.USER_ID_HEADER, user.getUserId())
593 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_BAD_REQUEST);
597 public void validateResourceNameTest() {
598 String resourceName = RESOURCE_NAME;
599 String resourceType = "VFC";
600 Map<String,String> parametersMap = new HashMap<>();
601 parametersMap.put(RESOURCE_NAME, resourceName);
603 String formatEndpoint = "/v1/catalog/resources/validate-name/{resourceName}";
604 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
606 Either<Map<String, Boolean>, ResponseFormat> validateResourceNameEither =
607 Either.left(new HashMap<>());
608 ResourceTypeEnum resourceTypeEnum = ResourceTypeEnum.valueOf(resourceType);
609 when(resourceBusinessLogic.validateResourceNameExists(eq(resourceName), eq(resourceTypeEnum), eq(user.getUserId())))
610 .thenReturn(validateResourceNameEither);
612 Response response = target()
614 .queryParam(SUBTYPE, resourceType)
616 .accept(MediaType.APPLICATION_JSON)
617 .header(Constants.USER_ID_HEADER, user.getUserId())
620 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
624 public void getCertifiedAbstractResourcesExceptionDuringSearchingTest() {
625 String path = "/v1/catalog/resources/certified/abstract";
626 given(resourceBusinessLogic.getAllCertifiedResources(eq(true), eq(HighestFilterEnum.HIGHEST_ONLY),
627 eq(user.getUserId())))
628 .willAnswer( invocation -> { throw new IOException("Test exception: getCertifiedAbstractResources"); });
630 Response response = target()
633 .accept(MediaType.APPLICATION_JSON)
634 .header(Constants.USER_ID_HEADER, user.getUserId())
637 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
641 public void getCertifiedAbstractResourcesTest() {
642 String path = "/v1/catalog/resources/certified/abstract";
644 List<Resource> resources = Arrays.asList(new Resource(), new Resource());
645 when(resourceBusinessLogic.getAllCertifiedResources(eq(true), eq(HighestFilterEnum.HIGHEST_ONLY),
646 eq(user.getUserId())))
647 .thenReturn(resources);
649 Response response = target()
652 .accept(MediaType.APPLICATION_JSON)
653 .header(Constants.USER_ID_HEADER, user.getUserId())
656 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
660 public void getCertifiedNotAbstractResourcesExceptionDuringSearchingTest() {
661 String path = "/v1/catalog/resources/certified/notabstract";
662 given(resourceBusinessLogic.getAllCertifiedResources(eq(false), eq(HighestFilterEnum.ALL),
663 eq(user.getUserId())))
664 .willAnswer( invocation -> { throw new IOException("Test exception: getCertifiedNotAbstractResources"); });
666 Response response = target()
669 .accept(MediaType.APPLICATION_JSON)
670 .header(Constants.USER_ID_HEADER, user.getUserId())
673 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
677 public void getCertifiedNotAbstractResourcesTest() {
678 String path = "/v1/catalog/resources/certified/notabstract";
680 List<Resource> resources = Arrays.asList(new Resource(), new Resource());
681 when(resourceBusinessLogic.getAllCertifiedResources(eq(true), eq(HighestFilterEnum.ALL),
682 eq(user.getUserId())))
683 .thenReturn(resources);
685 Response response = target()
688 .accept(MediaType.APPLICATION_JSON)
689 .header(Constants.USER_ID_HEADER, user.getUserId())
692 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
696 public void updateResourceMetadataTryUpdateNonExistingResourceTest() {
697 String resourceId = RESOURCE_ID;
698 Map<String,String> parametersMap = new HashMap<>();
699 parametersMap.put(RESOURCE_ID, resourceId);
701 String formatEndpoint = "/v1/catalog/resources/{resourceId}/metadata";
702 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
704 Either<Resource, ResponseFormat> updateResourceMetadataEither = Either.right(badRequestResponseFormat);
706 when(componentUtils.convertJsonToObjectUsingObjectMapper(any(), any(), eq(Resource.class),
707 eq(AuditingActionEnum.UPDATE_RESOURCE_METADATA), eq(ComponentTypeEnum.RESOURCE)))
708 .thenReturn(updateResourceMetadataEither);
710 when(resourceBusinessLogic.updateResourceMetadata(eq(resourceId.toLowerCase()), any(), any(), any(User.class),
712 .thenReturn(new Resource());
714 Response response = target()
717 .accept(MediaType.APPLICATION_JSON)
718 .header(Constants.USER_ID_HEADER, user.getUserId())
719 .put(Entity.json(EMPTY_JSON));
721 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_BAD_REQUEST);
725 public void updateResourceMetadataExceptionDuringUpdateTest() {
726 String resourceId = RESOURCE_ID;
727 Map<String,String> parametersMap = new HashMap<>();
728 parametersMap.put(RESOURCE_ID, resourceId);
730 String formatEndpoint = "/v1/catalog/resources/{resourceId}/metadata";
731 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
733 given(componentUtils.convertJsonToObjectUsingObjectMapper(any(), any(), eq(Resource.class),
734 eq(AuditingActionEnum.UPDATE_RESOURCE_METADATA), eq(ComponentTypeEnum.RESOURCE)))
735 .willAnswer( invocation -> { throw new IOException("Test exception: updateResourceMetadata"); });
737 Response response = target()
740 .accept(MediaType.APPLICATION_JSON)
741 .header(Constants.USER_ID_HEADER, user.getUserId())
742 .put(Entity.json(EMPTY_JSON));
744 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
748 public void updateResourceMetadataCategoryTest() {
749 String resourceId = RESOURCE_ID;
750 Map<String,String> parametersMap = new HashMap<>();
751 parametersMap.put(RESOURCE_ID, resourceId);
753 String formatEndpoint = "/v1/catalog/resources/{resourceId}/metadata";
754 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
756 Resource initialResource = new Resource();
757 Either<Resource, ResponseFormat> updateResourceMetadataEither = Either.left(initialResource);
759 when(componentUtils.convertJsonToObjectUsingObjectMapper(any(), any(), eq(Resource.class),
760 eq(AuditingActionEnum.UPDATE_RESOURCE_METADATA), eq(ComponentTypeEnum.RESOURCE)))
761 .thenReturn(updateResourceMetadataEither);
763 when(resourceBusinessLogic.updateResourceMetadata(eq(resourceId.toLowerCase()), eq(initialResource), any(),
764 any(User.class), eq(false)))
765 .thenReturn(new Resource());
767 Response response = target()
770 .accept(MediaType.APPLICATION_JSON)
771 .header(Constants.USER_ID_HEADER, user.getUserId())
772 .put(Entity.json(EMPTY_JSON));
774 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
778 public void updateResourceParsingUncussessfulTest() {
779 String resourceId = RESOURCE_ID;
780 Map<String,String> parametersMap = new HashMap<>();
781 parametersMap.put(RESOURCE_ID, resourceId);
783 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
784 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
786 Either<Resource, ResponseFormat> updateResourceEither = Either.right(badRequestResponseFormat);
788 when(componentUtils.convertJsonToObjectUsingObjectMapper(eq(NON_UI_IMPORT_JSON), any(User.class),
789 eq(Resource.class), eq(AuditingActionEnum.UPDATE_RESOURCE_METADATA), eq(ComponentTypeEnum.RESOURCE)))
790 .thenReturn(updateResourceEither);
792 Response response = target()
795 .accept(MediaType.APPLICATION_JSON)
796 .header(Constants.USER_ID_HEADER, user.getUserId())
797 .put(Entity.json(NON_UI_IMPORT_JSON));
799 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_BAD_REQUEST);
803 public void updateResourceExceptionDuringUpdateTest() {
804 String resourceId = RESOURCE_ID;
805 Map<String,String> parametersMap = new HashMap<>();
806 parametersMap.put(RESOURCE_ID, resourceId);
808 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
809 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
811 given(componentUtils.convertJsonToObjectUsingObjectMapper(eq(NON_UI_IMPORT_JSON), any(User.class),
812 eq(Resource.class), eq(AuditingActionEnum.UPDATE_RESOURCE_METADATA), eq(ComponentTypeEnum.RESOURCE)))
813 .willAnswer( invocation -> { throw new IOException("Test exception: updateResource"); });
815 Response response = target()
818 .accept(MediaType.APPLICATION_JSON)
819 .header(Constants.USER_ID_HEADER, user.getUserId())
820 .put(Entity.json(NON_UI_IMPORT_JSON));
822 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
826 public void updateResourceNonUiImportTest() {
827 String resourceId = RESOURCE_ID;
828 Map<String,String> parametersMap = new HashMap<>();
829 parametersMap.put(RESOURCE_ID, resourceId);
831 String formatEndpoint = "/v1/catalog/resources/{resourceId}";
832 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
834 Either<Resource, ResponseFormat> updateResourceEither = Either.left(new Resource());
836 when(componentUtils.convertJsonToObjectUsingObjectMapper(eq(NON_UI_IMPORT_JSON), any(User.class), eq(Resource.class),
837 eq(AuditingActionEnum.UPDATE_RESOURCE_METADATA), eq(ComponentTypeEnum.RESOURCE)))
838 .thenReturn(updateResourceEither);
840 when(resourceBusinessLogic.validateAndUpdateResourceFromCsar(any(), any(), any(), any(), eq(resourceId)))
841 .thenReturn(new Resource());
843 Response response = target()
846 .accept(MediaType.APPLICATION_JSON)
847 .header(Constants.USER_ID_HEADER, user.getUserId())
848 .put(Entity.json(NON_UI_IMPORT_JSON));
850 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
854 public void getResourceFromCsarTryGetNonExistingResourceTest() {
855 String csarUuid = CSAR_UUID;
856 Map<String,String> parametersMap = new HashMap<>();
857 parametersMap.put(CSAR_UUID, csarUuid);
859 String formatEndpoint = "/v1/catalog/resources/csar/{csaruuid}";
860 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
862 Either<Resource, ResponseFormat> getResourceFromCsarEither = Either.right(notFoundResponseFormat);
863 when(resourceBusinessLogic.getLatestResourceFromCsarUuid(eq(csarUuid), any(User.class)))
864 .thenReturn(getResourceFromCsarEither);
866 Response response = target()
869 .accept(MediaType.APPLICATION_JSON)
870 .header(Constants.USER_ID_HEADER, user.getUserId())
873 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_BAD_REQUEST);
877 public void getResourceFromCsarExceptionDuringGettingTest() {
878 String csarUuid = CSAR_UUID;
879 Map<String,String> parametersMap = new HashMap<>();
880 parametersMap.put(CSAR_UUID, csarUuid);
882 String formatEndpoint = "/v1/catalog/resources/csar/{csaruuid}";
883 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
885 given(resourceBusinessLogic.getLatestResourceFromCsarUuid(eq(csarUuid), any(User.class)))
886 .willAnswer( invocation -> { throw new IOException("Test exception: getResourceFromCsar"); });
888 Response response = target()
891 .accept(MediaType.APPLICATION_JSON)
892 .header(Constants.USER_ID_HEADER, user.getUserId())
895 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
899 public void getResourceFromCsarTest() {
900 String csarUuid = CSAR_UUID;
901 Map<String,String> parametersMap = new HashMap<>();
902 parametersMap.put(CSAR_UUID, csarUuid);
904 String formatEndpoint = "/v1/catalog/resources/csar/{csaruuid}";
905 String path = StrSubstitutor.replace(formatEndpoint, parametersMap, "{","}");
907 Either<Resource, ResponseFormat> getResourceFromCsarEither = Either.left(new Resource());
908 when(resourceBusinessLogic.getLatestResourceFromCsarUuid(eq(csarUuid), any(User.class)))
909 .thenReturn(getResourceFromCsarEither);
911 Response response = target()
914 .accept(MediaType.APPLICATION_JSON)
915 .header(Constants.USER_ID_HEADER, user.getUserId())
918 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_OK);
922 public void createResourceExceptionDuringCreateTest() {
923 String path = "/v1/catalog/resources";
925 given(componentUtils.convertJsonToObjectUsingObjectMapper(eq(NON_UI_IMPORT_JSON), any(User.class),
926 eq(Resource.class), eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.RESOURCE)))
927 .willAnswer( invocation -> { throw new IOException("Test exception: createResource"); });
929 Response response = target()
932 .accept(MediaType.APPLICATION_JSON)
933 .header(Constants.USER_ID_HEADER, user.getUserId())
934 .post(Entity.json(NON_UI_IMPORT_JSON));
936 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_INTERNAL_SERVER_ERROR);
940 public void createResourceNonUiImportProcessingFailedTest() {
941 String path = "/v1/catalog/resources";
943 Either<Resource, ResponseFormat> createResourceEither = Either.right(badRequestResponseFormat);
945 when(componentUtils.convertJsonToObjectUsingObjectMapper(eq(NON_UI_IMPORT_JSON), any(User.class),
946 eq(Resource.class), eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.RESOURCE)))
947 .thenReturn(createResourceEither);
949 Response response = target()
952 .accept(MediaType.APPLICATION_JSON)
953 .header(Constants.USER_ID_HEADER, user.getUserId())
954 .post(Entity.json(NON_UI_IMPORT_JSON));
956 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_BAD_REQUEST);
960 public void createResourceNonUiImportTest() {
961 String path = "/v1/catalog/resources";
963 Either<Resource, ResponseFormat> createResourceEither = Either.left(new Resource());
965 when(componentUtils.convertJsonToObjectUsingObjectMapper(eq(NON_UI_IMPORT_JSON), any(User.class),
966 eq(Resource.class), eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.RESOURCE)))
967 .thenReturn(createResourceEither);
969 when(resourceBusinessLogic.createResource(eq(createResourceEither.left().value()), eq(AuditingActionEnum.CREATE_RESOURCE),
970 any(User.class), any(), any()))
971 .thenReturn(new Resource());
973 Response response = target()
976 .accept(MediaType.APPLICATION_JSON)
977 .header(Constants.USER_ID_HEADER, user.getUserId())
978 .post(Entity.json(NON_UI_IMPORT_JSON));
980 assertThat(response.getStatus()).isEqualTo(HttpStatus.SC_CREATED);
983 private void encodeAndSetPayload(UploadResourceInfo mdJson, String payload) {
984 byte[] encodedBase64Payload = Base64.encodeBase64(payload.getBytes());
985 mdJson.setPayloadData(new String(encodedBase64Payload));
988 private void runAndVerifyActionStatusError(UploadResourceInfo mdJson, ActionStatus invalidResourcePayload) {
989 setMD5OnRequest(true, mdJson);
990 Response response = target().path("/v1/catalog/resources").request(MediaType.APPLICATION_JSON).post(Entity.json(gson.toJson(mdJson)), Response.class);
991 Mockito.verify(componentUtils, Mockito.times(1)).getResponseFormat(Mockito.any(ActionStatus.class));
992 Mockito.verify(componentUtils, Mockito.times(1)).getResponseFormat(invalidResourcePayload);
993 assertEquals(response.getStatus(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
996 private void setMD5OnRequest(boolean isValid, UploadResourceInfo json) {
997 String md5 = (isValid) ? GeneralUtility.calculateMD5Base64EncodedByString(gson.toJson(json)) : "stam=";
998 when(request.getHeader(Constants.MD5_HEADER)).thenReturn(md5);
1002 private UploadResourceInfo buildValidJson() {
1003 UploadResourceInfo ret = new UploadResourceInfo();
1004 ret.setName("ciMyCompute");
1005 ret.setPayloadName("ciMyCompute.yml");
1006 ret.addSubCategory("Application Layer 4+", "Application Servers");
1007 ret.setDescription("ResourceDescription");
1008 ret.setVendorName("VendorName");
1009 ret.setVendorRelease("VendorRelease");
1010 ret.setContactId("AT1234");
1011 ret.setIcon("router");
1012 ret.setTags(Collections.singletonList("ciMyCompute"));
1014 "dG9zY2FfZGVmaW5pdGlvbnNfdmVyc2lvbjogdG9zY2Ffc2ltcGxlX3lhbWxfMV8wXzANCm5vZGVfdHlwZXM6IA0KICBvcmcub3BlbmVjb21wLnJlc291cmNlLk15Q29tcHV0ZToNCiAgICBkZXJpdmVkX2Zyb206IHRvc2NhLm5vZGVzLlJvb3QNCiAgICBhdHRyaWJ1dGVzOg0KICAgICAgcHJpdmF0ZV9hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIHB1YmxpY19hZGRyZXNzOg0KICAgICAgICB0eXBlOiBzdHJpbmcNCiAgICAgIG5ldHdvcmtzOg0KICAgICAgICB0eXBlOiBtYXANCiAgICAgICAgZW50cnlfc2NoZW1hOg0KICAgICAgICAgIHR5cGU6IHRvc2NhLmRhdGF0eXBlcy5uZXR3b3JrLk5ldHdvcmtJbmZvDQogICAgICBwb3J0czoNCiAgICAgICAgdHlwZTogbWFwDQogICAgICAgIGVudHJ5X3NjaGVtYToNCiAgICAgICAgICB0eXBlOiB0b3NjYS5kYXRhdHlwZXMubmV0d29yay5Qb3J0SW5mbw0KICAgIHJlcXVpcmVtZW50czoNCiAgICAgIC0gbG9jYWxfc3RvcmFnZTogDQogICAgICAgICAgY2FwYWJpbGl0eTogdG9zY2EuY2FwYWJpbGl0aWVzLkF0dGFjaG1lbnQNCiAgICAgICAgICBub2RlOiB0b3NjYS5ub2Rlcy5CbG9ja1N0b3JhZ2UNCiAgICAgICAgICByZWxhdGlvbnNoaXA6IHRvc2NhLnJlbGF0aW9uc2hpcHMuQXR0YWNoZXNUbw0KICAgICAgICAgIG9jY3VycmVuY2VzOiBbMCwgVU5CT1VOREVEXSAgDQogICAgY2FwYWJpbGl0aWVzOg0KICAgICAgaG9zdDogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5Db250YWluZXINCiAgICAgICAgdmFsaWRfc291cmNlX3R5cGVzOiBbdG9zY2Eubm9kZXMuU29mdHdhcmVDb21wb25lbnRdIA0KICAgICAgZW5kcG9pbnQgOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuRW5kcG9pbnQuQWRtaW4gDQogICAgICBvczogDQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5PcGVyYXRpbmdTeXN0ZW0NCiAgICAgIHNjYWxhYmxlOg0KICAgICAgICB0eXBlOiB0b3NjYS5jYXBhYmlsaXRpZXMuU2NhbGFibGUNCiAgICAgIGJpbmRpbmc6DQogICAgICAgIHR5cGU6IHRvc2NhLmNhcGFiaWxpdGllcy5uZXR3b3JrLkJpbmRhYmxl");
1019 protected Application configure() {
1020 ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
1021 forceSet(TestProperties.CONTAINER_PORT, "0");
1022 return new ResourceConfig(ResourcesServlet.class)
1023 .register(new AbstractBinder() {
1025 protected void configure() {
1026 bind(request).to(HttpServletRequest.class);
1027 bind(servletUtils).to(ServletUtils.class);
1028 bind(componentUtils).to(ComponentsUtils.class);
1029 bind(userBusinessLogic).to(UserBusinessLogic.class);
1030 bind(resourceBusinessLogic).to(ResourceBusinessLogic.class);
1031 bind(groupBL).to(GroupBusinessLogic.class);
1032 bind(componentInstanceBL).to(ComponentInstanceBusinessLogic.class);
1033 bind(resourceImportManager).to(ResourceImportManager.class);
1036 .property("contextConfig", context);