1 22 package org.jboss.test.entity.test; 23 24 import junit.framework.Test; 25 26 import org.jboss.test.JBossTestCase; 27 28 import org.jboss.test.entity.interfaces.EJBLoad; 29 import org.jboss.test.entity.interfaces.EJBLoadHome; 30 31 37 public class EJBLoadUnitTestCase 38 extends JBossTestCase 39 { 40 public EJBLoadUnitTestCase(String name) 41 { 42 super(name); 43 } 44 45 public static Test suite() 46 throws Exception 47 { 48 return getDeploySetup(EJBLoadUnitTestCase.class, "jboss-test-ejbload.jar"); 49 } 50 51 public void testNoTransactionCommitB() 52 throws Exception 53 { 54 getLog().debug("Retrieving enitity"); 55 EJBLoad entity = getEJBLoadHomeB().findByPrimaryKey("Entity"); 56 entity.wasEJBLoadCalled(); 57 58 getLog().debug("Testing that ejb load is invoked again"); 59 entity.noTransaction(); 60 assertTrue("Should reload for option b after access outside a transaction", entity.wasEJBLoadCalled()); 61 } 62 63 public void testNoTransactionCommitC() 64 throws Exception 65 { 66 getLog().debug("Retrieving enitity"); 67 EJBLoad entity = getEJBLoadHomeC().findByPrimaryKey("Entity"); 68 entity.wasEJBLoadCalled(); 69 70 getLog().debug("Testing that ejb load is invoked again"); 71 entity.noTransaction(); 72 assertTrue("Should reload for option c after access outside a transaction", entity.wasEJBLoadCalled()); 73 } 74 75 private EJBLoadHome getEJBLoadHomeB() 76 throws Exception 77 { 78 return (EJBLoadHome) getInitialContext().lookup("EJBLoadB"); 79 } 80 81 private EJBLoadHome getEJBLoadHomeC() 82 throws Exception 83 { 84 return (EJBLoadHome) getInitialContext().lookup("EJBLoadC"); 85 } 86 } 87 | Popular Tags |