Search in sources :

Example 6 with EmailGroupChannel

use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.

the class DistributionChannelTest method receiveMessageCatchExceptionTest.

@Test
public void receiveMessageCatchExceptionTest() {
    final Gson gson = new Gson();
    final EmailGroupChannel channel = new EmailGroupChannel(null, gson, null, null, null, null);
    channel.receiveMessage("garbage");
}
Also used : EmailGroupChannel(com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 7 with EmailGroupChannel

use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.

the class DistributionChannelTest method setAuditEntrySuccessTest.

@Test
public void setAuditEntrySuccessTest() {
    final AuditEntryRepositoryWrapper auditEntryRepository = Mockito.mock(AuditEntryRepositoryWrapper.class);
    final EmailGroupChannel channel = new EmailGroupChannel(null, null, auditEntryRepository, null, null, null);
    final AuditEntryEntity entity = new AuditEntryEntity(1L, new Date(System.currentTimeMillis() - 1000), new Date(System.currentTimeMillis()), StatusEnum.SUCCESS, null, null);
    entity.setId(1L);
    Mockito.when(auditEntryRepository.findOne(Mockito.anyLong())).thenReturn(entity);
    Mockito.when(auditEntryRepository.save(entity)).thenReturn(entity);
    channel.setAuditEntrySuccess(null);
    channel.setAuditEntrySuccess(entity.getId());
}
Also used : AuditEntryRepositoryWrapper(com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryRepositoryWrapper) EmailGroupChannel(com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel) AuditEntryEntity(com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryEntity) Date(java.util.Date) Test(org.junit.Test)

Example 8 with EmailGroupChannel

use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.

the class DistributionChannelTest method handleEventWrongTypeTest.

@Test
public void handleEventWrongTypeTest() {
    final GlobalProperties globalProperties = new TestGlobalProperties();
    final Gson gson = new Gson();
    final CommonDistributionRepositoryWrapper commonRepositoryWrapper = Mockito.mock(CommonDistributionRepositoryWrapper.class);
    final EmailGroupChannel channel = new EmailGroupChannel(globalProperties, gson, null, null, null, commonRepositoryWrapper);
    final Long commonId = 1L;
    final EmailGroupEvent event = new EmailGroupEvent(createProjectData("Distribution Channel Test"), commonId);
    final CommonDistributionConfigEntity commonEntity = new CommonDistributionConfigEntity(commonId, SupportedChannels.SLACK, "Other Config", DigestTypeEnum.REAL_TIME, false);
    Mockito.when(commonRepositoryWrapper.findOne(Mockito.anyLong())).thenReturn(commonEntity);
    channel.handleEvent(event);
}
Also used : CommonDistributionRepositoryWrapper(com.blackducksoftware.integration.hub.alert.datasource.entity.repository.CommonDistributionRepositoryWrapper) EmailGroupEvent(com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupEvent) TestGlobalProperties(com.blackducksoftware.integration.hub.alert.TestGlobalProperties) GlobalProperties(com.blackducksoftware.integration.hub.alert.config.GlobalProperties) CommonDistributionConfigEntity(com.blackducksoftware.integration.hub.alert.datasource.entity.CommonDistributionConfigEntity) EmailGroupChannel(com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel) Gson(com.google.gson.Gson) TestGlobalProperties(com.blackducksoftware.integration.hub.alert.TestGlobalProperties) Test(org.junit.Test)

Aggregations

EmailGroupChannel (com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel)8 Test (org.junit.Test)8 AuditEntryRepositoryWrapper (com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryRepositoryWrapper)3 Gson (com.google.gson.Gson)3 TestGlobalProperties (com.blackducksoftware.integration.hub.alert.TestGlobalProperties)2 AuditEntryEntity (com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryEntity)2 EmailGroupEvent (com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupEvent)2 GlobalEmailRepositoryWrapper (com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailRepositoryWrapper)2 GlobalProperties (com.blackducksoftware.integration.hub.alert.config.GlobalProperties)2 CommonDistributionConfigEntity (com.blackducksoftware.integration.hub.alert.datasource.entity.CommonDistributionConfigEntity)2 CommonDistributionRepositoryWrapper (com.blackducksoftware.integration.hub.alert.datasource.entity.repository.CommonDistributionRepositoryWrapper)2 Date (java.util.Date)2 IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)1 MockEmailGlobalEntity (com.blackducksoftware.integration.hub.alert.channel.email.mock.MockEmailGlobalEntity)1 EmailGroupDistributionConfigEntity (com.blackducksoftware.integration.hub.alert.channel.email.repository.distribution.EmailGroupDistributionConfigEntity)1 EmailGroupDistributionRepositoryWrapper (com.blackducksoftware.integration.hub.alert.channel.email.repository.distribution.EmailGroupDistributionRepositoryWrapper)1 GlobalEmailConfigEntity (com.blackducksoftware.integration.hub.alert.channel.email.repository.global.GlobalEmailConfigEntity)1