Search in sources :

Example 6 with ProviderTaskPropertiesAccessor

use of com.synopsys.integration.alert.common.persistence.accessor.ProviderTaskPropertiesAccessor in project hub-alert by blackducksoftware.

the class BlackDuckAccumulatorTest method runNotificationRetrieverThrowsException.

@Test
public void runNotificationRetrieverThrowsException() throws IntegrationException {
    ProviderTaskPropertiesAccessor taskPropertiesAccessor = Mockito.mock(ProviderTaskPropertiesAccessor.class);
    BlackDuckProperties blackDuckProperties = createBlackDuckProperties();
    BlackDuckSystemValidator validator = createBlackDuckValidator(blackDuckProperties, true);
    BlackDuckNotificationRetriever notificationRetriever = Mockito.mock(BlackDuckNotificationRetriever.class);
    Mockito.when(notificationRetriever.retrievePageOfFilteredNotifications(Mockito.any(), Mockito.anyList())).thenThrow(new IntegrationException("Test Exception"));
    BlackDuckNotificationRetrieverFactory notificationRetrieverFactory = createBlackDuckNotificationRetrieverFactory(blackDuckProperties, notificationRetriever);
    NotificationAccessor notificationAccessor = Mockito.mock(NotificationAccessor.class);
    BlackDuckAccumulator accumulator = new BlackDuckAccumulator(BLACK_DUCK_PROVIDER_KEY, null, notificationAccessor, taskPropertiesAccessor, blackDuckProperties, validator, null, notificationRetrieverFactory);
    accumulator.run();
    Mockito.verify(notificationAccessor, Mockito.times(0)).saveAllNotifications(Mockito.anyList());
}
Also used : BlackDuckProperties(com.synopsys.integration.alert.provider.blackduck.BlackDuckProperties) IntegrationException(com.synopsys.integration.exception.IntegrationException) NotificationAccessor(com.synopsys.integration.alert.common.persistence.accessor.NotificationAccessor) BlackDuckSystemValidator(com.synopsys.integration.alert.provider.blackduck.validator.BlackDuckSystemValidator) ProviderTaskPropertiesAccessor(com.synopsys.integration.alert.common.persistence.accessor.ProviderTaskPropertiesAccessor) Test(org.junit.jupiter.api.Test)

Aggregations

ProviderTaskPropertiesAccessor (com.synopsys.integration.alert.common.persistence.accessor.ProviderTaskPropertiesAccessor)6 Test (org.junit.jupiter.api.Test)4 BlackDuckProperties (com.synopsys.integration.alert.provider.blackduck.BlackDuckProperties)3 BlackDuckSystemValidator (com.synopsys.integration.alert.provider.blackduck.validator.BlackDuckSystemValidator)3 NotificationAccessor (com.synopsys.integration.alert.common.persistence.accessor.NotificationAccessor)2 IntegrationException (com.synopsys.integration.exception.IntegrationException)2 EventManager (com.synopsys.integration.alert.api.event.EventManager)1 NotificationReceivedEvent (com.synopsys.integration.alert.api.event.NotificationReceivedEvent)1 DateRange (com.synopsys.integration.alert.common.message.model.DateRange)1 PageRetriever (com.synopsys.integration.alert.processor.api.filter.PageRetriever)1 NotificationUserView (com.synopsys.integration.blackduck.api.manual.view.NotificationUserView)1 OffsetDateTime (java.time.OffsetDateTime)1