We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create LRA testing feature for running LRA coordinator on random port in @HelidonTest environment .
@HelidonTest
Example:
@HelidonTest @AddBean(TestLraCoordinator.class) @Path("/test") public class LraTest { private final WebTarget target; private final Set<String> completedLras; private final Set<String> cancelledLras; @Inject private TestLraCoordinator coordinator; @Inject public LraTest(WebTarget target) { this.target = target; this.completedLras = new CopyOnWriteArraySet<>(); this.cancelledLras = new CopyOnWriteArraySet<>(); } @PUT @Path("/withdraw") @LRA(LRA.Type.REQUIRES_NEW) public Response withdraw(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) Optional<URI> lraI ... return Response.ok().build(); } @Complete public void complete(URI lraId) { completedLras.add(lraId.toString()); } @Compensate public void rollback(URI lraId) { cancelledLras.add(lraId.toString()); } @Test public void testLra() { try (Response res = target .path("/test/withdraw") .request() .put(Entity.entity("test", MediaType.TEXT_PLAIN_TYPE))) { assertThat(res.getStatus(), is(200)); String lraId = res.getHeaderString(LRA.LRA_HTTP_CONTEXT_HEADER); Lra lra = coordinator.lra(lraId); assertThat(lra.status(), is(LRAStatus.Closed)); assertThat(completedLras, contains(lraId)); } } }
The text was updated successfully, but these errors were encountered:
danielkec
Successfully merging a pull request may close this issue.
Create LRA testing feature for running LRA coordinator on random port in
@HelidonTest
environment .Example:
The text was updated successfully, but these errors were encountered: