Skip to content

Commit

Permalink
server: Return a derived data provider descriptor when deleting it
Browse files Browse the repository at this point in the history
Update swagger description for deletion and corresponding method name.

Signed-off-by: Bernd Hufmann <[email protected]>
  • Loading branch information
bhufmann committed Nov 4, 2024
1 parent d648fd4 commit 07fff4f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
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;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.CONSISTENT_PARENT;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.COUNT;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.COUNT_EX;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.DERIVED_OUTPUT_ID;
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;
Expand Down Expand Up @@ -56,6 +57,7 @@
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.OCG;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.ONE_OF;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.OUTPUT_ID;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.PARENT_OUTPUT_ID;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.PROVIDER_CONFIG_NOT_FOUND;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.PROVIDER_NOT_FOUND;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.STY;
Expand Down Expand Up @@ -1311,29 +1313,29 @@ public Response createDataProvider(
}

/**
* DELETE a derived data provider from created by a given data provider
* DELETE a derived data provider created from a given data provider
*
* @param expUUID
* desired experiment UUID
* @param outputId
* Output ID for the data provider to query
* Output ID of the parent output provider
* @param derivedOutputId
* Output ID for the data provider to delete
* Output ID for the derived output provider to delete
* @return status and the deleted configuration instance, if successful
*/
@DELETE
@Path("/{outputId}/{derivedOutputId}")
@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))),
@Operation(summary = "Delete a derived output (and its configuration).", responses = {
@ApiResponse(responseCode = "200", description = "Returns the deleted derived data provider descriptor. The derived data provider (and its 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) {
@Parameter(description = PARENT_OUTPUT_ID) @PathParam("outputId") String outputId,
@Parameter(description = DERIVED_OUTPUT_ID) @PathParam("derivedOutputId") String derivedOutputId) {

if (outputId == null) {
return Response.status(Status.BAD_REQUEST).entity(MISSING_OUTPUTID + " (parent)").build(); //$NON-NLS-1$
Expand Down Expand Up @@ -1370,7 +1372,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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ public final class EndpointConstants {
*/
static final String CFG_TYPE_ID = "The configuration source type ID"; //$NON-NLS-1$
static final String CFG_CONFIG_ID = "The configuration instance ID"; //$NON-NLS-1$
static final String DERIVED_OUTPUT_ID = "ID of the derived output provider"; //$NON-NLS-1$
static final String EXP_UUID = "UUID of the experiment to query"; //$NON-NLS-1$
static final String MARKER_SET_ID = "The optional requested marker set's id"; //$NON-NLS-1$
static final String OUTPUT_ID = "ID of the output provider to query"; //$NON-NLS-1$
static final String PARENT_OUTPUT_ID = "ID of the parent output provider"; //$NON-NLS-1$
static final String TRACE_UUID = "UUID of the trace to query"; //$NON-NLS-1$

/**
Expand Down

0 comments on commit 07fff4f

Please sign in to comment.