diff --git a/build.gradle b/build.gradle index 48e2880af..cd3b3616e 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ project.ext.moduleName = 'com.blackduck.integration.blackduck-common' project.ext.javaUseAutoModuleName = 'true' project.ext.junitShowStandardStreams = 'true' -version = '67.0.21-SNAPSHOT' +version = '68.0.0-SNAPSHOT' description = 'A library for using various capabilities of Black Duck, notably the REST API and signature scanning.' diff --git a/src/main/java/com/blackduck/integration/blackduck/codelocation/CodeLocationCreationService.java b/src/main/java/com/blackduck/integration/blackduck/codelocation/CodeLocationCreationService.java index 457f43d30..1a6349c34 100644 --- a/src/main/java/com/blackduck/integration/blackduck/codelocation/CodeLocationCreationService.java +++ b/src/main/java/com/blackduck/integration/blackduck/codelocation/CodeLocationCreationService.java @@ -47,6 +47,12 @@ public > CodeLocationCreationData create return new CodeLocationCreationData<>(notificationTaskRange, output); } + public > CodeLocationCreationData createCodeLocationsWithoutNotificationTaskRange(CodeLocationCreationRequest codeLocationCreationRequest) throws IntegrationException { + T output = codeLocationCreationRequest.executeRequest(); + + return new CodeLocationCreationData<>(null, output); + } + public > T createCodeLocationsAndWait(CodeLocationCreationRequest codeLocationCreationRequest, long timeoutInSeconds) throws IntegrationException, InterruptedException { return createCodeLocationsAndWait(codeLocationCreationRequest, timeoutInSeconds, DEFAULT_WAIT_INTERVAL_IN_SECONDS); } @@ -85,7 +91,7 @@ public NotificationTaskRange calculateCodeLocationRange() throws IntegrationExce UrlSingleResponse userResponse = apiDiscovery.metaSingleResponse(ApiDiscovery.CURRENT_USER_PATH); UserView currentUser = blackDuckApiClient.getResponse(userResponse); - Date startDate = notificationService.getLatestUserNotificationDate(currentUser); + Date startDate = new Date(System.currentTimeMillis()); Date endDate = Date.from(threeDaysLater.atZone(ZoneOffset.UTC).toInstant()); return new NotificationTaskRange(startTime, startDate, endDate); diff --git a/src/main/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadService.java b/src/main/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadService.java index 0d39e7f55..e02aebf93 100644 --- a/src/main/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadService.java +++ b/src/main/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadService.java @@ -42,6 +42,11 @@ public CodeLocationCreationData uploadBinaryScan(BinarySc return uploadBinaryScan(uploadRequest); } + public CodeLocationCreationData uploadBinaryScanWithoutNotificationsQuery(BinaryScanBatch uploadBatch) throws IntegrationException { + BinaryScanCodeLocationCreationRequest uploadRequest = createUploadRequest(uploadBatch); + return codeLocationCreationService.createCodeLocationsWithoutNotificationTaskRange(uploadRequest); + } + public CodeLocationCreationData uploadBinaryScan(BinaryScan binaryScan) throws IntegrationException { BinaryScanBatch uploadBatch = new BinaryScanBatch(); uploadBatch.addBinaryScan(binaryScan); diff --git a/src/main/java/com/blackduck/integration/blackduck/codelocation/intelligentpersistence/IntelligentPersistenceService.java b/src/main/java/com/blackduck/integration/blackduck/codelocation/intelligentpersistence/IntelligentPersistenceService.java index 99178e8db..44e64a4da 100644 --- a/src/main/java/com/blackduck/integration/blackduck/codelocation/intelligentpersistence/IntelligentPersistenceService.java +++ b/src/main/java/com/blackduck/integration/blackduck/codelocation/intelligentpersistence/IntelligentPersistenceService.java @@ -46,6 +46,11 @@ public CodeLocationCreationData uploadBdio(UploadBatch upload return uploadBdio(uploadRequest); } + public CodeLocationCreationData uploadBdioWithoutNotificationsQuery(UploadBatch uploadBatch, long timeoutInSeconds, long clientStartTime) throws IntegrationException { + IntelligentPersistenceCodeLocationCreationRequest uploadRequest = this.createUploadRequest(uploadBatch, timeoutInSeconds, clientStartTime); + return codeLocationCreationService.createCodeLocationsWithoutNotificationTaskRange(uploadRequest); + } + public UploadBatchOutput uploadBdioAndWait(CodeLocationCreationRequest uploadRequest, long timeoutInSeconds) throws IntegrationException, InterruptedException { return codeLocationCreationService.createCodeLocationsAndWait(uploadRequest, timeoutInSeconds); } diff --git a/src/main/java/com/blackduck/integration/blackduck/service/dataservice/NotificationService.java b/src/main/java/com/blackduck/integration/blackduck/service/dataservice/NotificationService.java index b884c4afa..6ad39fa7a 100644 --- a/src/main/java/com/blackduck/integration/blackduck/service/dataservice/NotificationService.java +++ b/src/main/java/com/blackduck/integration/blackduck/service/dataservice/NotificationService.java @@ -80,17 +80,6 @@ public Date getLatestNotificationDate() throws IntegrationException { return getFirstCreatedAtDate(notifications); } - /** - * @return The java.util.Date of the most recent notification in the user's stream. If there are no notifications, the current date will be returned. This can set an initial start time window for all future notifications. - * @throws IntegrationException - */ - public Date getLatestUserNotificationDate(UserView userView) throws IntegrationException { - BlackDuckRequestBuilder blackDuckRequestBuilder = createLatestDateRequestBuilder(); - BlackDuckMultipleRequest requestMultiple = blackDuckRequestBuilder.buildBlackDuckRequest(userNotificationsResponses.apply(userView)); - List userNotifications = blackDuckApiClient.getSomeResponses(requestMultiple, 1); - return getFirstCreatedAtDate(userNotifications); - } - private Date getFirstCreatedAtDate(List notifications) { if (notifications.size() == 1) { return notifications.get(0).getCreatedAt(); diff --git a/src/test/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadServiceTestIT.java b/src/test/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadServiceTestIT.java index 4ac4dfb77..e18d7f00e 100644 --- a/src/test/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadServiceTestIT.java +++ b/src/test/java/com/blackduck/integration/blackduck/codelocation/binaryscanner/BinaryScanUploadServiceTestIT.java @@ -104,7 +104,7 @@ private File getTestBinaryFile() { private BinaryScanData createBinaryScanData(BlackDuckServices blackDuckServices, BinaryScan binaryScan) throws IntegrationException { UserView currentUser = blackDuckServices.userService.findCurrentUser(); - Date userStartDate = blackDuckServices.notificationService.getLatestUserNotificationDate(currentUser); + Date userStartDate = new Date(System.currentTimeMillis()); Date systemStartDate = blackDuckServices.notificationService.getLatestNotificationDate(); return new BinaryScanData(currentUser, userStartDate, systemStartDate, binaryScan); diff --git a/src/test/java/com/blackduck/integration/blackduck/comprehensive/ComprehensiveCookbookTestIT.java b/src/test/java/com/blackduck/integration/blackduck/comprehensive/ComprehensiveCookbookTestIT.java index 69210be0f..2bbcf22c2 100644 --- a/src/test/java/com/blackduck/integration/blackduck/comprehensive/ComprehensiveCookbookTestIT.java +++ b/src/test/java/com/blackduck/integration/blackduck/comprehensive/ComprehensiveCookbookTestIT.java @@ -163,7 +163,7 @@ public void testPolicyStatusFromBdioImport() throws Exception { setupPolicyCheck(blackDuckServices, checkPolicyData); UserView currentUser = blackDuckServices.userService.findCurrentUser(); - Date userStartDate = blackDuckServices.notificationService.getLatestUserNotificationDate(currentUser); + Date userStartDate = new Date(System.currentTimeMillis()); Date systemStartDate = blackDuckServices.notificationService.getLatestNotificationDate(); // import the bdio @@ -197,7 +197,7 @@ public void testPolicyStatusFromSignatureScan() throws Exception { setupPolicyCheck(blackDuckServices, checkPolicyData); UserView currentUser = blackDuckServices.userService.findCurrentUser(); - Date userStartDate = blackDuckServices.notificationService.getLatestUserNotificationDate(currentUser); + Date userStartDate = new Date(System.currentTimeMillis()); Date systemStartDate = blackDuckServices.notificationService.getLatestNotificationDate(); File scanFile = intHttpClientTestHelper.getFile("hub-artifactory-1.0.1-RC.zip"); diff --git a/src/test/java/com/blackduck/integration/blackduck/comprehensive/CreateProjectWithBdioAndVerifyBOMTest.java b/src/test/java/com/blackduck/integration/blackduck/comprehensive/CreateProjectWithBdioAndVerifyBOMTest.java index e978b9a59..6e4fcc0a5 100644 --- a/src/test/java/com/blackduck/integration/blackduck/comprehensive/CreateProjectWithBdioAndVerifyBOMTest.java +++ b/src/test/java/com/blackduck/integration/blackduck/comprehensive/CreateProjectWithBdioAndVerifyBOMTest.java @@ -113,7 +113,7 @@ public void testCreatingProject() throws IntegrationException, InterruptedExcept } private void uploadAndVerifyBdio(UploadBatch uploadBatch, Set expectedCodeLocationNames) throws IntegrationException, InterruptedException { - Date startDate = blackDuckServices.notificationService.getLatestUserNotificationDate(currentUser); + Date startDate = new Date(System.currentTimeMillis()); System.out.println("start date: "); System.out.println(RestConstants.formatDate(startDate)); diff --git a/src/test/java/com/blackduck/integration/blackduck/comprehensive/NotificationsTestIT.java b/src/test/java/com/blackduck/integration/blackduck/comprehensive/NotificationsTestIT.java index 2ac580f87..ae3f6b95a 100644 --- a/src/test/java/com/blackduck/integration/blackduck/comprehensive/NotificationsTestIT.java +++ b/src/test/java/com/blackduck/integration/blackduck/comprehensive/NotificationsTestIT.java @@ -50,7 +50,7 @@ public void testProjectNotifications() throws IntegrationException, InterruptedE ProjectSyncModel projectSyncModel = ProjectSyncModel.createWithDefaults(projectName, projectVersionName); UserView currentUser = userService.findCurrentUser(); - Date startDate = notificationService.getLatestUserNotificationDate(currentUser); + Date startDate = new Date(System.currentTimeMillis()); Date endDate = Date.from(startDate.toInstant().plus(1, ChronoUnit.DAYS)); List notificationTypes = new ArrayList<>(); notificationTypes.add(NotificationType.PROJECT.name());