1 22 package org.jboss.test.recover.test; 23 24 import javax.naming.Context ; 25 import javax.rmi.PortableRemoteObject ; 26 import javax.transaction.UserTransaction ; 27 28 import junit.framework.Test; 29 30 import org.jboss.test.recover.interfaces.FrontEnd; 31 import org.jboss.test.recover.interfaces.FrontEndHome; 32 33 39 public class RecoveryFromCrashOfFirstRemoteResourceWithXADatabaseAfterPrepareTestCase 40 extends JBossCrashRecoveryTestCase 41 { 42 public RecoveryFromCrashOfFirstRemoteResourceWithXADatabaseAfterPrepareTestCase(String name) 43 { 44 super(name); 45 } 46 47 public void test() throws Exception 48 { 49 log.info("*** starting " + getUnqualifiedClassName() + " ***"); 50 51 Context ctx = getInitialContext(); 52 53 getLog().debug("Obtain UserTransaction instance"); 54 UserTransaction userTx = (UserTransaction ) ctx.lookup("UserTransaction"); 55 56 getLog().debug("Obtain home interface"); 57 Object objref = ctx.lookup("dtmrecoverytest/FrontEndEJB"); 58 FrontEndHome home = 59 (FrontEndHome) PortableRemoteObject.narrow(objref, FrontEndHome.class); 60 61 getLog().debug("Create FrontEnd bean"); 62 FrontEnd frontEnd = home.create("testCommittedTx", true); 63 64 getLog().debug("Check updated balances"); 65 userTx.begin(); 66 int[] balances = frontEnd.getBalancesOverJBRem(); 67 userTx.commit(); 68 69 assertTrue("first balance == 201", balances[0] == 201); 70 assertTrue("second balance == 202", balances[1] == 202); 71 72 getLog().debug("Remove FrontEnd bean"); 73 frontEnd.remove(); 74 } 75 76 public static Test suite() throws Exception 77 { 78 return suite(RecoveryFromCrashOfFirstRemoteResourceWithXADatabaseAfterPrepareTestCase.class); 79 } 80 81 } 82 | Popular Tags |