use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.
the class DistributionChannelTest method setAuditEntrySuccessCatchExceptionTest.
@Test
public void setAuditEntrySuccessCatchExceptionTest() {
final EmailGroupChannel channel = new EmailGroupChannel(null, null, null, null, null, null);
channel.setAuditEntrySuccess(1L);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.
the class DistributionChannelTest method receiveMessageTest.
@Test
public void receiveMessageTest() {
final GlobalProperties globalProperties = new TestGlobalProperties();
final Gson gson = new Gson();
final AuditEntryRepositoryWrapper auditEntryRepository = Mockito.mock(AuditEntryRepositoryWrapper.class);
final GlobalEmailRepositoryWrapper globalEmailRepositoryWrapper = Mockito.mock(GlobalEmailRepositoryWrapper.class);
final EmailGroupDistributionRepositoryWrapper emailGroupRepositoryWrapper = Mockito.mock(EmailGroupDistributionRepositoryWrapper.class);
final CommonDistributionRepositoryWrapper commonRepositoryWrapper = Mockito.mock(CommonDistributionRepositoryWrapper.class);
final EmailGroupChannel channel = new EmailGroupChannel(globalProperties, gson, auditEntryRepository, globalEmailRepositoryWrapper, emailGroupRepositoryWrapper, commonRepositoryWrapper);
final Long commonId = 1L;
final EmailGroupEvent event = new EmailGroupEvent(createProjectData("Distribution Channel Test"), commonId);
final String jsonRepresentation = gson.toJson(event);
final CommonDistributionConfigEntity commonEntity = new CommonDistributionConfigEntity(commonId, SupportedChannels.EMAIL_GROUP, "Email Config", DigestTypeEnum.REAL_TIME, false);
Mockito.when(commonRepositoryWrapper.findOne(Mockito.anyLong())).thenReturn(commonEntity);
final EmailGroupDistributionConfigEntity specificEntity = new EmailGroupDistributionConfigEntity("admins", "", "TEST SUBJECT LINE");
Mockito.when(emailGroupRepositoryWrapper.findOne(Mockito.anyLong())).thenReturn(specificEntity);
channel.receiveMessage(jsonRepresentation);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.
the class DistributionChannelTest method setAuditEntryFailureCatchExceptionTest.
@Test
public void setAuditEntryFailureCatchExceptionTest() {
final EmailGroupChannel channel = new EmailGroupChannel(null, null, null, null, null, null);
channel.setAuditEntryFailure(1L, null, null);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.
the class DistributionChannelTest method getGlobalConfigEntityTest.
@Test
public void getGlobalConfigEntityTest() {
final GlobalEmailRepositoryWrapper globalEmailRepositoryWrapper = Mockito.mock(GlobalEmailRepositoryWrapper.class);
final EmailGroupChannel channel = new EmailGroupChannel(null, null, null, globalEmailRepositoryWrapper, null, null);
final MockEmailGlobalEntity mockEntity = new MockEmailGlobalEntity();
final GlobalEmailConfigEntity entity = mockEntity.createGlobalEntity();
Mockito.when(globalEmailRepositoryWrapper.findAll()).thenReturn(Arrays.asList(entity));
final GlobalEmailConfigEntity globalEntity = channel.getGlobalConfigEntity();
assertEquals(entity, globalEntity);
}
use of com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel in project hub-alert by blackducksoftware.
the class DistributionChannelTest method setAuditEntryFailureTest.
@Test
public void setAuditEntryFailureTest() {
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.FAILURE, null, null);
entity.setId(1L);
Mockito.when(auditEntryRepository.findOne(Mockito.anyLong())).thenReturn(entity);
Mockito.when(auditEntryRepository.save(entity)).thenReturn(entity);
channel.setAuditEntryFailure(null, null, null);
channel.setAuditEntryFailure(entity.getId(), "error", new Exception());
}
Aggregations