Skip to content

Commit

Permalink
server: Test fetch trace if trace is not available on server
Browse files Browse the repository at this point in the history
Signed-off-by: Bernd Hufmann <[email protected]>
  • Loading branch information
bhufmann committed Oct 4, 2024
1 parent 343396a commit 62dd3c7
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Collections;

import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.eclipse.core.resources.IFolder;
Expand Down Expand Up @@ -64,12 +65,17 @@ public void testWithOneTrace() {
assertEquals("Expected set of traces to contain trace2 stub",
Collections.singleton(CONTEXT_SWITCHES_KERNEL_NOT_INITIALIZED_STUB), getTraces(traces));

Response deleteResponse = traces.path(kernelStub.getUUID().toString()).request().delete();
int deleteCode = deleteResponse.getStatus();
assertEquals("Failed to DELETE trace2, error code=" + deleteCode, 200, deleteCode);
assertEquals(CONTEXT_SWITCHES_KERNEL_NOT_INITIALIZED_STUB, deleteResponse.readEntity(TraceModelStub.class));

assertEquals("Trace should have been deleted", Collections.emptySet(), getTraces(traces));
String kernelStubUUUID = kernelStub.getUUID().toString();

try (Response deleteResponse = traces.path(kernelStub.getUUID().toString()).request().delete()) {
int deleteCode = deleteResponse.getStatus();
assertEquals("Failed to DELETE trace2, error code=" + deleteCode, 200, deleteCode);
assertEquals(CONTEXT_SWITCHES_KERNEL_NOT_INITIALIZED_STUB, deleteResponse.readEntity(TraceModelStub.class));
}
try (Response response = traces.path(kernelStubUUUID).request(MediaType.APPLICATION_JSON).get()) {
assertEquals("Trace should have been deleted", 404, response.getStatus());
}
assertEquals("Trace should have been deleted and trace set should be empty", Collections.emptySet(), getTraces(traces));
}

/**
Expand Down

0 comments on commit 62dd3c7

Please sign in to comment.