001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: F_BasicHomeInterfaceEB.java 5412 2004-09-10 12:57:47Z durieuxp $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import javax.naming.NamingException;
029: import javax.rmi.PortableRemoteObject;
030:
031: import junit.framework.Test;
032: import junit.framework.TestSuite;
033:
034: import org.objectweb.jonas.jtests.beans.ebasic.SimpleHome;
035: import org.objectweb.jonas.jtests.beans.ebasic.Simple;
036:
037: /**
038: * This set of test are basic tests on BMP entity home interface.
039: * Only specific tests to BMP are here, all tests common to CMP and BMP
040: * are in the inherited class A_BasicHomeInterface
041: * @author Philippe Coq, Philippe Durieux (jonas team)
042: */
043: public class F_BasicHomeInterfaceEB extends A_BasicHomeInterface {
044:
045: private static String BEAN_HOME = "ebasicSimpleEBHome";
046:
047: public F_BasicHomeInterfaceEB(String name) {
048: super (name);
049: }
050:
051: public SimpleHome getHome() {
052: if (home == null) {
053: try {
054: home = (SimpleHome) PortableRemoteObject.narrow(ictx
055: .lookup(BEAN_HOME), SimpleHome.class);
056: } catch (NamingException e) {
057: fail("Cannot get bean home");
058: }
059: }
060: return home;
061: }
062:
063: public void testIllegalState() throws Exception {
064: getHome().findEqualTwo(100, 90);
065:
066: }
067:
068: public void testIllegalState_2() throws Exception {
069: Simple e = getHome().create("pk100000", 20, 6);
070: try {
071: e = getHome().findByName("pk100000");
072: } finally {
073: // cleaning
074: e.remove();
075: }
076: }
077:
078: /**
079: * This suite is all BMP test cases
080: */
081: public static Test suite() {
082: return new TestSuite(F_BasicHomeInterfaceEB.class);
083: }
084:
085: public static void main(String args[]) throws Exception {
086: String testtorun = null;
087: // Get args
088: for (int argn = 0; argn < args.length; argn++) {
089: String s_arg = args[argn];
090: Integer i_arg;
091: if (s_arg.equals("-n")) {
092: testtorun = args[++argn];
093: }
094: }
095: if (testtorun == null) {
096: junit.textui.TestRunner.run(suite());
097: } else {
098:
099: junit.textui.TestRunner.run(new F_BasicHomeInterfaceEB(
100: testtorun));
101:
102: }
103: }
104: }
|