MicroserviceXAResource extends AbstractTransactionAssistanceXAResource { public static void configure(long minAgeOfTransactionInMSBeforeRelevantForRecovery, File recoveryStatePersistenceDirectory){ MicroserviceXAResource.minAgeOfTransactionInMSBeforeRelevantForRecovery = minAgeOfTransactionInMSBeforeRelevantForRecovery; MicroserviceXAResource.recoveryStatePersistenceDirectory = recoveryStatePersistenceDirectory; } MicroserviceXAResource(String jndiName, final CommitRollbackCallback commitRollbackCallback); @Override boolean isSameRM(XAResource xares); static void configure(long minAgeOfTransactionInMSBeforeRelevantForRecovery, File recoveryStatePersistenceDirectory);  }
@Test public void testConfigure() throws XAException, IOException { File f = File.createTempFile("prefix", "suffix"); f.deleteOnExit(); MicroserviceXAResource.configure(2, f); MicroserviceXAResource xa = new MicroserviceXAResource("a", null); assertEquals(2L, xa.getMinAgeOfTransactionBeforeRelevantForRecovery()); assertTrue(xa.getRecoveryStatePersistenceDirectory().getName(), xa.getRecoveryStatePersistenceDirectory().getName().startsWith("prefix")); assertTrue(xa.getRecoveryStatePersistenceDirectory().getName(), xa.getRecoveryStatePersistenceDirectory().getName().endsWith("suffix")); MicroserviceXAResource.configure(30000, new File(".")); }