use of org.eclipse.microprofile.lra.annotation.LRAStatus in project narayana by jbosstm.
the class LRATest method assertStatus.
private void assertStatus(String lraId, LRAStatus expected, boolean nullValid) {
try {
LRAStatus status = getStatus(new URI(lraId));
assertTrue("unexpected null LRA status", status != null || nullValid);
assertTrue("Expected status " + expected + " but state was " + status, status == null || status == expected);
} catch (URISyntaxException e) {
fail(String.format("%s: %s", testName.getMethodName(), e.getMessage()));
}
}
use of org.eclipse.microprofile.lra.annotation.LRAStatus in project narayana by jbosstm.
the class NonRootLRAParticipantIT method testFinishLRA.
/*
* Test that a participant can join an LRA using the Narayana specific client API
* Test that the LRA has the correct status of Closing if a participant
* returns 202 Accepted when asked to complete.
* @throws URISyntaxException if arquillian URL is invalid
*/
@Test
public void testFinishLRA() throws URISyntaxException {
URI lraId = lraClient.startLRA("testFinishLRA");
lrasToAfterFinish.add(lraId);
URI compensateURI = new URI(baseURL.toExternalForm() + "/participant/compensate");
URI completeURI = new URI(baseURL.toExternalForm() + "/participant/complete");
// enlist the participant with these compensate and complete URIs into the LRA
lraClient.joinLRA(lraId, 0L, compensateURI, completeURI, null, null, null, null, null);
lraClient.closeLRA(lraId);
try {
LRAStatus status = lraClient.getStatus(lraId);
Assert.assertEquals("wrong state", Closing, status);
} catch (WebApplicationException e) {
fail("testFinishLRA: received unexpected response code (" + e.getResponse().getStatus() + ") getting LRA status " + e.getMessage());
}
}
Aggregations