01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: F_AgnosticServiceUsage.java 5402 2004-09-09 16:17:21Z sauthieg $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.jtests.clients.service;
25:
26: import javax.rmi.PortableRemoteObject;
27:
28: import junit.framework.Test;
29: import junit.framework.TestSuite;
30:
31: import org.objectweb.jonas.jtests.beans.wsclient.WsClient1;
32: import org.objectweb.jonas.jtests.beans.wsclient.WsClient1Home;
33:
34: /**
35: * test case for web service usage (client side)
36: */
37: public class F_AgnosticServiceUsage extends A_ServiceUsage {
38:
39: protected static final String BEAN_HOME = "WsClient1Home";
40: protected WsClient1Home home = null;
41:
42: public F_AgnosticServiceUsage(String name) {
43: super (name);
44: }
45:
46: public static Test suite() {
47: return new TestSuite(F_AgnosticServiceUsage.class);
48: }
49:
50: public void setUp() throws Exception {
51: super .setUp();
52: }
53:
54: public void tearDown() throws Exception {
55: super .tearDown();
56: }
57:
58: protected WsClient1Home getHome() throws Exception {
59: if (home == null) {
60: home = (WsClient1Home) PortableRemoteObject.narrow(ictx
61: .lookup(BEAN_HOME), WsClient1Home.class);
62: }
63: assertTrue(home != null);
64: return home;
65: }
66:
67: public void testJNDILookupWithJNDIName() throws Exception {
68: WsClient1 wsc = getHome().create();
69: assertFalse("lookup with jndi name must fail", wsc
70: .lookupServiceJNDI());
71: wsc.remove();
72: }
73:
74: public void testJNDILookupWithServiceRefName() throws Exception {
75: WsClient1 wsc = getHome().create();
76: assertTrue("lookup with service-ref-name fail", wsc
77: .lookupServiceName());
78: wsc.remove();
79: }
80:
81: public static void main(String args[]) {
82: String testtorun = null;
83: // Get args
84: for (int argn = 0; argn < args.length; argn++) {
85: String s_arg = args[argn];
86: if (s_arg.equals("-n")) {
87: testtorun = args[++argn];
88: }
89: }
90: if (testtorun == null) {
91: junit.textui.TestRunner.run(suite());
92: } else {
93: junit.textui.TestRunner.run(new F_AgnosticServiceUsage(
94: testtorun));
95: }
96: }
97:
98: }
|