Search in sources :

Example 1 with NotificationWaitJobTask

use of com.synopsys.integration.alert.performance.utility.NotificationWaitJobTask in project hub-alert by blackducksoftware.

the class ScalingPerformanceTest method createAndTestJobs.

private void createAndTestJobs(AlertRequestUtility alertRequestUtility, BlackDuckProviderService blackDuckProviderService, ConfigurationManager configurationManager, LocalDateTime startingTime, List<String> jobIds, int numberOfJobsToCreate, String blackDuckProviderID) throws Exception {
    // create slack jobs
    createSlackJobs(configurationManager, startingTime, jobIds, numberOfJobsToCreate, 10, blackDuckProviderID, blackDuckProviderService.getBlackDuckProviderKey(), blackDuckProviderService.getBlackDuckProjectName());
    LocalDateTime startingNotificationSearchDateTime = LocalDateTime.now();
    // trigger BD notification
    blackDuckProviderService.triggerBlackDuckNotification();
    logTimeElapsedWithMessage("Triggering the Black Duck notification took %s", startingNotificationSearchDateTime, LocalDateTime.now());
    LocalDateTime startingNotificationWaitForTenJobs = LocalDateTime.now();
    // check that all jobs have processed the notification successfully, log how long it took
    WaitJobConfig waitJobConfig = new WaitJobConfig(intLogger, "scaling notification wait", 900, startingNotificationSearchDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(), 30);
    NotificationWaitJobTask notificationWaitJobTask = new NotificationWaitJobTask(intLogger, dateTimeFormatter, gson, alertRequestUtility, startingNotificationSearchDateTime, jobIds);
    notificationWaitJobTask.setFailOnJobFailure(false);
    WaitJob<Boolean> waitForNotificationToBeProcessed = WaitJob.createSimpleWait(waitJobConfig, notificationWaitJobTask);
    boolean isComplete = waitForNotificationToBeProcessed.waitFor();
    logTimeElapsedWithMessage("Waiting for " + numberOfJobsToCreate + " jobs to process the notification took %s", startingNotificationWaitForTenJobs, LocalDateTime.now());
    intLogger.info("Finished waiting for the notification to be processed: " + isComplete);
    assertTrue(isComplete);
}
Also used : LocalDateTime(java.time.LocalDateTime) WaitJobConfig(com.synopsys.integration.wait.WaitJobConfig) NotificationWaitJobTask(com.synopsys.integration.alert.performance.utility.NotificationWaitJobTask)

Aggregations

NotificationWaitJobTask (com.synopsys.integration.alert.performance.utility.NotificationWaitJobTask)1 WaitJobConfig (com.synopsys.integration.wait.WaitJobConfig)1 LocalDateTime (java.time.LocalDateTime)1