use of com.synopsys.integration.wait.ResilientJobConfig in project synopsys-detect by blackducksoftware.
the class RapidModeWaitOperation method waitForScans.
public List<DeveloperScanComponentResultView> waitForScans(List<HttpUrl> uploadedScans, long timeoutInSeconds, int waitIntervalInSeconds) throws IntegrationException, InterruptedException {
ResilientJobConfig waitJobConfig = new ResilientJobConfig(new Slf4jIntLogger(logger), timeoutInSeconds, System.currentTimeMillis(), waitIntervalInSeconds);
DetectRapidScanWaitJob waitJob = new DetectRapidScanWaitJob(blackDuckApiClient, uploadedScans);
ResilientJobExecutor jobExecutor = new ResilientJobExecutor(waitJobConfig);
return jobExecutor.executeJob(waitJob);
}
use of com.synopsys.integration.wait.ResilientJobConfig in project hub-alert by blackducksoftware.
the class IntegrationPerformanceTestRunner method runTest.
public void runTest(Runnable createGlobalConfigFunction, Map<String, FieldValueModel> channelFields, String jobName) throws IntegrationException, InterruptedException {
intLogger.info(String.format("Starting time %s", dateTimeFormatter.format(LocalDateTime.now())));
String blackDuckProviderID = createBlackDuckConfiguration();
createGlobalConfigFunction.run();
LocalDateTime jobStartingTime = LocalDateTime.now();
String jobId = configurationManager.createJob(channelFields, jobName, blackDuckProviderID, blackDuckProviderService.getBlackDuckProjectName());
String jobMessage = String.format("Creating the Job %s jobs took", jobName);
logTimeElapsedWithMessage(jobMessage + " %s", jobStartingTime, LocalDateTime.now());
LocalDateTime startingSearchDateTime = LocalDateTime.now();
// trigger BD notification
blackDuckProviderService.triggerBlackDuckNotification();
intLogger.info("Triggered the Black Duck notification.");
ResilientJobConfig resilientJobConfig = new ResilientJobConfig(intLogger, 600, startingSearchDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(), 20);
NotificationWaitJobTask notificationWaitJobTask = new NotificationWaitJobTask(intLogger, dateTimeFormatter, gson, alertRequestUtility, startingSearchDateTime, jobId);
boolean isComplete = WaitJob.waitFor(resilientJobConfig, notificationWaitJobTask, "int performance test runner notification wait");
intLogger.info("Finished waiting for the notification to be processed: " + isComplete);
assertTrue(isComplete);
}
use of com.synopsys.integration.wait.ResilientJobConfig in project hub-alert by blackducksoftware.
the class IntegrationPerformanceTestRunnerV2 method runTest.
public void runTest(Map<String, FieldValueModel> channelFields, String jobName) throws IntegrationException, InterruptedException {
intLogger.info(String.format("Starting time %s", dateTimeFormatter.format(LocalDateTime.now())));
String blackDuckProviderID = createBlackDuckConfiguration();
LocalDateTime jobStartingTime = LocalDateTime.now();
String jobId = configurationManager.createJob(channelFields, jobName, blackDuckProviderID, blackDuckProviderService.getBlackDuckProjectName());
String jobMessage = String.format("Creating the Job %s jobs took", jobName);
loggingUtility.logTimeElapsedWithMessage(jobMessage + " %s", jobStartingTime, LocalDateTime.now());
LocalDateTime startingSearchDateTime = LocalDateTime.now();
// trigger BD notification
blackDuckProviderService.triggerBlackDuckNotification();
intLogger.info("Triggered the Black Duck notification.");
ResilientJobConfig resilientJobConfig = new ResilientJobConfig(intLogger, 600, startingSearchDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(), 20);
NotificationWaitJobTask notificationWaitJobTask = new NotificationWaitJobTask(intLogger, dateTimeFormatter, gson, alertRequestUtility, startingSearchDateTime, jobId);
boolean isComplete = WaitJob.waitFor(resilientJobConfig, notificationWaitJobTask, "int performance test runner notification wait");
intLogger.info("Finished waiting for the notification to be processed: " + isComplete);
assertTrue(isComplete);
}
use of com.synopsys.integration.wait.ResilientJobConfig in project blackduck-common by blackducksoftware.
the class Bdio2FileUploadService method uploadFiles.
private Bdio2UploadResult uploadFiles(List<BdioFileContent> bdioFiles, @Nullable NameVersion nameVersion, long timeout) throws IntegrationException, InterruptedException {
if (bdioFiles.isEmpty()) {
throw new IllegalArgumentException("BDIO files cannot be empty.");
}
BdioFileContent header = bdioFiles.stream().filter(content -> content.getFileName().equals(FILE_NAME_BDIO_HEADER_JSONLD)).findFirst().orElseThrow(() -> new BlackDuckIntegrationException("Cannot find BDIO header file" + FILE_NAME_BDIO_HEADER_JSONLD + "."));
List<BdioFileContent> remainingFiles = bdioFiles.stream().filter(content -> !content.getFileName().equals(FILE_NAME_BDIO_HEADER_JSONLD)).collect(Collectors.toList());
int count = remainingFiles.size();
logger.debug("BDIO upload file count = " + count);
BlackDuckRequestBuilderEditor editor = noOp -> {
};
if (nameVersion != null) {
editor = builder -> builder.addHeader(Bdio2StreamUploader.PROJECT_NAME_HEADER, nameVersion.getName()).addHeader(Bdio2StreamUploader.VERSION_NAME_HEADER, nameVersion.getVersion());
}
ResilientJobConfig jobConfig = new ResilientJobConfig(logger, timeout, System.currentTimeMillis(), BD_WAIT_AND_RETRY_INTERVAL);
Bdio2UploadJob bdio2UploadJob = new Bdio2UploadJob(bdio2Uploader, header, remainingFiles, editor, count);
ResilientJobExecutor jobExecutor = new ResilientJobExecutor(jobConfig);
return jobExecutor.executeJob(bdio2UploadJob);
}
use of com.synopsys.integration.wait.ResilientJobConfig in project blackduck-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
ResilientJobConfig resilientJobConfig = new ResilientJobConfig(intLogger, 900, startingNotificationSearchDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(), 30);
NotificationWaitJobTask notificationWaitJobTask = new NotificationWaitJobTask(intLogger, dateTimeFormatter, gson, alertRequestUtility, startingNotificationSearchDateTime, jobIds);
notificationWaitJobTask.setFailOnJobFailure(false);
boolean isComplete = WaitJob.waitFor(resilientJobConfig, notificationWaitJobTask, "scaling notification wait");
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);
}
Aggregations