1 22 package org.jboss.test.entity.test; 23 24 import junit.framework.Test; 25 26 import org.jboss.test.JBossTestCase; 27 import org.jboss.test.entity.interfaces.UnsetEntityContext; 28 import org.jboss.test.entity.interfaces.UnsetEntityContextHome; 29 30 36 public class UnsetEntityContextUnitTestCase extends JBossTestCase 37 { 38 public UnsetEntityContextUnitTestCase(String name) 39 { 40 super(name); 41 } 42 43 public static Test suite() 44 throws Exception 45 { 46 return getDeploySetup(UnsetEntityContextUnitTestCase.class, "jboss-test-unsetentitycontext.jar"); 47 } 48 49 56 public void testUnsetEntityContextCalled() throws Exception 57 { 58 UnsetEntityContextHome home = (UnsetEntityContextHome)super.getInitialContext().lookup("UnsetEntityContext"); 59 60 home.clearUnsetEntityContextCallCounter(); 62 63 assertEquals("UnsetEntityContextCallCount", 1, home.getUnsetEntityContextCallCounter()); 65 66 assertEquals("UnsetEntityContextCallCount", 2, home.getUnsetEntityContextCallCounter()); 68 69 assertEquals("UnsetEntityContextCallCount", 3, home.getUnsetEntityContextCallCounter()); 71 } 72 73 80 public void testBeanReturnedToPool() throws Exception 81 { 82 UnsetEntityContextHome home = (UnsetEntityContextHome)super.getInitialContext().lookup("UnsetEntityContext"); 83 84 home.clearUnsetEntityContextCallCounter(); 86 87 assertEquals("UnsetEntityContextCallCount", 1, home.getUnsetEntityContextCallCounter()); 89 90 UnsetEntityContext bean = home.create("TestBean"); 91 bean.remove(); 93 94 } 98 } 99 | Popular Tags |