Search in sources :

Example 1 with MockProcessingAuditAccessor

use of com.synopsys.integration.alert.processor.api.MockProcessingAuditAccessor in project hub-alert by blackducksoftware.

the class ProviderMessageDistributorTest method distributeMissingDestinationKeyTest.

@Test
public void distributeMissingDestinationKeyTest() {
    MockProcessingAuditAccessor processingAuditAccessor = new MockProcessingAuditAccessor();
    EventManager eventManager = Mockito.mock(EventManager.class);
    ProcessedNotificationDetails processedNotificationDetails = new ProcessedNotificationDetails(uuid, "bad channel key", "JobName");
    ProcessedProviderMessageHolder processedMessageHolder = createProcessedProviderMessageHolder(1, 0);
    ProviderMessageDistributor providerMessageDistributor = new ProviderMessageDistributor(processingAuditAccessor, eventManager);
    providerMessageDistributor.distribute(processedNotificationDetails, processedMessageHolder);
    Mockito.verify(eventManager, Mockito.times(0)).sendEvent(Mockito.any());
}
Also used : MockProcessingAuditAccessor(com.synopsys.integration.alert.processor.api.MockProcessingAuditAccessor) EventManager(com.synopsys.integration.alert.api.event.EventManager) ProcessedProviderMessageHolder(com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessageHolder) Test(org.junit.jupiter.api.Test)

Example 2 with MockProcessingAuditAccessor

use of com.synopsys.integration.alert.processor.api.MockProcessingAuditAccessor in project hub-alert by blackducksoftware.

the class ProviderMessageDistributorTest method distributeTest.

@Test
public void distributeTest() {
    MockProcessingAuditAccessor processingAuditAccessor = new MockProcessingAuditAccessor();
    EventManager eventManager = Mockito.mock(EventManager.class);
    ProcessedNotificationDetails processedNotificationDetails = new ProcessedNotificationDetails(uuid, slackChannelKey.getUniversalKey(), "JobName");
    ProcessedProviderMessageHolder processedMessageHolder = createProcessedProviderMessageHolder(2, 2);
    ProviderMessageDistributor providerMessageDistributor = new ProviderMessageDistributor(processingAuditAccessor, eventManager);
    providerMessageDistributor.distribute(processedNotificationDetails, processedMessageHolder);
    Mockito.verify(eventManager, Mockito.times(4)).sendEvent(Mockito.any());
}
Also used : MockProcessingAuditAccessor(com.synopsys.integration.alert.processor.api.MockProcessingAuditAccessor) EventManager(com.synopsys.integration.alert.api.event.EventManager) ProcessedProviderMessageHolder(com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessageHolder) Test(org.junit.jupiter.api.Test)

Aggregations

EventManager (com.synopsys.integration.alert.api.event.EventManager)2 MockProcessingAuditAccessor (com.synopsys.integration.alert.processor.api.MockProcessingAuditAccessor)2 ProcessedProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProcessedProviderMessageHolder)2 Test (org.junit.jupiter.api.Test)2