diff options
5 files changed, 39 insertions, 34 deletions
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/controller/TcaRestControllerTest.java b/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/controller/TcaRestControllerTest.java index 90e0173..04146a3 100644 --- a/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/controller/TcaRestControllerTest.java +++ b/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/controller/TcaRestControllerTest.java @@ -33,7 +33,7 @@ import org.onap.dcae.analytics.tca.web.domain.TcaPolicyWrapper; import org.onap.dcae.analytics.tca.web.service.TcaProcessingService; public class TcaRestControllerTest { - + @Test void getTcaPolicyResponseTest() throws Exception { TcaPolicyWrapper tcaPolicyWrapper = Mockito.mock(TcaPolicyWrapper.class); @@ -46,7 +46,7 @@ public class TcaRestControllerTest { restcontroller.getTcaPolicy(); restcontroller.setTcaPolicy(tcaPolicy); } - + @Test void getTcaExecutionResponseTest() throws Exception { TcaPolicyWrapper tcaPolicyWrapper = Mockito.mock(TcaPolicyWrapper.class); @@ -56,7 +56,8 @@ public class TcaRestControllerTest { List<String> cefMessages = Arrays.asList("Test1", "Test2"); TcaPolicy tcaPolicy = Mockito.mock(TcaPolicy.class); List<TcaExecutionContext> executionContexts = Arrays.asList(tcaExecutionContext, tcaExecutionContext); - Mockito.when(tcaProcessingService.getTcaExecutionResults("requestId", "transactioId", tcaPolicy, cefMessages)).thenReturn(executionContexts); + Mockito.when(tcaProcessingService.getTcaExecutionResults("requestId", "transactioId", tcaPolicy, cefMessages)) + .thenReturn(executionContexts); TcaRestController restcontroller = new TcaRestController(tcaProcessingService, tcaPolicyWrapper); restcontroller.execute(tcaExecutionRequest); } diff --git a/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java b/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java index 2425041..66043aa 100644 --- a/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java +++ b/dcae-analytics/dcae-analytics-tca-web/src/test/java/org/onap/dcae/analytics/tca/web/integration/TcaPublisherResponseHandlerTest.java @@ -29,41 +29,41 @@ import org.onap.dcae.analytics.tca.web.TcaAppProperties.Tca; public class TcaPublisherResponseHandlerTest { - static Map<String, Object> headers; + static Map<String, Object> headers; - @BeforeAll - static void initialize() { - headers = new HashMap<>(); - headers.put("X-ECOMP-RequestID", "TestRequestID"); - headers.put("X-ECOMP-TransactionID", "TestTransactionID"); - headers.put("X-ECOMP-FromAppID", "TestFromAppID"); + @BeforeAll + static void initialize() { + headers = new HashMap<>(); + headers.put("X-ECOMP-RequestID", "TestRequestID"); + headers.put("X-ECOMP-TransactionID", "TestTransactionID"); + headers.put("X-ECOMP-FromAppID", "TestFromAppID"); - } + } - @Test - void getHandleLoggingEnabledTest() throws Exception { + @Test + void getHandleLoggingEnabledTest() throws Exception { - TcaAppProperties tcaAppProperties = Mockito.mock(TcaAppProperties.class); - Tca tca = Mockito.mock(Tca.class); - Mockito.when(tcaAppProperties.getTca()).thenReturn(tca); - Mockito.when(tcaAppProperties.getTca().getEnableEcompLogging()).thenReturn(true); + TcaAppProperties tcaAppProperties = Mockito.mock(TcaAppProperties.class); + Tca tca = Mockito.mock(Tca.class); + Mockito.when(tcaAppProperties.getTca()).thenReturn(tca); + Mockito.when(tcaAppProperties.getTca().getEnableEcompLogging()).thenReturn(true); - TcaPublisherResponseHandler responseHandler = new TcaPublisherResponseHandler(tcaAppProperties); - responseHandler.handle("testpayload", headers); + TcaPublisherResponseHandler responseHandler = new TcaPublisherResponseHandler(tcaAppProperties); + responseHandler.handle("testpayload", headers); - } + } - @Test - void getHandleLoggingNotEnabledTest() throws Exception { + @Test + void getHandleLoggingNotEnabledTest() throws Exception { - TcaAppProperties tcaAppProperties = Mockito.mock(TcaAppProperties.class); - Tca tca = Mockito.mock(Tca.class); - Mockito.when(tcaAppProperties.getTca()).thenReturn(tca); - Mockito.when(tcaAppProperties.getTca().getEnableEcompLogging()).thenReturn(false); + TcaAppProperties tcaAppProperties = Mockito.mock(TcaAppProperties.class); + Tca tca = Mockito.mock(Tca.class); + Mockito.when(tcaAppProperties.getTca()).thenReturn(tca); + Mockito.when(tcaAppProperties.getTca().getEnableEcompLogging()).thenReturn(false); - TcaPublisherResponseHandler responseHandler = new TcaPublisherResponseHandler(tcaAppProperties); - responseHandler.handle("testpayload", headers); + TcaPublisherResponseHandler responseHandler = new TcaPublisherResponseHandler(tcaAppProperties); + responseHandler.handle("testpayload", headers); - } + } } diff --git a/dcae-analytics/dcae-analytics-test/src/main/java/org/onap/dcae/analytics/test/BaseAnalyticsTest.java b/dcae-analytics/dcae-analytics-test/src/main/java/org/onap/dcae/analytics/test/BaseAnalyticsTest.java index 955cab8..419fe2f 100644 --- a/dcae-analytics/dcae-analytics-test/src/main/java/org/onap/dcae/analytics/test/BaseAnalyticsTest.java +++ b/dcae-analytics/dcae-analytics-test/src/main/java/org/onap/dcae/analytics/test/BaseAnalyticsTest.java @@ -271,7 +271,7 @@ abstract class BaseAnalyticsTest { */ public static <T> T deserializeJsonFileToModel(final String jsonFileLocation, final Class<T> modelClass, final ObjectMapper objectMapper) { - try( final InputStream jsonFileInputStream = + try (final InputStream jsonFileInputStream = BaseAnalyticsTest.class.getClassLoader().getResourceAsStream(jsonFileLocation)) { assertThat(jsonFileInputStream).as("Input JSON File location must be valid").isNotNull(); return objectMapper.readValue(jsonFileInputStream, modelClass); diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/function/MrSubscriberURLFunctionTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/function/MrSubscriberURLFunctionTest.java index 8f0efd6..48d196a 100644 --- a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/function/MrSubscriberURLFunctionTest.java +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/function/MrSubscriberURLFunctionTest.java @@ -34,9 +34,13 @@ public class MrSubscriberURLFunctionTest { URL proxyURL = new URL("http://localhost"); MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); HttpHeaders headers = Mockito.mock(HttpHeaders.class); - MrSubscriberPreferences subscriberPreferences = new MrSubscriberPreferences("http://localhost:8080", - "TestClientId", headers, "TestUserName", "TestPassword", proxyURL, true, false, "TestGroup", - Arrays.asList("TestId1", "TestId2"), new Integer(4), new Integer(3), pollingPreferences); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1", "TestId2"), + new Integer(4), new Integer(3), pollingPreferences); final List<URL> urls = new MrSubscriberURLFunction().apply(subscriberPreferences); } diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java index 8e25cc1..1f790dd 100644 --- a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -public class GenericValidationResponseTest{ +public class GenericValidationResponseTest { public static GenericValidationResponse genericValidationResponse; |