summaryrefslogtreecommitdiffstats
path: root/prh-app-server
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2018-05-21 12:50:27 +0200
committerpwielebs <piotr.wielebski@nokia.com>2018-05-22 15:39:53 +0200
commit91292c21d8ee51c3840ed455955636b7ceda36fb (patch)
tree9686880ba4e1d48a7dfd471e5dd99405b65990c6 /prh-app-server
parent35ee40c8133d4984ce2eeb580d8e757edc304e66 (diff)
Removing warnings related to optionals
Change-Id: I4116ee1b16d8600a3f7109290b2f69b31fd51133 Issue-ID: DCAEGEN2-451 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java10
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java12
2 files changed, 12 insertions, 10 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java
index 7487d084..ba3fade7 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java
@@ -19,14 +19,11 @@
*/
package org.onap.dcaegen2.services.prh.tasks;
-import java.io.IOException;
-import java.util.Optional;
import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
-import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.onap.dcaegen2.services.prh.configuration.Config;
import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
+import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.service.AAIProducerClient;
import org.onap.dcaegen2.services.prh.service.HttpUtils;
import org.slf4j.Logger;
@@ -34,6 +31,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.net.URISyntaxException;
+import java.util.Optional;
+
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
@@ -58,7 +58,7 @@ public class AAIProducerTaskImpl extends
return aaiProducerClient.getHttpResponse(consumerDmaapModel)
.filter(HttpUtils::isSuccessfulResponseCode).map(response -> consumerDmaapModel).orElseThrow(() ->
new AAINotFoundException("Incorrect response code for continuation of tasks workflow"));
- } catch (IOException e) {
+ } catch ( URISyntaxException e) {
logger.warn("Patch request not successful", e);
throw new AAINotFoundException("Patch request not successful");
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java
index c82a98e4..70da39b7 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java
@@ -30,6 +30,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.util.Optional;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
@@ -95,7 +96,7 @@ class AAIProducerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_ReturnsCorrectStatus() throws AAINotFoundException, IOException {
+ public void whenPassedObjectFits_ReturnsCorrectStatus() throws AAINotFoundException, URISyntaxException {
//given/when
getAAIProducerTask_whenMockingResponseObject(200, false);
ConsumerDmaapModel response = aaiProducerTask.execute(consumerDmaapModel);
@@ -109,7 +110,7 @@ class AAIProducerTaskImplTest {
@Test
- public void whenPassedObjectFits_butIncorrectResponseReturns() throws IOException {
+ public void whenPassedObjectFits_butIncorrectResponseReturns() throws IOException, URISyntaxException {
//given/when
getAAIProducerTask_whenMockingResponseObject(400, false);
Executable executableCode = () -> aaiProducerTask.execute(consumerDmaapModel);
@@ -121,7 +122,7 @@ class AAIProducerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_butHTTPClientThrowsIOExceptionHandleIt() throws IOException {
+ public void whenPassedObjectFits_butHTTPClientThrowsIOExceptionHandleIt() throws URISyntaxException {
//given/when
getAAIProducerTask_whenMockingResponseObject(0, true);
@@ -135,10 +136,11 @@ class AAIProducerTaskImplTest {
private static void getAAIProducerTask_whenMockingResponseObject(int statusCode, boolean throwsException)
- throws IOException {
+ throws URISyntaxException {
+ //given
aaiProducerClient = mock(AAIProducerClient.class);
if (throwsException) {
- when(aaiProducerClient.getHttpResponse(consumerDmaapModel)).thenThrow(IOException.class);
+ when(aaiProducerClient.getHttpResponse(consumerDmaapModel)).thenThrow(URISyntaxException.class);
} else {
when(aaiProducerClient.getHttpResponse(consumerDmaapModel)).thenReturn(Optional.of(statusCode));
}