/** * See if the given uid has previously been registered as an MBean * @param uid the unique id representing an ObjectStore entry * @return the MBean wrapper corresponding to the requested Uid (or null * if it hasn't been registered) */ public UidWrapper findUid(Uid uid) { return findUid(uid.stringForm()); }
private JTAActionBean getTransactionBean(ObjStoreBrowser osb, TransactionImple tx, boolean present) { // there should be one MBean corresponding to the Transaction tx UidWrapper w = osb.findUid(tx.get_uid()); if (!present) { assertNull(w); return null; } assertNotNull(w); OSEntryBean ai = w.getMBean(); assertNotNull(ai); // the MBean should wrap a JTAActionBean assertTrue(ai instanceof JTAActionBean); return (JTAActionBean) ai; }
@Test @BMScript("commitMarkableResourceFailAfterPrepare") public void testObjStoreBrowser() throws Exception { final DataSource dataSource = new JdbcDataSource(); ObjStoreBrowser osb = new ObjStoreBrowser(); Uid uid = generateCMRRecord(dataSource); osb.start(); osb.probe(); // there should be one MBean corresponding to the Transaction UidWrapper w = osb.findUid(uid); assertNotNull("ObjStoreBrowser could not find CMR uid wrapper", w); OSEntryBean ai = w.getMBean(); assertNotNull("ObjStoreBrowser could not find CMR uid", ai); assertEquals("ObjStoreBrowser found the wrong uid", ai.getUid(), uid); checkCMRRecovery(dataSource); w = osb.findUid(uid); assertNotNull("CMR uid still exists after a recovery can", w); } }