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/servlets/ModelServletTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java15
2 files changed, 9 insertions, 9 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
index 12f803fd19..e40124fff4 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
@@ -49,7 +49,6 @@ import org.glassfish.jersey.test.TestProperties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
@@ -105,8 +104,6 @@ class ModelServletTest extends JerseyTest {
private ResourceImportManager resourceImportManager;
@Mock
private ModelBusinessLogic modelBusinessLogic;
- @InjectMocks
- private ModelServlet modelServlet;
@Mock
private ResponseFormat responseFormat;
@Mock
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java
index 31152c63e7..9d0966b770 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ResourceUploadServletTest.java
@@ -122,7 +122,6 @@ class ResourceUploadServletTest extends JerseyTest {
private final String modelName = "ETSI-SOL001-331";
private final String rootPath = "/v1/catalog/upload/multipart";
- private Response response;
private User user;
@BeforeAll
@@ -203,7 +202,7 @@ class ResourceUploadServletTest extends JerseyTest {
when(resourceImportManager.importNormativeResource(anyString(), any(), any(), anyBoolean(), anyBoolean()))
.thenReturn(new ImmutablePair<>(new Resource(), ActionStatus.CREATED));
when(modelBusinessLogic.findModel(modelName)).thenReturn(Optional.of(new Model(modelName)));
- response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
+ final var response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
.header(Constants.USER_ID_HEADER, USER_ID)
.post(Entity.entity(buildFormDataMultiPart("node-types/TestNodeType001.zip",
"src/test/resources/node-types/nodeTypeWithModelsField.json"), MediaType.MULTIPART_FORM_DATA), Response.class);
@@ -219,7 +218,7 @@ class ResourceUploadServletTest extends JerseyTest {
when(resourceBusinessLogic.validatePropertiesDefaultValues(any())).thenReturn(true);
when(resourceImportManager.importNormativeResource(anyString(), any(), any(), anyBoolean(), anyBoolean()))
.thenReturn(new ImmutablePair<>(new Resource(), ActionStatus.CREATED));
- response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
+ final var response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
.header(Constants.USER_ID_HEADER, USER_ID)
.post(Entity.entity(buildFormDataMultiPart("node-types/TestNodeType002.zip",
"src/test/resources/node-types/nodeTypeWithoutModelsField.json"), MediaType.MULTIPART_FORM_DATA), Response.class);
@@ -228,11 +227,13 @@ class ResourceUploadServletTest extends JerseyTest {
@Test
void uploadMultipartFailWithEmptyModelsTest() throws IOException, ParseException, URISyntaxException {
+ when(responseFormat.getStatus()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR_500);
+ when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(responseFormat);
when(servletUtils.getUserAdmin()).thenReturn(userBusinessLogic);
when(userBusinessLogic.getUser(anyString())).thenReturn(user);
when(resourceBusinessLogic.validatePropertiesDefaultValues(any())).thenReturn(true);
when(modelBusinessLogic.findModel("")).thenReturn(Optional.empty());
- response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
+ final Response response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
.header(Constants.USER_ID_HEADER, USER_ID)
.post(Entity.entity(buildFormDataMultiPart("node-types/TestNodeType002.zip",
"src/test/resources/node-types/nodeTypeWithEmptyModels.json"), MediaType.MULTIPART_FORM_DATA), Response.class);
@@ -245,7 +246,7 @@ class ResourceUploadServletTest extends JerseyTest {
when(userBusinessLogic.getUser(anyString())).thenReturn(user);
when(resourceBusinessLogic.validatePropertiesDefaultValues(any())).thenReturn(true);
when(modelBusinessLogic.findModel(modelName)).thenReturn(Optional.empty());
- response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
+ final var response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
.header(Constants.USER_ID_HEADER, USER_ID)
.post(Entity.entity(buildFormDataMultiPart("node-types/TestNodeType001.zip",
"src/test/resources/node-types/nodeTypeWithModelsField.json"), MediaType.MULTIPART_FORM_DATA), Response.class);
@@ -254,10 +255,12 @@ class ResourceUploadServletTest extends JerseyTest {
@Test
void uploadMultipartThrowsBusinessExceptionTest() throws IOException, ParseException, URISyntaxException {
+ when(responseFormat.getStatus()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR_500);
+ when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(responseFormat);
when(servletUtils.getUserAdmin()).thenReturn(userBusinessLogic);
when(userBusinessLogic.getUser(anyString())).thenReturn(user);
when(resourceBusinessLogic.validatePropertiesDefaultValues(any())).thenReturn(true);
- response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
+ final var response = target().path(rootPath).request(MediaType.APPLICATION_JSON)
.header(Constants.USER_ID_HEADER, USER_ID)
.post(Entity.entity(buildFormDataMultiPart("node-types/TestNodeType001.zip",
"src/test/resources/node-types/invalid.json"), MediaType.MULTIPART_FORM_DATA), Response.class);