Search in sources :

Example 1 with JTAActionBean

use of com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean in project narayana by jbosstm.

the class ObjStoreBrowserTest method getTransactionBean.

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;
}
Also used : OSEntryBean(com.arjuna.ats.arjuna.tools.osb.mbean.OSEntryBean) UidWrapper(com.arjuna.ats.arjuna.tools.osb.mbean.UidWrapper) JTAActionBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean)

Example 2 with JTAActionBean

use of com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean in project narayana by jbosstm.

the class ObjStoreBrowserTest method getHeuristicMBean.

private XAResourceRecordBeanMBean getHeuristicMBean(ObjStoreBrowser osb, TransactionImple tx, FailureXAResource failureXAResource) throws Exception {
    generateHeuristic(tx, failureXAResource);
    osb.probe();
    // there should be one MBean corresponding to the Transaction
    JTAActionBean actionBean = getTransactionBean(osb, tx, true);
    assertNotNull(actionBean);
    // and the transaction should contain only one participant (namely the FailureXAResource that generated the heuristic):
    Collection<LogRecordWrapper> participants = actionBean.getParticipants();
    assertEquals(1, participants.size());
    assertNotNull(failureXAResource.getXid());
    LogRecordWrapper participant = participants.iterator().next();
    assertTrue(participant.isHeuristic());
    assertTrue(participant instanceof XAResourceRecordBeanMBean);
    return (XAResourceRecordBeanMBean) participant;
}
Also used : XAResourceRecordBeanMBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBeanMBean) JTAActionBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean) LogRecordWrapper(com.arjuna.ats.arjuna.tools.osb.mbean.LogRecordWrapper)

Example 3 with JTAActionBean

use of com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean in project narayana by jbosstm.

the class ObjStoreBrowserTest method getHeuristic.

private HeuristicTestData getHeuristic() throws Exception {
    // generates a heuristic on commit
    FailureXAResource failureXAResource = new FailureXAResource(FailureXAResource.FailLocation.commit);
    TransactionImple tx = new TransactionImple();
    XAResourceRecordBeanMBean resourceBean = getHeuristicMBean(osb, tx, failureXAResource);
    JTAActionBean txnMBean = getTransactionBean(osb, tx, true);
    Set<ObjectName> participants;
    String resourceBeanName;
    String txnBeanName;
    assertNotNull(txnMBean);
    assertNotNull(resourceBean);
    txnBeanName = String.format("jboss.jta:type=ObjectStore,itype=%s,uid=%s", txnMBean.type(), txnMBean.getId().replace(':', '_'));
    resourceBeanName = String.format("%s,puid=%s", txnBeanName, resourceBean.getId().replace(':', '_'));
    participants = JMXServer.getAgent().queryNames(resourceBeanName, null);
    assertEquals(1, participants.size());
    return new HeuristicTestData(tx, failureXAResource, txnMBean, resourceBean, participants.iterator().next(), txnBeanName, resourceBeanName);
}
Also used : XAResourceRecordBeanMBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jts.XAResourceRecordBeanMBean) FailureXAResource(com.hp.mwtests.ts.jta.tools.FailureXAResource) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) JTAActionBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean) ObjectName(javax.management.ObjectName)

Example 4 with JTAActionBean

use of com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean in project narayana by jbosstm.

the class ObjStoreBrowserTest method getHeuristicMBean.

private XAResourceRecordBeanMBean getHeuristicMBean(ObjStoreBrowser osb, TransactionImple tx, FailureXAResource failureXAResource) throws Exception {
    generateHeuristic(tx, failureXAResource);
    osb.probe();
    // there should be one MBean corresponding to the Transaction
    JTAActionBean actionBean = getTransactionBean(osb, tx, true);
    assertNotNull(actionBean);
    // and the transaction should contain only one participant (namely the FailureXAResource that generated the heuristic):
    Collection<LogRecordWrapper> participants = actionBean.getParticipants();
    assertEquals(1, participants.size());
    assertNotNull(failureXAResource.getXid());
    LogRecordWrapper participant = participants.iterator().next();
    assertTrue(participant.isHeuristic());
    assertTrue(participant instanceof XAResourceRecordBeanMBean);
    return (XAResourceRecordBeanMBean) participant;
}
Also used : XAResourceRecordBeanMBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jts.XAResourceRecordBeanMBean) JTAActionBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean) LogRecordWrapper(com.arjuna.ats.arjuna.tools.osb.mbean.LogRecordWrapper)

Example 5 with JTAActionBean

use of com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean in project narayana by jbosstm.

the class ObjStoreBrowserTest method getHeuristic.

private HeuristicTestData getHeuristic() throws Exception {
    // generates a heuristic on commit
    FailureXAResource failureXAResource = new FailureXAResource(FailureXAResource.FailLocation.commit);
    TransactionImple tx = new TransactionImple(1000000000);
    XAResourceRecordBeanMBean resourceBean = getHeuristicMBean(osb, tx, failureXAResource);
    JTAActionBean txnMBean = getTransactionBean(osb, tx, true);
    Set<ObjectName> participants;
    String resourceBeanName;
    String txnBeanName;
    assertNotNull(txnMBean);
    assertNotNull(resourceBean);
    txnBeanName = String.format("jboss.jta:type=ObjectStore,itype=%s,uid=%s", txnMBean.type(), txnMBean.getId().replace(':', '_'));
    resourceBeanName = String.format("%s,puid=%s", txnBeanName, resourceBean.getId().replace(':', '_'));
    participants = JMXServer.getAgent().queryNames(resourceBeanName, null);
    assertEquals(1, participants.size());
    return new HeuristicTestData(tx, failureXAResource, txnMBean, resourceBean, participants.iterator().next(), txnBeanName, resourceBeanName);
}
Also used : XAResourceRecordBeanMBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBeanMBean) TransactionImple(com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple) JTAActionBean(com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean) ObjectName(javax.management.ObjectName)

Aggregations

JTAActionBean (com.arjuna.ats.internal.jta.tools.osb.mbean.jta.JTAActionBean)6 LogRecordWrapper (com.arjuna.ats.arjuna.tools.osb.mbean.LogRecordWrapper)2 OSEntryBean (com.arjuna.ats.arjuna.tools.osb.mbean.OSEntryBean)2 UidWrapper (com.arjuna.ats.arjuna.tools.osb.mbean.UidWrapper)2 XAResourceRecordBeanMBean (com.arjuna.ats.internal.jta.tools.osb.mbean.jta.XAResourceRecordBeanMBean)2 XAResourceRecordBeanMBean (com.arjuna.ats.internal.jta.tools.osb.mbean.jts.XAResourceRecordBeanMBean)2 ObjectName (javax.management.ObjectName)2 TransactionImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple)1 TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple)1 FailureXAResource (com.hp.mwtests.ts.jta.tools.FailureXAResource)1