MicroserviceXAResource extends AbstractTransactionAssistanceXAResource { @Override public boolean isSameRM(XAResource xares) throws XAException { log.log(Level.FINEST, "isSameRM " + xares); if(xares instanceof MicroserviceXAResource){ MicroserviceXAResource other = (MicroserviceXAResource) xares; if(this.jndiName.equals(other.jndiName)){ return true; } } return false; } MicroserviceXAResource(String jndiName, final CommitRollbackCallback commitRollbackCallback); @Override boolean isSameRM(XAResource xares); static void configure(long minAgeOfTransactionInMSBeforeRelevantForRecovery, File recoveryStatePersistenceDirectory);  }
@Test public void testIsSameRM() throws XAException { MicroserviceXAResource xa = new MicroserviceXAResource("a", null); MicroserviceXAResource xb = new MicroserviceXAResource("a", null); assertTrue(xa.isSameRM(xb)); assertTrue(xb.isSameRM(xa)); MicroserviceXAResource xc = new MicroserviceXAResource("c", null); assertFalse(xa.isSameRM(xc)); assertFalse(xb.isSameRM(xc)); assertFalse(xc.isSameRM(xa)); assertFalse(xc.isSameRM(xb)); XAResource xd = mock(XAResource.class); assertFalse(xa.isSameRM(xd)); }