55
66package io .narayana .lra .arquillian ;
77
8+ import static io .narayana .lra .arquillian .resource .LRAListener .LRA_LISTENER_UNTIMED_ACTION ;
9+ import static org .eclipse .microprofile .lra .annotation .ws .rs .LRA .LRA_HTTP_CONTEXT_HEADER ;
10+ import static org .junit .Assert .assertEquals ;
11+ import static org .junit .Assert .assertNotNull ;
12+ import static org .junit .Assert .fail ;
13+
814import io .narayana .lra .LRAData ;
915import io .narayana .lra .arquillian .resource .LRAListener ;
1016import io .narayana .lra .client .internal .NarayanaLRAClient ;
1117import io .narayana .lra .coordinator .domain .model .LongRunningAction ;
1218import io .narayana .lra .logging .LRALogger ;
13- import org .eclipse .microprofile .lra .annotation .LRAStatus ;
14- import org .jboss .arquillian .container .test .api .Deployment ;
15- import org .jboss .arquillian .container .test .api .OperateOnDeployment ;
16- import org .jboss .arquillian .container .test .api .RunAsClient ;
17- import org .jboss .arquillian .container .test .api .TargetsContainer ;
18- import org .jboss .arquillian .test .api .ArquillianResource ;
19- import org .jboss .shrinkwrap .api .spec .WebArchive ;
20- import org .junit .After ;
21- import org .junit .Assert ;
22- import org .junit .Before ;
23- import org .junit .BeforeClass ;
24- import org .junit .Rule ;
25- import org .junit .Test ;
26- import org .junit .rules .TestName ;
27-
2819import jakarta .ws .rs .NotFoundException ;
2920import jakarta .ws .rs .client .Client ;
3021import jakarta .ws .rs .client .ClientBuilder ;
4738import java .util .Map ;
4839import java .util .Optional ;
4940import java .util .stream .Stream ;
50-
51- import static io .narayana .lra .arquillian .resource .LRAListener .LRA_LISTENER_UNTIMED_ACTION ;
52- import static org .eclipse .microprofile .lra .annotation .ws .rs .LRA .LRA_HTTP_CONTEXT_HEADER ;
53- import static org .junit .Assert .assertEquals ;
54- import static org .junit .Assert .assertNotNull ;
55- import static org .junit .Assert .fail ;
41+ import org .eclipse .microprofile .lra .annotation .LRAStatus ;
42+ import org .jboss .arquillian .container .test .api .Deployment ;
43+ import org .jboss .arquillian .container .test .api .OperateOnDeployment ;
44+ import org .jboss .arquillian .container .test .api .RunAsClient ;
45+ import org .jboss .arquillian .container .test .api .TargetsContainer ;
46+ import org .jboss .arquillian .test .api .ArquillianResource ;
47+ import org .jboss .shrinkwrap .api .spec .WebArchive ;
48+ import org .junit .After ;
49+ import org .junit .Assert ;
50+ import org .junit .Before ;
51+ import org .junit .BeforeClass ;
52+ import org .junit .Rule ;
53+ import org .junit .Test ;
54+ import org .junit .rules .TestName ;
5655
5756/**
5857 * This test class testes that an LRA is cancelled after lra-coordinator is restarted.
@@ -141,7 +140,8 @@ public static WebArchive deploy() {
141140 }
142141
143142 @ Test
144- public void lraCoordinatorShortTimeoutLRA (@ ArquillianResource @ OperateOnDeployment (LRA_PARTICIPANT_DEPLOYMENT_QUALIFIER ) URL baseURL )
143+ public void lraCoordinatorShortTimeoutLRA (
144+ @ ArquillianResource @ OperateOnDeployment (LRA_PARTICIPANT_DEPLOYMENT_QUALIFIER ) URL baseURL )
145145 throws URISyntaxException {
146146
147147 String lraId ;
@@ -180,12 +180,15 @@ public void lraCoordinatorShortTimeoutLRA(@ArquillianResource @OperateOnDeployme
180180 // Verifies that the resource was notified that the LRA finished
181181 String listenerStatus = getStatusFromListener (lraListenerURI );
182182
183- assertEquals (String .format ("The service lra-listener should have been told that the final state of the LRA %s was cancelled" , lraId ),
183+ assertEquals (
184+ String .format ("The service lra-listener should have been told that the final state of the LRA %s was cancelled" ,
185+ lraId ),
184186 LRAStatus .Cancelled .name (), listenerStatus );
185187 }
186188
187189 @ Test
188- public void lraCoordinatorRecoveryTwoLRAs (@ ArquillianResource @ OperateOnDeployment (LRA_PARTICIPANT_DEPLOYMENT_QUALIFIER ) URL deploymentUrl )
190+ public void lraCoordinatorRecoveryTwoLRAs (
191+ @ ArquillianResource @ OperateOnDeployment (LRA_PARTICIPANT_DEPLOYMENT_QUALIFIER ) URL deploymentUrl )
189192 throws URISyntaxException {
190193
191194 URI lraListenerURI = UriBuilder .fromUri (deploymentUrl .toURI ()).path (LRAListener .LRA_LISTENER_PATH ).build ();
@@ -235,7 +238,8 @@ private void doWait(long millis) {
235238 try {
236239 Thread .sleep (millis );
237240 } catch (InterruptedException ex ) {
238- LRALogger .logger .errorf ("An exception has been thrown while the test was trying to wait for %d milliseconds" , millis );
241+ LRALogger .logger .errorf ("An exception has been thrown while the test was trying to wait for %d milliseconds" ,
242+ millis );
239243 Assert .fail ();
240244 }
241245 }
@@ -252,7 +256,8 @@ private int recover() {
252256 .request ()
253257 .get ()) {
254258
255- Assert .assertEquals ("Unexpected status from recovery call to " + lraClient .getRecoveryUrl (), 200 , response .getStatus ());
259+ Assert .assertEquals ("Unexpected status from recovery call to " + lraClient .getRecoveryUrl (), 200 ,
260+ response .getStatus ());
256261
257262 // The result will be a List<LRAStatusHolder> of recovering LRAs but we just need the count
258263 String recoveringLRAs = response .readEntity (String .class );
@@ -289,7 +294,10 @@ private String getStatusFromListener(URI lraListenerURI) {
289294 }
290295
291296 /**
292- * <p>This method fetches the first LRA transaction from the File-System Object Store (ShadowNoFileLockStore).</p>
297+ * <p>
298+ * This method fetches the first LRA transaction from the File-System Object Store (ShadowNoFileLockStore).
299+ * </p>
300+ *
293301 * @return The ID of the first LRA transaction
294302 */
295303 String getFirstLRAFromFS () {
@@ -305,7 +313,10 @@ String getFirstLRAFromFS() {
305313 }
306314
307315 /**
308- * <p>This method fetches the last LRA transaction from lra-coordinator.</p>
316+ * <p>
317+ * This method fetches the last LRA transaction from lra-coordinator.
318+ * </p>
319+ *
309320 * @return The ID of the last LRA transaction
310321 */
311322 String getLastLRAFromObjectStore () {
@@ -322,7 +333,8 @@ String getLastLRAFromObjectStore() {
322333 }
323334
324335 /**
325- * <p>This method physically deletes the folder (and all its content) where the File-System Object Store is used.
336+ * <p>
337+ * This method physically deletes the folder (and all its content) where the File-System Object Store is used.
326338 */
327339 private void clearRecoveryLogFromFS () {
328340 try (Stream <Path > recoveryLogFiles = Files .walk (storeDir )) {
@@ -332,12 +344,13 @@ private void clearRecoveryLogFromFS() {
332344 .forEach (File ::delete );
333345 } catch (IOException ioe ) {
334346 // transaction logs will only exists after there has been a previous run
335- LRALogger .logger .debugf (ioe ,"Cannot finish delete operation on recovery log dir '%s'" , storeDir );
347+ LRALogger .logger .debugf (ioe , "Cannot finish delete operation on recovery log dir '%s'" , storeDir );
336348 }
337349 }
338350
339351 /**
340- * <p>This method deletes LRA transactions through lra-coordinator.
352+ * <p>
353+ * This method deletes LRA transactions through lra-coordinator.
341354 */
342355 private void clearRecoveryLogFromObjectStore () {
343356
0 commit comments