summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-04-26 16:08:17 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-04-26 16:08:17 +0200
commitb52d1508d5ccfbefcaae208ce73e542e783461b1 (patch)
treea8ab4eb5c47ef2cb1387c649e9482fff062921ca /src/test
parent86b91bf79edcdcadf55d73d73d290c19a6264196 (diff)
Remove jersey and aai-rest-client dependencies from model-loader
- aai-rest-client has been fully replaced with RestTemplate - use spring provided imports in ModelController Issue-ID: AAI-3836 Change-Id: If2471c8a68c273823bef138626534df1894a91d7 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/aai/modelloader/service/TestModelController.java20
-rw-r--r--src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java8
2 files changed, 14 insertions, 14 deletions
diff --git a/src/test/java/org/onap/aai/modelloader/service/TestModelController.java b/src/test/java/org/onap/aai/modelloader/service/TestModelController.java
index 970aa7a..6cfeb65 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestModelController.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestModelController.java
@@ -29,8 +29,6 @@ import java.io.IOException;
import java.util.Base64;
import java.util.Collections;
-import javax.ws.rs.core.Response;
-
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
@@ -47,6 +45,8 @@ import org.onap.aai.modelloader.util.ArtifactTestUtils;
import org.onap.sdc.api.IDistributionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.test.context.TestPropertySource;
/**
@@ -80,28 +80,28 @@ public class TestModelController {
@Test
public void testLoadModel() {
- Response response = modelController.loadModel("");
- assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ ResponseEntity<String> response = modelController.loadModel("");
+ assertThat(response.getStatusCode(), is(HttpStatus.OK));
}
@Test
public void testSaveModel() {
- Response response = modelController.saveModel("", "");
- assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ ResponseEntity<String> response = modelController.saveModel("", "");
+ assertThat(response.getStatusCode(), is(HttpStatus.OK));
}
@Test
public void testIngestModel() throws IOException {
byte[] csarPayload = new ArtifactTestUtils().loadResource("compressedArtifacts/service-VscpaasTest-csar.csar");
- Response response = modelController.ingestModel("model-name", "", Base64.getEncoder().encodeToString(csarPayload));
- assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
+ ResponseEntity<String> response = modelController.ingestModel("model-name", "", Base64.getEncoder().encodeToString(csarPayload));
+ assertThat(response.getStatusCode(), is(HttpStatus.OK));
}
@Test
public void testIngestModelMissingName() throws IOException {
byte[] csarPayload = new ArtifactTestUtils().loadResource("compressedArtifacts/service-VscpaasTest-csar.csar");
- Response response = modelController.ingestModel("", "", Base64.getEncoder().encodeToString(csarPayload));
- assertThat(response.getStatus(), is(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
+ ResponseEntity<String> response = modelController.ingestModel("", "", Base64.getEncoder().encodeToString(csarPayload));
+ assertThat(response.getStatusCode(), is(HttpStatus.INTERNAL_SERVER_ERROR));
}
}
diff --git a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
index 6dc1b3d..e9ab7c0 100644
--- a/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
+++ b/src/test/java/org/onap/aai/modelloader/service/TestModelLoaderServiceWithSdc.java
@@ -26,12 +26,12 @@ import static org.hamcrest.MatcherAssert.assertThat;
import java.io.IOException;
import java.util.Base64;
-import javax.ws.rs.core.Response;
-
import org.junit.jupiter.api.Test;
import org.onap.aai.modelloader.util.ArtifactTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.test.context.TestPropertySource;
/**
@@ -48,8 +48,8 @@ public class TestModelLoaderServiceWithSdc {
@Test
public void testIngestModel() throws IOException {
byte[] csarPayload = new ArtifactTestUtils().loadResource("compressedArtifacts/service-VscpaasTest-csar.csar");
- Response response = controller.ingestModel("model-name", "", Base64.getEncoder().encodeToString(csarPayload));
- assertThat(response.getStatus(), is(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
+ ResponseEntity<String> response = controller.ingestModel("model-name", "", Base64.getEncoder().encodeToString(csarPayload));
+ assertThat(response.getStatusCode(), is(HttpStatus.INTERNAL_SERVER_ERROR));
}