From 0e1a8fab81499989be90d88d9d1e6da3115a3091 Mon Sep 17 00:00:00 2001 From: shantyk Date: Sun, 5 Apr 2026 19:50:51 -0600 Subject: [PATCH 1/6] WIP: alternative for notification APIs --- build.gradle | 2 +- .../blackduck/codelocation/CodeLocationCreationService.java | 6 ++++++ .../blackduck/service/dataservice/NotificationService.java | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 48e2880af..5e9fe0976 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 = '67.0.21-SNAPSHOT-shanty' 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..8b858ea7e 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); } 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..3747e6751 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 @@ -85,6 +85,7 @@ public Date getLatestNotificationDate() throws IntegrationException { * @throws IntegrationException */ public Date getLatestUserNotificationDate(UserView userView) throws IntegrationException { + logger.warn("Fetching latest notification date for user via a low‑performance API."); BlackDuckRequestBuilder blackDuckRequestBuilder = createLatestDateRequestBuilder(); BlackDuckMultipleRequest requestMultiple = blackDuckRequestBuilder.buildBlackDuckRequest(userNotificationsResponses.apply(userView)); List userNotifications = blackDuckApiClient.getSomeResponses(requestMultiple, 1); From d8a20ad6b8d1f9a55fc490c84f88c7edc1e7dbeb Mon Sep 17 00:00:00 2001 From: shantyk Date: Mon, 13 Apr 2026 17:55:09 -0600 Subject: [PATCH 2/6] Update intelligent persistent BDIO upload methods with alternative that doesn't use notification APIs --- build.gradle | 2 +- .../IntelligentPersistenceService.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5e9fe0976..cfca017cf 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-shanty' +version = '67.0.21' 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/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); } From 84dfbfd7dd625e043e82059f9513901accaae1ba Mon Sep 17 00:00:00 2001 From: shantyk Date: Tue, 14 Apr 2026 08:31:55 -0600 Subject: [PATCH 3/6] Binary scan alternative --- .../codelocation/binaryscanner/BinaryScanUploadService.java | 5 +++++ 1 file changed, 5 insertions(+) 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); From 7e10c6a1e89de834107ef46dd7708ce55d7253ba Mon Sep 17 00:00:00 2001 From: shantyk Date: Wed, 15 Apr 2026 18:46:27 -0600 Subject: [PATCH 4/6] Add back -SNAPSHOT suffix the version in build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index cfca017cf..48e2880af 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' +version = '67.0.21-SNAPSHOT' description = 'A library for using various capabilities of Black Duck, notably the REST API and signature scanning.' From b0411c3830944a1073cefbea5175fab02b2ec79a Mon Sep 17 00:00:00 2001 From: shantyk Date: Thu, 16 Apr 2026 09:31:53 -0600 Subject: [PATCH 5/6] Remove getLatestuserNotification() method and replace any uses with the current date instead. --- .../codelocation/CodeLocationCreationService.java | 2 +- .../service/dataservice/NotificationService.java | 12 ------------ .../binaryscanner/BinaryScanUploadServiceTestIT.java | 2 +- .../comprehensive/ComprehensiveCookbookTestIT.java | 4 ++-- .../CreateProjectWithBdioAndVerifyBOMTest.java | 2 +- .../blackduck/comprehensive/NotificationsTestIT.java | 2 +- 6 files changed, 6 insertions(+), 18 deletions(-) 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 8b858ea7e..1a6349c34 100644 --- a/src/main/java/com/blackduck/integration/blackduck/codelocation/CodeLocationCreationService.java +++ b/src/main/java/com/blackduck/integration/blackduck/codelocation/CodeLocationCreationService.java @@ -91,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/service/dataservice/NotificationService.java b/src/main/java/com/blackduck/integration/blackduck/service/dataservice/NotificationService.java index 3747e6751..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,18 +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 { - logger.warn("Fetching latest notification date for user via a low‑performance API."); - 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()); From 326f1a38aa31d22b8589219ebdcf8f5ae76c4b9b Mon Sep 17 00:00:00 2001 From: shantyk Date: Thu, 16 Apr 2026 09:36:40 -0600 Subject: [PATCH 6/6] Bump major version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.'