diff options
author | wasala <przemyslaw.wasala@nokia.com> | 2018-04-16 12:59:26 +0200 |
---|---|---|
committer | wasala <przemyslaw.wasala@nokia.com> | 2018-04-16 14:54:35 +0200 |
commit | 58a67d37441b8af808b792418e07448e30556bbd (patch) | |
tree | da77e1b1e09c7a3ad829a3f59f1fa1a8d3d0f52c /prh-app-server/src/test/java | |
parent | b0ef04537df52322f1d51148ef612c19d7b23696 (diff) |
Already added flow control for tasks.
*The next step will be get common model for all
request/response message based on HTTPClient implementation
Change-Id: I76af15ab06cae783b6cec5099510d7f97e9d65c2
Issue-ID: DCAEGEN2-445
Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-app-server/src/test/java')
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java | 2 | ||||
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java | 6 | ||||
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskSpy.java | 8 | ||||
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java | 10 | ||||
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskSpy.java) | 12 | ||||
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java | 1 |
6 files changed, 28 insertions, 11 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java index 0c92da77..c8ed88da 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java @@ -61,7 +61,7 @@ class ScheduledXmlContextITest extends AbstractTestNGSpringContextTests { } private void verifyDmaapConsumerTask() { - verify(scheduledTask, atLeast(2)).scheduleMainPrhEventTask(); + verify(scheduledTask, atLeast(1)).scheduleMainPrhEventTask(); } } diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java index a6361cfe..26be5133 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java @@ -99,7 +99,7 @@ class PrhAppConfigTest { verify(prhAppConfig, times(1)).initFileStreamReader(); Assertions.assertNotNull(prhAppConfig.getAAIHttpClientConfiguration()); Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration()); - Assertions.assertNotNull(prhAppConfig.getDmaapProducerConfiguration()); + Assertions.assertNotNull(prhAppConfig.getDmaapPublisherConfiguration()); } @Test @@ -120,7 +120,7 @@ class PrhAppConfigTest { verify(prhAppConfig, times(1)).initFileStreamReader(); Assertions.assertNull(prhAppConfig.getAAIHttpClientConfiguration()); Assertions.assertNull(prhAppConfig.getDmaapConsumerConfiguration()); - Assertions.assertNull(prhAppConfig.getDmaapProducerConfiguration()); + Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration()); } @@ -144,7 +144,7 @@ class PrhAppConfigTest { verify(prhAppConfig, times(1)).initFileStreamReader(); Assertions.assertNotNull(prhAppConfig.getAAIHttpClientConfiguration()); Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration()); - Assertions.assertNull(prhAppConfig.getDmaapProducerConfiguration()); + Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration()); } }
\ No newline at end of file diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskSpy.java index 56565cad..c27c8813 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskSpy.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskSpy.java @@ -19,8 +19,12 @@ */ package org.onap.dcaegen2.services.prh.tasks; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import org.onap.dcaegen2.services.config.AAIHttpClientConfiguration; +import org.onap.dcaegen2.services.prh.configuration.AppConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -34,6 +38,8 @@ public class AAIPublisherTaskSpy { @Bean @Primary public AAIPublisherTask registerSimpleAAIPublisherTask() { - return spy(new AAIPublisherTaskImpl()); + AppConfig appConfig = mock(AppConfig.class); + when(appConfig.getAAIHttpClientConfiguration()).thenReturn(mock(AAIHttpClientConfiguration.class)); + return spy(new AAIPublisherTaskImpl(appConfig)); } } diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java index d41da169..c2934d4e 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java @@ -19,8 +19,12 @@ */ package org.onap.dcaegen2.services.prh.tasks; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import org.onap.dcaegen2.services.config.DmaapConsumerConfiguration; +import org.onap.dcaegen2.services.prh.configuration.AppConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -33,7 +37,9 @@ public class DmaapConsumerTaskSpy { @Bean @Primary - public DmaapConsumerTaskImpl registerSimpleDmaapConsumerTask() { - return spy(new DmaapConsumerTaskImpl()); + public Task registerSimpleDmaapConsumerTask() { + AppConfig appConfig = mock(AppConfig.class); + when(appConfig.getDmaapConsumerConfiguration()).thenReturn(mock(DmaapConsumerConfiguration.class)); + return spy(new DmaapConsumerTaskImpl(appConfig)); } } diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java index 8bdc7a1d..c36c84b0 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskSpy.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java @@ -19,8 +19,12 @@ */ package org.onap.dcaegen2.services.prh.tasks; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import org.onap.dcaegen2.services.config.DmaapPublisherConfiguration; +import org.onap.dcaegen2.services.prh.configuration.AppConfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -29,12 +33,14 @@ import org.springframework.context.annotation.Primary; * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18 */ @Configuration -public class DmaapPublisherTaskSpy { +public class DmaapProducerTaskSpy { @Bean @Primary - public DmaapPublisherTaskImpl registerSimpleDmaapPublisherTask() { - return spy(new DmaapPublisherTaskImpl()); + public Task registerSimpleDmaapPublisherTask() { + AppConfig appConfig = mock(AppConfig.class); + when(appConfig.getDmaapPublisherConfiguration()).thenReturn(mock(DmaapPublisherConfiguration.class)); + return spy(new DmaapPublisherTaskImpl(appConfig)); } } diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java index 0b5f969b..2d599b23 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java @@ -22,7 +22,6 @@ package org.onap.dcaegen2.services.prh.tasks; import static org.mockito.Mockito.spy; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; |