001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.ejb3.test.entityexception.unit;
023:
024: import org.jboss.ejb3.test.entityexception.ExceptionTest;
025: import org.jboss.ejb3.test.entityexception.Person;
026: import org.jboss.test.JBossTestCase;
027: import junit.framework.Test;
028:
029: public class EntityExceptionTestCase extends JBossTestCase {
030: org.apache.log4j.Logger log = getLog();
031:
032: Person kabir;
033:
034: public EntityExceptionTestCase(String name) {
035: super (name);
036: }
037:
038: public void testTransactionRequiredException() throws Exception {
039: ExceptionTest test = (ExceptionTest) getInitialContext()
040: .lookup("ExceptionTestBean/remote");
041: test.testTransactionRequiredException();
042: }
043:
044: public void testPersistExceptions() throws Exception {
045: ExceptionTest test = (ExceptionTest) getInitialContext()
046: .lookup("ExceptionTestBean/remote");
047: kabir = new Person(1, "Kabir");
048: kabir = test.createEntry(kabir);
049:
050: test.testEMPersistExceptions();
051: }
052:
053: public void testEMFindExceptions() throws Exception {
054: ExceptionTest test = (ExceptionTest) getInitialContext()
055: .lookup("ExceptionTestBean/remote");
056: assertTrue(test.testEMFindExceptions());
057: }
058:
059: public void testEMMergeExceptions() throws Exception {
060: ExceptionTest test = (ExceptionTest) getInitialContext()
061: .lookup("ExceptionTestBean/remote");
062: test.testEMMergeExceptions();
063: }
064:
065: public void testEMCreateQueryExceptions() throws Exception {
066: ExceptionTest test = (ExceptionTest) getInitialContext()
067: .lookup("ExceptionTestBean/remote");
068: test.testEMCreateQueryExceptions();
069: }
070:
071: public void testEMRefreshExceptions() throws Exception {
072: ExceptionTest test = (ExceptionTest) getInitialContext()
073: .lookup("ExceptionTestBean/remote");
074: test.testEMRefreshExceptions();
075: }
076:
077: public void testEMContainsExceptions() throws Exception {
078: ExceptionTest test = (ExceptionTest) getInitialContext()
079: .lookup("ExceptionTestBean/remote");
080: test.testEMContainsExceptions();
081: }
082:
083: public void testQueryNonEntity() throws Exception {
084: ExceptionTest test = (ExceptionTest) getInitialContext()
085: .lookup("ExceptionTestBean/remote");
086: test.testQueryNonEntity();
087: }
088:
089: public void testQuerySingleResultExceptions() throws Exception {
090: ExceptionTest test = (ExceptionTest) getInitialContext()
091: .lookup("ExceptionTestBean/remote");
092: test.testQuerySingleResultExceptions();
093: }
094:
095: public void testQuerySetHintAndParameter() throws Exception {
096: ExceptionTest test = (ExceptionTest) getInitialContext()
097: .lookup("ExceptionTestBean/remote");
098: test.testQuerySetHintAndParameter();
099: }
100:
101: public static Test suite() throws Exception {
102: return getDeploySetup(EntityExceptionTestCase.class,
103: "entityexception-test.jar");
104: }
105:
106: }
|