aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java37
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java24
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java19
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java14
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java13
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java17
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java19
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java14
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java11
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java11
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java18
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java12
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java15
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java19
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java132
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java13
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java13
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java12
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java16
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java30
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java19
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java17
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java22
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java10
28 files changed, 427 insertions, 117 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java
index bb1e663363..a33b24d5da 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/distribution/servlet/DistributionServletTest.java
@@ -20,8 +20,18 @@
package org.openecomp.sdc.be.distribution.servlet;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.ResourceConfig;
@@ -33,13 +43,17 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.openecomp.sdc.be.components.distribution.engine.DistributionEngine;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.distribution.AuditHandler;
import org.openecomp.sdc.be.distribution.DistributionBusinessLogic;
import org.openecomp.sdc.be.distribution.api.client.RegistrationRequest;
import org.openecomp.sdc.be.distribution.api.client.TopicRegistrationResponse;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
@@ -48,18 +62,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.context.WebApplicationContext;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
public class DistributionServletTest extends JerseyTest {
public static final HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
@@ -84,7 +86,6 @@ public class DistributionServletTest extends JerseyTest {
when(session.getServletContext()).thenReturn(servletContext);
when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper);
when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webApplicationContext);
- when(webApplicationContext.getBean(DistributionBusinessLogic.class)).thenReturn(distributionBusinessLogic);
when(distributionBusinessLogic.getDistributionEngine()).thenReturn(distributionEngine);
when(distributionEngine.isEnvironmentAvailable(ENV_NAME)).thenReturn(StorageOperationStatus.OK);
when(distributionEngine.isEnvironmentAvailable()).thenReturn(StorageOperationStatus.OK);
@@ -145,6 +146,11 @@ public class DistributionServletTest extends JerseyTest {
@Override
protected Application configure() {
+ UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class);
+ GroupBusinessLogic groupBusinessLogic = Mockito.mock(GroupBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class);
+ ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class);
+
ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
forceSet(TestProperties.CONTAINER_PORT, "0");
return new ResourceConfig(DistributionServlet.class)
@@ -153,6 +159,11 @@ public class DistributionServletTest extends JerseyTest {
@Override
protected void configure() {
bind(request).to(HttpServletRequest.class);
+ bind(userBusinessLogic).to(UserBusinessLogic.class);
+ bind(groupBusinessLogic).to(GroupBusinessLogic.class);
+ bind(componentInstanceBusinessLogic).to(ComponentInstanceBusinessLogic.class);
+ bind(componentsUtils).to(ComponentsUtils.class);
+ bind(distributionBusinessLogic).to(DistributionBusinessLogic.class);
}
})
.property("contextConfig", context);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java
index fa700a8dc5..24f06b4543 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/AssetsDataServletTest.java
@@ -33,9 +33,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ElementBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -47,6 +49,7 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.datastructure.FunctionalInterfaces;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
@@ -65,7 +68,6 @@ import javax.ws.rs.core.Response;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
public class AssetsDataServletTest extends JerseyTest {
@@ -85,9 +87,10 @@ public class AssetsDataServletTest extends JerseyTest {
public static final CategoryDefinition categoryDefinition = Mockito.mock(CategoryDefinition.class);
public static final SubCategoryDefinition subCategoryDefinition = Mockito.mock(SubCategoryDefinition.class);
public static final AssetMetadataConverter assetMetadataConverter = Mockito.mock(AssetMetadataConverter.class);
-// public static final ResourceAssetMetadata resourceAssetMetadata = Mockito.mock(ResourceAssetMetadata.class);
- public static final ResourceAssetMetadata resourceAssetMetadata = new ResourceAssetMetadata();;
-
+ public static final ResourceAssetMetadata resourceAssetMetadata = new ResourceAssetMetadata();
+ public static final UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class);
+ public static final ComponentInstanceBusinessLogic componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class);
+ public static final LifecycleBusinessLogic lifecycleBusinessLogic = Mockito.mock(LifecycleBusinessLogic.class);
@@ -157,7 +160,7 @@ public class AssetsDataServletTest extends JerseyTest {
final JSONObject createRequest = buildCreateJsonRequest();
Response response = target().path("/v1/catalog/resources").request(MediaType.APPLICATION_JSON).header(Constants.X_ECOMP_INSTANCE_ID_HEADER, "mockXEcompInstanceId").header(Constants.USER_ID_HEADER, "mockAttID")
.post(Entity.json(createRequest.toJSONString()), Response.class);
- assertEquals(response.getStatus(), HttpStatus.SC_CREATED);
+ assertEquals(HttpStatus.SC_CREATED, response.getStatus());
}
private static final String BASIC_CREATE_REQUEST = "{\r\n" +
@@ -191,8 +194,17 @@ public class AssetsDataServletTest extends JerseyTest {
@Override
protected void configure() {
bind(request).to(HttpServletRequest.class);
+ bind(userBusinessLogic).to(UserBusinessLogic.class);
+ bind(componentInstanceBusinessLogic).to(ComponentInstanceBusinessLogic.class);
+ bind(componentsUtils).to(ComponentsUtils.class);
+ bind(servletUtils).to(ServletUtils.class);
+ bind(resourceImportManager).to(ResourceImportManager.class);
+ bind(elementBusinessLogic).to(ElementBusinessLogic.class);
+ bind(assetMetadataConverter).to(AssetMetadataConverter.class);
+ bind(lifecycleBusinessLogic).to(LifecycleBusinessLogic.class);
+ bind(resourceBusinessLogic).to(ResourceBusinessLogic.class);
}
})
.property("contextConfig", context);
}
-}
+} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
index 8036213f1e..97f15022c0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
@@ -135,11 +135,10 @@ public class ExternalRefServletTest extends JerseyTest {
private GraphVertex resourceVertex;
private ExternalReferencesOperation externalReferenceOperation;
private HealingJanusGraphDao janusGraphDao;
- private OperationUtils operationUtils;
@Bean
ExternalRefsServlet externalRefsServlet() {
- return new ExternalRefsServlet(externalRefsBusinessLogic(), componentUtils);
+ return new ExternalRefsServlet(userAdmin, componentUtils, externalRefsBusinessLogic());
}
@Bean
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java
index 70a7fe898a..5158c438df 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AbstractValidationsServletTest.java
@@ -23,8 +23,16 @@ package org.openecomp.sdc.be.servlets;
import fj.data.Either;
import org.apache.commons.codec.binary.Base64;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.externalapi.servlet.ArtifactExternalServlet;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ServletUtils;
import org.openecomp.sdc.be.model.UploadResourceInfo;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -40,9 +48,18 @@ import java.util.stream.Stream;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
public class AbstractValidationsServletTest {
- private static AbstractValidationsServlet servlet = new AbstractValidationsServlet() {};
+ private static UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ private static ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ private static ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ private static ServletUtils servletUtils = mock(ServletUtils.class);
+ private static ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
+ private static ArtifactsBusinessLogic artifactsBusinessLogic = mock(ArtifactsBusinessLogic.class);
+
+ private static AbstractValidationsServlet servlet = new ArtifactExternalServlet(userBusinessLogic,
+ componentInstanceBL, componentsUtils, servletUtils, resourceImportManager, artifactsBusinessLogic);
private static final String BASIC_TOSCA_TEMPLATE = "tosca_definitions_version: tosca_simple_yaml_%s";
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java
index b0306ce86b..e49420ef3b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AdditionalInformationServletTest.java
@@ -20,16 +20,28 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class AdditionalInformationServletTest {
private AdditionalInformationServlet createTestSubject() {
- return new AdditionalInformationServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ AdditionalInformationBusinessLogic additionalInformationBusinessLogic =
+ mock(AdditionalInformationBusinessLogic.class);
+ return new AdditionalInformationServlet(userBusinessLogic, componentsUtils,
+ additionalInformationBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
index 50cd2570b9..2636048408 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
@@ -317,7 +317,7 @@ public class ArchiveEndpointTest extends JerseyTest {
when(userAdmin.getUser(otherUser.getUserId(), false)).thenReturn(otherEither);
//========================================================================================================================
- String appConfigDir = "src/test/resources/config";
+ String appConfigDir = "src/test/resources/config/catalog-be";
ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
ConfigurationManager configurationManager = new ConfigurationManager(configurationSource);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java
index 0e66d83f18..74a6555eca 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArtifactServletTest.java
@@ -20,16 +20,27 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class ArtifactServletTest {
private ArtifactServlet createTestSubject() {
- return new ArtifactServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ArtifactsBusinessLogic artifactsBusinessLogic = mock(ArtifactsBusinessLogic.class);
+ return new ArtifactServlet(userBusinessLogic, componentsUtils,artifactsBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java
index 196d47a3a3..47d2cf4f2f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AttributeServletTest.java
@@ -20,11 +20,19 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ServletUtils;
import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.exception.ResponseFormat;
import com.google.common.base.Equivalence.Wrapper;
@@ -32,7 +40,14 @@ import com.google.common.base.Equivalence.Wrapper;
public class AttributeServletTest {
private AttributeServlet createTestSubject() {
- return new AttributeServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ServletUtils servletUtils = mock(ServletUtils.class);
+ ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
+
+ return new AttributeServlet(userBusinessLogic, componentInstanceBL, componentsUtils, servletUtils,
+ resourceImportManager);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java
index 9e3e9c9dbb..3f07d95096 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/AutomatedUpgradeEndpointTest.java
@@ -30,6 +30,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.components.upgrade.ServiceInfo;
@@ -47,6 +48,7 @@ import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import org.openecomp.sdc.be.model.jsonjanusgraph.operations.UpgradeOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ConfigurationSource;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
@@ -111,7 +113,12 @@ public class AutomatedUpgradeEndpointTest extends JerseySpringBaseTest {
@Bean
AutomatedUpgradeEndpoint automatedUpgradeEndpoint() {
- return new AutomatedUpgradeEndpoint(upgradeBusinessLogic());
+
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+
+ return new AutomatedUpgradeEndpoint(userBusinessLogic, componentsUtils,
+ upgradeBusinessLogic());
}
@Bean
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java
index f9336aa8be..ca407eaed0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentInstanceServletTest.java
@@ -36,6 +36,9 @@ import org.junit.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic;
import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -46,6 +49,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.RequirementDefinition;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.exception.ResponseFormat;
import org.springframework.context.ApplicationContext;
@@ -82,6 +86,10 @@ public class ComponentInstanceServletTest extends JerseyTest {
private static ComponentsUtils componentsUtils;
private static ServletUtils servletUtils;
private static ResponseFormat responseFormat;
+ private static UserBusinessLogic userBusinessLogic;
+ private static GroupBusinessLogic groupBusinessLogic;
+ private static ResourceImportManager resourceImportManager;
+ private static ServiceBusinessLogic serviceBusinessLogic;
@BeforeClass
public static void setup() {
@@ -271,6 +279,13 @@ public class ComponentInstanceServletTest extends JerseyTest {
@Override
protected void configure() {
bind(request).to(HttpServletRequest.class);
+ bind(userBusinessLogic).to(UserBusinessLogic.class);
+ bind(groupBusinessLogic).to(GroupBusinessLogic.class);
+ bind(componentInstanceBusinessLogic).to(ComponentInstanceBusinessLogic.class);
+ bind(componentsUtils).to(ComponentsUtils.class);
+ bind(servletUtils).to(ServletUtils.class);
+ bind(resourceImportManager).to(ResourceImportManager.class);
+ bind(serviceBusinessLogic).to(ServiceBusinessLogic.class);
}
})
.property("contextConfig", context);
@@ -282,10 +297,14 @@ public class ComponentInstanceServletTest extends JerseyTest {
servletContext = Mockito.mock(ServletContext.class);
webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class);
webApplicationContext = Mockito.mock(WebApplicationContext.class);
+ userBusinessLogic = Mockito.mock(UserBusinessLogic.class);
+ groupBusinessLogic = Mockito.mock(GroupBusinessLogic.class);
+ resourceImportManager = Mockito.mock(ResourceImportManager.class);
componentInstanceBusinessLogic = Mockito.mock(ComponentInstanceBusinessLogic.class);
componentsUtils = Mockito.mock(ComponentsUtils.class);
servletUtils = Mockito.mock(ServletUtils.class);
responseFormat = Mockito.mock(ResponseFormat.class);
+ serviceBusinessLogic = Mockito.mock(ServiceBusinessLogic.class);
}
private static void stubMethods() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java
index f736cf46e7..4fcbd06927 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentPropertyServletTest.java
@@ -72,11 +72,6 @@ public class ComponentPropertyServletTest extends JerseySpringBaseTest {
private static final String INVALID_PROPERTY_NAME = "invalid_name_$.&";
private static final String STRING_TYPE = "string";
- @Before
- public void initClass() {
- initMockitoStubbings();
- }
-
@Test
public void testCreatePropertyOnService_success() {
PropertyDefinition property = new PropertyDefinition();
@@ -110,15 +105,6 @@ public class ComponentPropertyServletTest extends JerseySpringBaseTest {
Assert.assertEquals(HttpStatus.BAD_REQUEST_400.getStatusCode(), propertyInService.getStatus());
}
- private static void initMockitoStubbings() {
- when(request.getSession()).thenReturn(session);
- when(session.getServletContext()).thenReturn(context);
- when(context.getAttribute(eq(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR))).thenReturn(wrapper);
- when(wrapper.getWebAppContext(any())).thenReturn(webAppContext);
- when(webAppContext.getBean(eq(PropertyBusinessLogic.class))).thenReturn(propertyBl);
- when(webAppContext.getBean(eq(ComponentsUtils.class))).thenReturn(componentsUtils);
- }
-
private String getValidProperty() {
return "{\n"
+ " \"valid_name_123\": {\n"
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java
index 9921561068..8f823c3a7c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ComponentServletTest.java
@@ -27,11 +27,15 @@ import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogicProvider;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
import org.openecomp.sdc.be.components.utils.PolicyDefinitionBuilder;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.Constants;
import javax.ws.rs.client.Invocation;
@@ -51,6 +55,8 @@ public class ComponentServletTest extends JerseySpringBaseTest{
private static final String USER_ID = "userId";
private static final String RESOURCE_ID = "resourceId";
private ResourceBusinessLogic resourceBusinessLogic;
+ private UserBusinessLogic userBusinessLogic;
+ private ComponentsUtils componentsUtils;
private PolicyDefinition policy1, policy2;
@Override
@@ -64,7 +70,10 @@ public class ComponentServletTest extends JerseySpringBaseTest{
@Override
protected ResourceConfig configure() {
resourceBusinessLogic = mock(ResourceBusinessLogic.class);
- ComponentServlet componentServlet = new ComponentServlet(new ComponentBusinessLogicProvider(resourceBusinessLogic, null, null));
+ userBusinessLogic = mock(UserBusinessLogic.class);
+ componentsUtils = mock(ComponentsUtils.class);
+ ComponentServlet componentServlet = new ComponentServlet(userBusinessLogic, componentsUtils,
+ new ComponentBusinessLogicProvider(resourceBusinessLogic, null, null));
return super.configure().register(componentServlet);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java
index a2ba87d3d8..6aa11a6366 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ConsumerServletTest.java
@@ -20,15 +20,21 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.ConsumerDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.exception.ResponseFormat;
import fj.data.Either;
@@ -36,7 +42,10 @@ import fj.data.Either;
public class ConsumerServletTest {
private ConsumerServlet createTestSubject() {
- return new ConsumerServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ConsumerBusinessLogic consumerBusinessLogic = mock(ConsumerBusinessLogic.class);
+ return new ConsumerServlet(userBusinessLogic, componentsUtils, consumerBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java
index 001d5c8d5f..6d820841f0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/CsarBuildServletTest.java
@@ -20,16 +20,32 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.DownloadArtifactLogic;
+import org.openecomp.sdc.be.impl.ServletUtils;
+import org.openecomp.sdc.be.resources.api.IResourceUploader;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class CsarBuildServletTest {
private CsarBuildServlet createTestSubject() {
- return new CsarBuildServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ IResourceUploader resourceUploader = mock(IResourceUploader.class);
+ DownloadArtifactLogic logic = mock(DownloadArtifactLogic.class);
+
+ return new CsarBuildServlet(userBusinessLogic, componentsUtils, resourceUploader,
+ logic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java
index c41e1fd21f..df26749ef0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/DistributionServiceServletTest.java
@@ -20,17 +20,27 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.DistributionMonitoringBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class DistributionServiceServletTest {
private DistributionServiceServlet createTestSubject() {
- return new DistributionServiceServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ DistributionMonitoringBusinessLogic distributionMonitoringLogic = mock(DistributionMonitoringBusinessLogic.class);
+ return new DistributionServiceServlet(userBusinessLogic, componentsUtils,
+ distributionMonitoringLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java
index 7d3eca8f16..ac17e2bf6b 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ElementServletTest.java
@@ -20,18 +20,31 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ElementBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLogic;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class ElementServletTest {
private ElementServlet createTestSubject() {
- return new ElementServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ComponentsCleanBusinessLogic componentsCleanBusinessLogic = mock(ComponentsCleanBusinessLogic.class);
+ ElementBusinessLogic elementBusinessLogic = mock(ElementBusinessLogic.class);
+ return new ElementServlet(userBusinessLogic, componentsUtils, componentsCleanBusinessLogic, elementBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java
index b6fab7864a..01383eae14 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/GroupServletTest.java
@@ -20,15 +20,32 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.DownloadArtifactLogic;
+import org.openecomp.sdc.be.impl.ServletUtils;
+import org.openecomp.sdc.be.resources.api.IResourceUploader;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class GroupServletTest {
private GroupServlet createTestSubject() {
- return new GroupServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ GroupBusinessLogic groupBL = mock(GroupBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ServletUtils servletUtils = mock(ServletUtils.class);
+ ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
+ return new GroupServlet(userBusinessLogic, groupBL, componentInstanceBL, componentsUtils, servletUtils,
+ resourceImportManager);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java
index 07184704d4..da5352c206 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/InputsServletTest.java
@@ -21,14 +21,24 @@
package org.openecomp.sdc.be.servlets;
import fj.data.Either;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Application;
+import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.grizzly.http.util.HttpStatus;
+import org.glassfish.jersey.test.JerseyTest;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
import org.openecomp.sdc.be.components.impl.DataTypeBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
import org.openecomp.sdc.be.components.impl.InputsBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
+import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -43,8 +53,11 @@ import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.Constants;
import org.openecomp.sdc.exception.ResponseFormat;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.web.context.WebApplicationContext;
import javax.servlet.ServletContext;
@@ -64,7 +77,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
-public class InputsServletTest extends JerseySpringBaseTest {
+public class InputsServletTest extends JerseyTest {
/* Constants */
private static final String RESOURCE_ID = "serviceId";
@@ -79,62 +92,78 @@ public class InputsServletTest extends JerseySpringBaseTest {
private static final String LISTINPUT_PROP2_NAME = "prop2";
private static final String LISTINPUT_PROP2_TYPE = "integer";
- /* Test subject */
- private InputsServletForTest testSubject;
-
/* Mocks */
- private InputsBusinessLogic inputsBusinessLogic;
- private DataTypeBusinessLogic dataTypeBusinessLogic;
- private HttpSession httpSession;
- private ServletContext servletContext;
- private WebApplicationContext webApplicationContext;
- private ComponentsUtils componentsUtils;
- private ServletUtils servletUtils;
-
- /**
- * This class extends the original InputsServlet
- * and provides methods to inject mocks
- */
- class InputsServletForTest extends InputsServlet {
- public void setComponentsUtils(ComponentsUtils componentsUtils) {
- this.componentsUtils = componentsUtils;
- }
-
- public void setServletUtils(ServletUtils servletUtils) {
- this.servletUtils = servletUtils;
- }
- }
-
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ private static UserBusinessLogic userBusinessLogic;
+ private static InputsBusinessLogic inputsBusinessLogic;
+ private static DataTypeBusinessLogic dataTypeBusinessLogic;
+ private static GroupBusinessLogic groupBL;
+ private static ComponentInstanceBusinessLogic componentInstanceBL;
+ private static HttpSession httpSession;
+ private static ServletContext servletContext;
+ private static WebApplicationContext webApplicationContext;
+ private static ComponentsUtils componentsUtils;
+ private static ServletUtils servletUtils;
+ private static ResourceImportManager resourceImportManager;
+ private static HttpServletRequest request;
+
+ @BeforeClass
+ public static void configureMocks() {
+ request = mock(HttpServletRequest.class);
+ userBusinessLogic = mock(UserBusinessLogic.class);
inputsBusinessLogic = mock(InputsBusinessLogic.class);
+ groupBL = mock(GroupBusinessLogic.class);
+ componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
dataTypeBusinessLogic = mock(DataTypeBusinessLogic.class);
servletContext = mock(ServletContext.class);
httpSession = mock(HttpSession.class);
webApplicationContext = mock(WebApplicationContext.class);
componentsUtils = mock(ComponentsUtils.class);
servletUtils = mock(ServletUtils.class);
+ resourceImportManager = mock(ResourceImportManager.class);
+ }
+
+ @Before
+ public void resetMocks() {
+ Mockito.reset(resourceImportManager);
+ Mockito.reset(servletUtils);
+ Mockito.reset(componentsUtils);
+ Mockito.reset(webApplicationContext);
+ Mockito.reset(httpSession);
+ Mockito.reset(servletContext);
+ Mockito.reset(dataTypeBusinessLogic);
+ Mockito.reset(componentInstanceBL);
+ Mockito.reset(groupBL);
+ Mockito.reset(inputsBusinessLogic);
+ Mockito.reset(userBusinessLogic);
+ Mockito.reset(request);
+
when(request.getSession()).thenReturn(httpSession);
when(httpSession.getServletContext()).thenReturn(servletContext);
- when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(new WebAppContextWrapper());
+ when(servletContext.getAttribute(
+ Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(new WebAppContextWrapper());
when(servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE)).thenReturn(webApplicationContext);
- when(webApplicationContext.getBean(InputsBusinessLogic.class)).thenReturn(inputsBusinessLogic);
- when(webApplicationContext.getBean(DataTypeBusinessLogic.class)).thenReturn(dataTypeBusinessLogic);
- testSubject.setComponentsUtils(componentsUtils);
- testSubject.setServletUtils(servletUtils);
when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils);
}
-
@Override
- protected ResourceConfig configure() {
- testSubject = new InputsServletForTest();
- return super.configure().register(testSubject);
+ protected Application configure() {
+ InputsServlet inputsServlet = new InputsServlet(userBusinessLogic, inputsBusinessLogic,
+ componentInstanceBL, componentsUtils,
+ servletUtils, resourceImportManager, dataTypeBusinessLogic);
+ ResourceConfig resourceConfig = new ResourceConfig()
+ .register(inputsServlet)
+ .register(new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(request).to(HttpServletRequest.class);
+ }
+ });
+
+ ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
+ resourceConfig.property("contextConfig", context);
+ return resourceConfig;
}
-
private InputDefinition setUpListInput() {
InputDefinition listInput = new InputDefinition();
listInput.setName(LISTINPUT_NAME);
@@ -184,15 +213,14 @@ public class InputsServletTest extends JerseySpringBaseTest {
ComponentInstListInput requestBodyObj = setUpCreateListInputParams();
Entity<ComponentInstListInput> entity = Entity.entity(requestBodyObj, MediaType.APPLICATION_JSON);
- // for parseToComponentInstListInput
- when(componentsUtils.convertJsonToObjectUsingObjectMapper(any(), any(), eq(ComponentInstListInput.class),
- eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.SERVICE)))
- .thenReturn(Either.left(requestBodyObj));
+ doReturn(Either.left(requestBodyObj)).when(componentsUtils).convertJsonToObjectUsingObjectMapper(any(), any(), eq(ComponentInstListInput.class),
+ eq(AuditingActionEnum.CREATE_RESOURCE), eq(ComponentTypeEnum.SERVICE));
- when(inputsBusinessLogic.createListInput(eq(USER_ID), eq(RESOURCE_ID), eq(ComponentTypeEnum.SERVICE),
- any(), eq(true), eq(false)))
- .thenReturn(Either.left(Collections.emptyList()));
- when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
+ doReturn(Either.left(Collections.emptyList())).when(inputsBusinessLogic).createListInput(eq(USER_ID), eq(RESOURCE_ID), eq(ComponentTypeEnum.SERVICE),
+ any(), eq(true), eq(false));
+
+ ResponseFormat responseFormat = new ResponseFormat(HttpStatus.OK_200.getStatusCode());
+ doReturn(responseFormat).when(componentsUtils).getResponseFormat(ActionStatus.OK);
Response response = buildCreateListInputCall().post(entity);
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200.getStatusCode());
@@ -379,9 +407,11 @@ public class InputsServletTest extends JerseySpringBaseTest {
@Test
public void test_deleteInput_failure_deleteInput() throws Exception {
- when(inputsBusinessLogic.deleteInput(RESOURCE_ID, USER_ID, LISTINPUT_NAME))
- .thenReturn(Either.right(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode())));
- when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(new ResponseFormat(HttpStatus.OK_200.getStatusCode()));
+ doReturn(Either.right(new ResponseFormat(HttpStatus.BAD_REQUEST_400.getStatusCode()))).when(inputsBusinessLogic)
+ .deleteInput(RESOURCE_ID, USER_ID, LISTINPUT_NAME);
+
+ ResponseFormat responseFormat = new ResponseFormat(HttpStatus.OK_200.getStatusCode());
+ doReturn(responseFormat).when(componentsUtils).getResponseFormat(ActionStatus.OK);
// invoke delete call
Response response = target("/v1/catalog/services/{id}/delete/{inputId}/input")
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java
index de6aa77f6a..b69f2a58dd 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/LifecycleServletTest.java
@@ -20,19 +20,30 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.LifeCycleTransitionEnum;
import org.openecomp.sdc.be.model.User;
import fj.data.Either;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class LifecycleServletTest {
private LifecycleServlet createTestSubject() {
- return new LifecycleServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ LifecycleBusinessLogic lifecycleBusinessLogic = mock(LifecycleBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+
+ return new LifecycleServlet(userBusinessLogic, componentsUtils, lifecycleBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java
index 6d23b9871d..cdb66185ab 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java
@@ -467,7 +467,8 @@ public class PolicyServletTest extends JerseySpringBaseTest{
@Override
protected ResourceConfig configure() {
return super.configure()
- .register(new PolicyServlet(businessLogic, servletUtils, null, componentsUtils));
+ .register(new PolicyServlet(null, null, componentsUtils,
+ servletUtils, null, businessLogic));
}
private static void createMocks() {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java
index bbd0d4c711..352c76a3f6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ProductServletTest.java
@@ -20,15 +20,26 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ProductBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class ProductServletTest {
private ProductServlet createTestSubject() {
- return new ProductServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ProductBusinessLogic productBusinessLogic = mock(ProductBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+
+ return new ProductServlet(userBusinessLogic, productBusinessLogic, componentsUtils);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java
index be25f6e96e..61f2b15e65 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/RequirementsServletTest.java
@@ -20,15 +20,25 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class RequirementsServletTest {
private RequirementsServlet createTestSubject() {
- return new RequirementsServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+
+ return new RequirementsServlet(userBusinessLogic, componentsUtils);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java
index 573244039d..02a16f86dc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceArtifactDownloadServletTest.java
@@ -20,17 +20,31 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
import ch.qos.logback.classic.Logger;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.DownloadArtifactLogic;
+import org.openecomp.sdc.be.resources.api.IResourceUploader;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class ResourceArtifactDownloadServletTest {
private ResourceArtifactDownloadServlet createTestSubject() {
- return new ResourceArtifactDownloadServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ IResourceUploader resourceUploader = mock(IResourceUploader.class);
+ DownloadArtifactLogic downloadArtifactLogic = mock(DownloadArtifactLogic.class);
+
+ return new ResourceArtifactDownloadServlet(userBusinessLogic, componentsUtils,
+ resourceUploader, downloadArtifactLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
index 8b8dfc6b9c..2cbf1e2c86 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceServletTest.java
@@ -35,6 +35,9 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
import org.openecomp.sdc.be.components.impl.ResourceImportManager;
import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.dao.api.ActionStatus;
@@ -251,16 +254,27 @@ public class ResourceServletTest extends JerseyTest {
@Override
protected Application configure() {
+ UserBusinessLogic userBusinessLogic = Mockito.mock(UserBusinessLogic.class);
+ GroupBusinessLogic groupBL = Mockito.mock(GroupBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = Mockito.mock(ComponentInstanceBusinessLogic.class);
+ ResourceBusinessLogic resourceBusinessLogic = Mockito.mock(ResourceBusinessLogic.class);
+
ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
forceSet(TestProperties.CONTAINER_PORT, "0");
return new ResourceConfig(ResourcesServlet.class)
- .register(new AbstractBinder() {
- @Override
- protected void configure() {
- bind(request).to(HttpServletRequest.class);
- }
- })
- .property("contextConfig", context);
-
+ .register(new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(request).to(HttpServletRequest.class);
+ bind(servletUtils).to(ServletUtils.class);
+ bind(componentUtils).to(ComponentsUtils.class);
+ bind(userBusinessLogic).to(UserBusinessLogic.class);
+ bind(resourceBusinessLogic).to(ResourceBusinessLogic.class);
+ bind(groupBL).to(GroupBusinessLogic.class);
+ bind(componentInstanceBL).to(ComponentInstanceBusinessLogic.class);
+ bind(resourceImportManager).to(ResourceImportManager.class);
+ }
+ })
+ .property("contextConfig", context);
}
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java
index dbce3e5048..42103b0740 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourcesServletTest.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import java.util.List;
import java.util.Map;
@@ -27,9 +29,16 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.GroupBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic;
+import org.openecomp.sdc.be.components.impl.ResourceImportManager;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ServletUtils;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.exception.ResponseFormat;
import com.google.common.base.Equivalence.Wrapper;
@@ -39,7 +48,15 @@ import fj.data.Either;
public class ResourcesServletTest {
private ResourcesServlet createTestSubject() {
- return new ResourcesServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ ResourceBusinessLogic resourceBusinessLogic = mock(ResourceBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ServletUtils servletUtils = mock(ServletUtils.class);
+ ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
+
+ return new ResourcesServlet(userBusinessLogic, componentInstanceBL, resourceBusinessLogic, componentsUtils, servletUtils,
+ resourceImportManager);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java
index 6d8f400760..c2a8afec85 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ServiceServletTest.java
@@ -20,14 +20,20 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.openecomp.sdc.be.components.impl.*;
import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ServletUtils;
import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.exception.ResponseFormat;
import com.google.common.base.Equivalence.Wrapper;
@@ -38,7 +44,16 @@ import fj.data.Either;
public class ServiceServletTest {
private ServiceServlet createTestSubject() {
- return new ServiceServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ServletUtils servletUtils = mock(ServletUtils.class);
+ ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
+ ServiceBusinessLogic serviceBusinessLogic = mock(ServiceBusinessLogic.class);
+ ResourceBusinessLogic resourceBusinessLogic = mock(ResourceBusinessLogic.class);
+
+ return new ServiceServlet(userBusinessLogic, componentInstanceBL, componentsUtils, servletUtils,
+ resourceImportManager, serviceBusinessLogic, resourceBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java
index 5127be879b..f27c886e68 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesFetchServletTest.java
@@ -20,17 +20,35 @@
package org.openecomp.sdc.be.servlets;
+import static org.mockito.Mockito.mock;
+
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Test;
-import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic;
+import org.openecomp.sdc.be.components.impl.*;
+import org.openecomp.sdc.be.impl.ComponentsUtils;
+import org.openecomp.sdc.be.impl.ServletUtils;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
public class TypesFetchServletTest {
private TypesFetchServlet createTestSubject() {
- return new TypesFetchServlet();
+ UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+ ComponentInstanceBusinessLogic componentInstanceBL = mock(ComponentInstanceBusinessLogic.class);
+ ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+ ServletUtils servletUtils = mock(ServletUtils.class);
+ ResourceImportManager resourceImportManager = mock(ResourceImportManager.class);
+ PropertyBusinessLogic propertyBusinessLogic = mock(PropertyBusinessLogic.class);
+ RelationshipTypeBusinessLogic relationshipTypeBusinessLogic = mock(RelationshipTypeBusinessLogic.class);
+ CapabilitiesBusinessLogic capabilitiesBusinessLogic = mock(CapabilitiesBusinessLogic.class);
+ InterfaceOperationBusinessLogic interfaceOperationBusinessLogic = mock(InterfaceOperationBusinessLogic.class);
+ ResourceBusinessLogic resourceBusinessLogic = mock(ResourceBusinessLogic.class);
+
+ return new TypesFetchServlet(userBusinessLogic, componentInstanceBL, componentsUtils, servletUtils,
+ resourceImportManager, propertyBusinessLogic, relationshipTypeBusinessLogic, capabilitiesBusinessLogic,
+ interfaceOperationBusinessLogic, resourceBusinessLogic);
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java
index 807ded8f5c..92652f59d0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java
@@ -112,7 +112,7 @@ public class TypesUploadServletTest extends JerseyTest {
Response response = target().path("/v1/catalog/uploadType/capability").request(MediaType.APPLICATION_JSON).post(Entity.entity(multipartEntity, MediaType.MULTIPART_FORM_DATA), Response.class);
- assertEquals(response.getStatus(), HttpStatus.CREATED_201);
+ assertEquals(HttpStatus.CREATED_201, response.getStatus());
}
@@ -124,8 +124,14 @@ public class TypesUploadServletTest extends JerseyTest {
@Override
protected ResourceConfig configure() {
+
+
+ TypesUploadServlet typesUploadServlet = new TypesUploadServlet(null, null, componentUtils,
+ servletUtils, null, importManager, null,
+ null, null,
+ null, null, null);
ResourceConfig resourceConfig = new ResourceConfig()
- .register(new TypesUploadServlet(importManager, null, null, null, null, null, null));
+ .register(typesUploadServlet);
resourceConfig.register(MultiPartFeature.class);
resourceConfig.register(new AbstractBinder() {