use of com.blackducksoftware.integration.hub.alert.channel.email.repository.distribution.EmailGroupDistributionRepositoryWrapper 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.repository.distribution.EmailGroupDistributionRepositoryWrapper in project hub-alert by blackducksoftware.
the class EmailConfigActionsTest method createMockedConfigActionsUsingObjectTransformer.
@Override
public EmailGroupDistributionConfigActions createMockedConfigActionsUsingObjectTransformer(final ObjectTransformer objectTransformer) {
final EmailGroupManager emailManager = Mockito.mock(EmailGroupManager.class);
final EmailGroupDistributionRepositoryWrapper mockedEmailRepository = Mockito.mock(EmailGroupDistributionRepositoryWrapper.class);
final CommonDistributionRepositoryWrapper commonRepository = Mockito.mock(CommonDistributionRepositoryWrapper.class);
final ConfiguredProjectsRepositoryWrapper projectsRepository = Mockito.mock(ConfiguredProjectsRepositoryWrapper.class);
final DistributionProjectRepositoryWrapper distributionProjectRepository = Mockito.mock(DistributionProjectRepositoryWrapper.class);
final ConfiguredProjectsActions<EmailGroupDistributionRestModel> projectsAction = new ConfiguredProjectsActions<>(projectsRepository, distributionProjectRepository);
final NotificationTypeRepositoryWrapper notificationRepository = Mockito.mock(NotificationTypeRepositoryWrapper.class);
final DistributionNotificationTypeRepositoryWrapper notificationDistributionRepository = Mockito.mock(DistributionNotificationTypeRepositoryWrapper.class);
final NotificationTypesActions<EmailGroupDistributionRestModel> notificationAction = new NotificationTypesActions<>(notificationRepository, notificationDistributionRepository);
final EmailGroupDistributionConfigActions emailGroupDistributionConfigActions = new EmailGroupDistributionConfigActions(commonRepository, mockedEmailRepository, projectsAction, notificationAction, objectTransformer, emailManager);
return emailGroupDistributionConfigActions;
}
use of com.blackducksoftware.integration.hub.alert.channel.email.repository.distribution.EmailGroupDistributionRepositoryWrapper in project hub-alert by blackducksoftware.
the class EmailChannelManagerTest method getChannelManager.
@Override
public EmailGroupManager getChannelManager() {
final EmailGroupChannel mockEmailChannel = Mockito.mock(EmailGroupChannel.class);
final GlobalEmailRepositoryWrapper mockGlobalRepositoryWrapper = Mockito.mock(GlobalEmailRepositoryWrapper.class);
final EmailGroupDistributionRepositoryWrapper mockRepositoryWrapper = Mockito.mock(EmailGroupDistributionRepositoryWrapper.class);
final EmailGroupManager manager = new EmailGroupManager(mockEmailChannel, mockGlobalRepositoryWrapper, mockRepositoryWrapper, new ObjectTransformer());
return manager;
}
Aggregations