use of com.blackducksoftware.integration.hub.alert.config.GlobalProperties in project hub-alert by blackducksoftware.
the class GlobalHubConfigActionsTest method getMockedConfigActions.
@Override
public GlobalHubConfigActions getMockedConfigActions() {
final GlobalHubRepositoryWrapper mockedGlobalRepository = Mockito.mock(GlobalHubRepositoryWrapper.class);
final GlobalProperties globalProperties = new TestGlobalProperties(mockedGlobalRepository);
final GlobalHubConfigActions configActions = new GlobalHubConfigActions(mockedGlobalRepository, globalProperties, new ObjectTransformer());
return configActions;
}
use of com.blackducksoftware.integration.hub.alert.config.GlobalProperties in project hub-alert by blackducksoftware.
the class GlobalHubConfigActionsTest method createMockedConfigActionsUsingObjectTransformer.
@Override
public GlobalHubConfigActions createMockedConfigActionsUsingObjectTransformer(final ObjectTransformer objectTransformer) {
final GlobalHubRepositoryWrapper mockedGlobalRepository = Mockito.mock(GlobalHubRepositoryWrapper.class);
final GlobalProperties globalProperties = new TestGlobalProperties(mockedGlobalRepository);
final GlobalHubConfigActions configActions = new GlobalHubConfigActions(mockedGlobalRepository, globalProperties, objectTransformer);
return configActions;
}
use of com.blackducksoftware.integration.hub.alert.config.GlobalProperties in project hub-alert by blackducksoftware.
the class AccumulatorReaderTest method testRead.
@Test
public void testRead() throws UnexpectedInputException, ParseException, NonTransientResourceException, Exception {
final GlobalProperties globalProperties = Mockito.mock(GlobalProperties.class);
final HubServicesFactory hubServicesFactory = Mockito.mock(HubServicesFactory.class);
final NotificationService notificationService = Mockito.mock(NotificationService.class);
final SortedSet<NotificationContentItem> notificationContentItems = new TreeSet<>();
final Date createdAt = new Date();
final ProjectVersionModel projectVersionModel = new ProjectVersionModel();
projectVersionModel.setProjectLink("New project link");
final String componentName = "notification test";
final ComponentVersionView componentVersionView = new ComponentVersionView();
final String componentVersionUrl = "sss";
final String componentIssueUrl = "ddd";
final NotificationContentItem notificationContentItem = new NotificationContentItem(createdAt, projectVersionModel, componentName, componentVersionView, componentVersionUrl, componentIssueUrl);
notificationContentItems.add(notificationContentItem);
final NotificationResults notificationResults = new NotificationResults(notificationContentItems, null);
Mockito.doReturn(hubServicesFactory).when(globalProperties).createHubServicesFactoryAndLogErrors(Mockito.any());
Mockito.doReturn(notificationService).when(hubServicesFactory).createNotificationService();
Mockito.doReturn(notificationResults).when(notificationService).getAllNotificationResults(Mockito.any(), Mockito.any());
final AccumulatorReader accumulatorReader = new AccumulatorReader(globalProperties);
final NotificationResults actualNotificationResults = accumulatorReader.read();
assertNotNull(actualNotificationResults);
}
use of com.blackducksoftware.integration.hub.alert.config.GlobalProperties 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);
}
use of com.blackducksoftware.integration.hub.alert.config.GlobalProperties in project hub-alert by blackducksoftware.
the class GlobalSchedulingConfigActionsTest method createMockedConfigActionsUsingObjectTransformer.
@Override
public GlobalSchedulingConfigActions createMockedConfigActionsUsingObjectTransformer(final ObjectTransformer objectTransformer) {
final AccumulatorConfig mockedAccumulatorConfig = Mockito.mock(AccumulatorConfig.class);
Mockito.when(mockedAccumulatorConfig.getMillisecondsToNextRun()).thenReturn(33000l);
final DailyDigestBatchConfig mockedDailyDigestBatchConfig = Mockito.mock(DailyDigestBatchConfig.class);
Mockito.when(mockedDailyDigestBatchConfig.getFormatedNextRunTime()).thenReturn("01/19/2018 02:00 AM UTC");
final PurgeConfig mockedPurgeConfig = Mockito.mock(PurgeConfig.class);
Mockito.when(mockedPurgeConfig.getFormatedNextRunTime()).thenReturn("01/21/2018 12:00 AM UTC");
final GlobalSchedulingRepositoryWrapper globalSchedulingRepository = Mockito.mock(GlobalSchedulingRepositoryWrapper.class);
final GlobalProperties globalProperties = Mockito.mock(GlobalProperties.class);
final ChannelTemplateManager channelTemplateManager = Mockito.mock(ChannelTemplateManager.class);
final NotificationRepositoryWrapper notificationRepository = Mockito.mock(NotificationRepositoryWrapper.class);
final VulnerabilityRepositoryWrapper vulnerabilityRepository = Mockito.mock(VulnerabilityRepositoryWrapper.class);
final GlobalSchedulingConfigActions configActions = new GlobalSchedulingConfigActions(mockedAccumulatorConfig, mockedDailyDigestBatchConfig, mockedPurgeConfig, globalSchedulingRepository, objectTransformer, globalProperties, channelTemplateManager, new NotificationManager(notificationRepository, vulnerabilityRepository, null, null));
return configActions;
}
Aggregations