From 423f696f71fdcd662ea02ad6b6e84d7f47ebc4e1 Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Mon, 4 Nov 2024 13:42:24 -0500 Subject: [PATCH] server: Return derived data provider descriptor when deleting it Update swagger description for deletion and method name. Signed-off-by: Bernd Hufmann --- .../rest/core/tests/services/DataProviderServiceTest.java | 2 ++ .../jersey/rest/core/services/DataProviderService.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/services/DataProviderServiceTest.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/services/DataProviderServiceTest.java index cfeb48f2..acc8c07a 100644 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/services/DataProviderServiceTest.java +++ b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/src/org/eclipse/tracecompass/incubator/trace/server/jersey/rest/core/tests/services/DataProviderServiceTest.java @@ -772,6 +772,8 @@ public void testCreationDeletionOfDerivedDataProviders() throws IOException, URI try (Response response = dpDeletionEndpoint.request().delete()) { assertNotNull(response); assertEquals(Status.OK.getStatusCode(), response.getStatus()); + DataProviderDescriptorStub deletedDp = response.readEntity(DataProviderDescriptorStub.class); + assertEquals(derivedDp, deletedDp); } } diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java index 9a02bc09..9df28ded 100644 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java +++ b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java @@ -14,7 +14,6 @@ import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.ANN; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.CFG_CREATE_DESC; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.CFG_KEYS_DESC; -import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DP_CFG_EX; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.CFG_TYPE_ID; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.COLUMNS; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.COLUMNS_EX; @@ -24,6 +23,7 @@ import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DIRECTION; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DIRECTION_COUNT; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DIRECTION_EX; +import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DP_CFG_EX; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DT; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.ELEMENT; import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.ELEMENT_EX; @@ -1326,11 +1326,11 @@ public Response createDataProvider( @Tag(name = OCG) @Produces(MediaType.APPLICATION_JSON) @Operation(summary = "Delete a configuration instance of a given configuration type", responses = { - @ApiResponse(responseCode = "200", description = "The derived data provider (and it's configuration) was successfully deleted", content = @Content(schema = @Schema(implementation = org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.Configuration.class))), + @ApiResponse(responseCode = "200", description = "Returns the deleted derived data provider descriptor. The derived data provider (and it's configuration) was successfully deleted.", content = @Content(schema = @Schema(implementation = DataProvider.class))), @ApiResponse(responseCode = "400", description = INVALID_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "404", description = PROVIDER_CONFIG_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))), }) - public Response deleteDerivedOutput( + public Response deleteDerivedProvider( @Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID, @Parameter(description = OUTPUT_ID) @PathParam("outputId") String outputId, @Parameter(description = OUTPUT_ID) @PathParam("derivedOutputId") String derivedOutputId) { @@ -1370,7 +1370,7 @@ public Response deleteDerivedOutput( return Response.status(Status.NOT_FOUND).entity(NO_SUCH_PROVIDER).build(); } configurator.removeDataProviderDescriptor(experiment, derivedDescriptor); - return Response.ok().build(); + return Response.ok(derivedDescriptor).build(); } catch (TmfConfigurationException e) { return Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build(); }