1 22 package org.jboss.ejb3.test.entityexception.unit; 23 24 import org.jboss.ejb3.test.entityexception.ExceptionTest; 25 import org.jboss.ejb3.test.entityexception.Person; 26 import org.jboss.test.JBossTestCase; 27 import junit.framework.Test; 28 29 public class EntityExceptionTestCase extends JBossTestCase 30 { 31 org.jboss.logging.Logger log = getLog(); 32 33 Person kabir; 34 35 public EntityExceptionTestCase(String name) 36 { 37 super(name); 38 } 39 40 public void testTransactionRequiredException() throws Exception 41 { 42 ExceptionTest test = 43 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 44 test.testTransactionRequiredException(); 45 } 46 47 public void testPersistExceptions() throws Exception 48 { 49 ExceptionTest test = 50 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 51 kabir = new Person(1, "Kabir"); 52 kabir = test.createEntry(kabir); 53 54 test.testEMPersistExceptions(); 55 } 56 57 public void testEMFindExceptions() throws Exception 58 { 59 ExceptionTest test = 60 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 61 assertTrue(test.testEMFindExceptions()); 62 } 63 64 public void testEMMergeExceptions() throws Exception 65 { 66 ExceptionTest test = 67 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 68 test.testEMMergeExceptions(); 69 } 70 71 public void testEMCreateQueryExceptions() throws Exception 72 { 73 ExceptionTest test = 74 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 75 test.testEMCreateQueryExceptions(); 76 } 77 78 public void testEMRefreshExceptions() throws Exception 79 { 80 ExceptionTest test = 81 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 82 test.testEMRefreshExceptions(); 83 } 84 85 public void testEMContainsExceptions() throws Exception 86 { 87 ExceptionTest test = 88 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 89 test.testEMContainsExceptions(); 90 } 91 92 public void testQuerySingleResultExceptions()throws Exception 93 { 94 ExceptionTest test = 95 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 96 test.testQuerySingleResultExceptions(); 97 } 98 99 public void testQuerySetHintAndParameter()throws Exception 100 { 101 ExceptionTest test = 102 (ExceptionTest)getInitialContext().lookup("ExceptionTestBean/remote"); 103 test.testQuerySetHintAndParameter(); 104 } 105 106 public static Test suite() throws Exception 107 { 108 return getDeploySetup(EntityExceptionTestCase.class, "entityexception-test.jar"); 109 } 110 111 112 } 113 | Popular Tags |