Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static io.trino.client.JsonCodec.jsonCodec;
import static io.trino.client.JsonResponse.execute;
import static java.lang.String.format;
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.net.HttpURLConnection.HTTP_UNAVAILABLE;
import static java.time.temporal.ChronoUnit.MILLIS;
Expand Down Expand Up @@ -96,7 +97,7 @@ public void tokenReceived(URI tokenUri)
.withMaxAttempts(-1)
.withMaxDuration(Duration.ofSeconds(4))
.withBackoff(100, 500, MILLIS)
.handleResultIf(code -> code != HTTP_OK))
.handleResultIf(code -> code >= HTTP_INTERNAL_ERROR))
Comment thread
wendigo marked this conversation as resolved.
.get(() -> {
Request request = prepareRequestBuilder(tokenUri)
.delete()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,16 @@ public void testTokenReceived()
}

@Test
public void testTokenReceivedRetriesUntilHTTP_OK()
public void testTokenReceivedRetriesUntilNotErrorReturned()
{
server.enqueue(status(HTTP_UNAVAILABLE));
server.enqueue(status(HTTP_UNAVAILABLE));
server.enqueue(status(HTTP_UNAVAILABLE));
server.enqueue(status(202));
server.enqueue(status(303));
server.enqueue(status(HTTP_OK));
server.enqueue(status(HTTP_OK));
server.enqueue(status(HTTP_OK));

tokenPoller.tokenReceived(tokenUri());

assertThat(server.getRequestCount()).isEqualTo(6);
assertThat(server.getRequestCount()).isEqualTo(4);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,16 @@ private static Response pendingResponse(HttpServletRequest request)
@ResourceSecurity(PUBLIC)
@DELETE
@Path("{authId}")
public void deleteAuthenticationToken(@PathParam("authId") UUID authId)
public Response deleteAuthenticationToken(@PathParam("authId") UUID authId)
{
if (authId == null) {
throw new BadRequestException();
}

tokenExchange.dropToken(authId);
return Response
.ok()
Comment thread
wendigo marked this conversation as resolved.
.build();
}

public static String getTokenUri(UUID authId)
Expand Down