From 39bea7f1a125609288615694302933728f18b29e Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 19 Sep 2024 16:02:47 +0200 Subject: [PATCH] Use `/api/v1/event/token/{uuid}` instead of /api/v1/bom/token/{uui} in e2e tests (#1528) --- README.md | 1 + docs/getting-started/upgrading.md | 14 +++++++++----- .../dependencytrack/apiserver/ApiServerClient.java | 6 +++--- ...gResponse.java => EventProcessingResponse.java} | 2 +- .../e2e/BomUploadOssIndexAnalysisE2ET.java | 4 ++-- .../e2e/BomUploadProcessingE2ET.java | 4 ++-- .../e2e/BomUploadSnykAnalysisE2ET.java | 4 ++-- .../e2e/VulnerabilityPolicyE2ET.java | 4 ++-- 8 files changed, 22 insertions(+), 17 deletions(-) rename e2e/src/main/java/org/dependencytrack/apiserver/model/{BomProcessingResponse.java => EventProcessingResponse.java} (93%) diff --git a/README.md b/README.md index 805d97670..0bd4d30d3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Hyades [![Build Status](https://github.com/DependencyTrack/hyades/actions/workflows/ci.yml/badge.svg)](https://github.com/DependencyTrack/hyades/actions/workflows/ci.yml) +[![End-to-End Test](https://github.com/DependencyTrack/hyades/actions/workflows/e2e-test.yml/badge.svg)](https://github.com/DependencyTrack/hyades/actions/workflows/e2e-test.yml) [![Codacy Code Quality Badge](https://app.codacy.com/project/badge/Grade/64c349c2b92340ffb83f7dba1d6b03e5)](https://app.codacy.com/gh/DependencyTrack/hyades/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Codacy Coverage Badge](https://app.codacy.com/project/badge/Coverage/64c349c2b92340ffb83f7dba1d6b03e5)](https://app.codacy.com/gh/DependencyTrack/hyades/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage) diff --git a/docs/getting-started/upgrading.md b/docs/getting-started/upgrading.md index bde4d8d70..c35634ed7 100644 --- a/docs/getting-started/upgrading.md +++ b/docs/getting-started/upgrading.md @@ -23,15 +23,19 @@ Refer to the [kafka configuration reference] for details. Example of name change |:-----------------------------------------------------------|:----------------------------------------------------| | `alpine.kafka.processor.vuln.scan.result.processing.order` | `kafka.processor.vuln.scan.result.processing.order` | -* All deprecated endpoints mentioned below were removed: - * POST `/api/v1/policy/{policyUuid}/tag/{tagName}` - * DELETE `/api/v1/policy/{policyUuid}/tag/{tagName}` - * GET `/api/v1/tag/{policyUuid}` - * GET `/api/v1/bom/token/{uuid}` +* The endpoints deprecated in v4.x mentioned below were removed ([apiserver/#910]): + + | Removed endpoint | Replacement | + |:---------------------------------------------------|:-----------------------------------| + | `POST /api/v1/policy/{policyUuid}/tag/{tagName}` | `POST /api/v1/tag/{name}/policy` | + | `DELETE /api/v1/policy/{policyUuid}/tag/{tagName}` | `DELETE /api/v1/tag/{name}/policy` | + | `GET /api/v1/tag/{policyUuid}` | `GET /api/v1/tag/policy/{uuid}` | + | `GET /api/v1/bom/token/{uuid}` | `GET /api/v1/event/token/{uuid}` | [apiserver/#840]: https://github.com/DependencyTrack/hyades-apiserver/pull/840 [apiserver/#888]: https://github.com/DependencyTrack/hyades-apiserver/pull/888 [apiserver/#904]: https://github.com/DependencyTrack/hyades-apiserver/pull/904 +[apiserver/#910]: https://github.com/DependencyTrack/hyades-apiserver/pull/910 [hyades/#1392]: https://github.com/DependencyTrack/hyades/issues/1392 [kafka configuration reference]: ../reference/configuration/api-server.md#kafka diff --git a/e2e/src/main/java/org/dependencytrack/apiserver/ApiServerClient.java b/e2e/src/main/java/org/dependencytrack/apiserver/ApiServerClient.java index 96c46d369..dab3373b7 100644 --- a/e2e/src/main/java/org/dependencytrack/apiserver/ApiServerClient.java +++ b/e2e/src/main/java/org/dependencytrack/apiserver/ApiServerClient.java @@ -30,7 +30,7 @@ import jakarta.ws.rs.core.MediaType; import org.dependencytrack.apiserver.model.Analysis; import org.dependencytrack.apiserver.model.ApiKey; -import org.dependencytrack.apiserver.model.BomProcessingResponse; +import org.dependencytrack.apiserver.model.EventProcessingResponse; import org.dependencytrack.apiserver.model.BomUploadRequest; import org.dependencytrack.apiserver.model.ConfigProperty; import org.dependencytrack.apiserver.model.CreateNotificationRuleRequest; @@ -95,10 +95,10 @@ Team addPermissionToTeam(@PathParam("uuid") final UUID teamUuid, WorkflowTokenResponse uploadBom(final BomUploadRequest request); @GET - @Path("/bom/token/{token}") + @Path("/event/token/{token}") @Produces(MediaType.WILDCARD) @Consumes(MediaType.WILDCARD) - BomProcessingResponse isBomBeingProcessed(@PathParam("token") final String token); + EventProcessingResponse isEventBeingProcessed(@PathParam("token") final String token); @PUT @Path("/vulnerability") diff --git a/e2e/src/main/java/org/dependencytrack/apiserver/model/BomProcessingResponse.java b/e2e/src/main/java/org/dependencytrack/apiserver/model/EventProcessingResponse.java similarity index 93% rename from e2e/src/main/java/org/dependencytrack/apiserver/model/BomProcessingResponse.java rename to e2e/src/main/java/org/dependencytrack/apiserver/model/EventProcessingResponse.java index 39306defb..79d839a6c 100644 --- a/e2e/src/main/java/org/dependencytrack/apiserver/model/BomProcessingResponse.java +++ b/e2e/src/main/java/org/dependencytrack/apiserver/model/EventProcessingResponse.java @@ -21,5 +21,5 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) -public record BomProcessingResponse(Boolean processing) { +public record EventProcessingResponse(Boolean processing) { } diff --git a/e2e/src/test/java/org/dependencytrack/e2e/BomUploadOssIndexAnalysisE2ET.java b/e2e/src/test/java/org/dependencytrack/e2e/BomUploadOssIndexAnalysisE2ET.java index 7e06bc872..87314fd7a 100644 --- a/e2e/src/test/java/org/dependencytrack/e2e/BomUploadOssIndexAnalysisE2ET.java +++ b/e2e/src/test/java/org/dependencytrack/e2e/BomUploadOssIndexAnalysisE2ET.java @@ -18,7 +18,7 @@ */ package org.dependencytrack.e2e; -import org.dependencytrack.apiserver.model.BomProcessingResponse; +import org.dependencytrack.apiserver.model.EventProcessingResponse; import org.dependencytrack.apiserver.model.BomUploadRequest; import org.dependencytrack.apiserver.model.Finding; import org.dependencytrack.apiserver.model.Project; @@ -68,7 +68,7 @@ void test() throws Exception { .atMost(Duration.ofSeconds(30)) .pollDelay(Duration.ofMillis(250)) .untilAsserted(() -> { - final BomProcessingResponse processingResponse = apiServerClient.isBomBeingProcessed(response.token()); + final EventProcessingResponse processingResponse = apiServerClient.isEventBeingProcessed(response.token()); assertThat(processingResponse.processing()).isFalse(); }); diff --git a/e2e/src/test/java/org/dependencytrack/e2e/BomUploadProcessingE2ET.java b/e2e/src/test/java/org/dependencytrack/e2e/BomUploadProcessingE2ET.java index 884b0d7d1..053f47b74 100644 --- a/e2e/src/test/java/org/dependencytrack/e2e/BomUploadProcessingE2ET.java +++ b/e2e/src/test/java/org/dependencytrack/e2e/BomUploadProcessingE2ET.java @@ -21,7 +21,7 @@ import com.github.tomakehurst.wiremock.junit5.WireMockExtension; import com.icegreen.greenmail.junit5.GreenMailExtension; import com.icegreen.greenmail.util.ServerSetup; -import org.dependencytrack.apiserver.model.BomProcessingResponse; +import org.dependencytrack.apiserver.model.EventProcessingResponse; import org.dependencytrack.apiserver.model.BomUploadRequest; import org.dependencytrack.apiserver.model.ConfigProperty; import org.dependencytrack.apiserver.model.CreateNotificationRuleRequest; @@ -166,7 +166,7 @@ void test() throws Exception { .atMost(Duration.ofSeconds(15)) .pollDelay(Duration.ofMillis(250)) .untilAsserted(() -> { - final BomProcessingResponse processingResponse = apiServerClient.isBomBeingProcessed(response.token()); + final EventProcessingResponse processingResponse = apiServerClient.isEventBeingProcessed(response.token()); assertThat(processingResponse.processing()).isFalse(); }); diff --git a/e2e/src/test/java/org/dependencytrack/e2e/BomUploadSnykAnalysisE2ET.java b/e2e/src/test/java/org/dependencytrack/e2e/BomUploadSnykAnalysisE2ET.java index b27be4ecf..305c57735 100644 --- a/e2e/src/test/java/org/dependencytrack/e2e/BomUploadSnykAnalysisE2ET.java +++ b/e2e/src/test/java/org/dependencytrack/e2e/BomUploadSnykAnalysisE2ET.java @@ -18,7 +18,7 @@ */ package org.dependencytrack.e2e; -import org.dependencytrack.apiserver.model.BomProcessingResponse; +import org.dependencytrack.apiserver.model.EventProcessingResponse; import org.dependencytrack.apiserver.model.BomUploadRequest; import org.dependencytrack.apiserver.model.Finding; import org.dependencytrack.apiserver.model.Project; @@ -81,7 +81,7 @@ void test() throws Exception { .atMost(Duration.ofSeconds(30)) .pollDelay(Duration.ofMillis(250)) .untilAsserted(() -> { - final BomProcessingResponse processingResponse = apiServerClient.isBomBeingProcessed(response.token()); + final EventProcessingResponse processingResponse = apiServerClient.isEventBeingProcessed(response.token()); assertThat(processingResponse.processing()).isFalse(); }); diff --git a/e2e/src/test/java/org/dependencytrack/e2e/VulnerabilityPolicyE2ET.java b/e2e/src/test/java/org/dependencytrack/e2e/VulnerabilityPolicyE2ET.java index 3cdf0a008..1fdd8d5be 100644 --- a/e2e/src/test/java/org/dependencytrack/e2e/VulnerabilityPolicyE2ET.java +++ b/e2e/src/test/java/org/dependencytrack/e2e/VulnerabilityPolicyE2ET.java @@ -27,7 +27,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; import org.dependencytrack.apiserver.model.Analysis; -import org.dependencytrack.apiserver.model.BomProcessingResponse; +import org.dependencytrack.apiserver.model.EventProcessingResponse; import org.dependencytrack.apiserver.model.BomUploadRequest; import org.dependencytrack.apiserver.model.CreateNotificationRuleRequest; import org.dependencytrack.apiserver.model.CreateVulnerabilityRequest; @@ -219,7 +219,7 @@ void test() throws Exception { .atMost(Duration.ofSeconds(15)) .pollDelay(Duration.ofMillis(250)) .untilAsserted(() -> { - final BomProcessingResponse processingResponse = apiServerClient.isBomBeingProcessed(response.token()); + final EventProcessingResponse processingResponse = apiServerClient.isEventBeingProcessed(response.token()); assertThat(processingResponse.processing()).isFalse(); });