KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > clients > service > F_AgnosticServiceUsage


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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,v 1.4 2004/09/09 16:17:21 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.service;
27
28 import javax.rmi.PortableRemoteObject JavaDoc;
29
30 import junit.framework.Test;
31 import junit.framework.TestSuite;
32
33 import org.objectweb.jonas.jtests.beans.wsclient.WsClient1;
34 import org.objectweb.jonas.jtests.beans.wsclient.WsClient1Home;
35
36 /**
37  * test case for web service usage (client side)
38  */

39 public class F_AgnosticServiceUsage extends A_ServiceUsage {
40
41     protected static final String JavaDoc BEAN_HOME = "WsClient1Home";
42     protected WsClient1Home home = null;
43
44     public F_AgnosticServiceUsage(String JavaDoc name) {
45         super(name);
46     }
47     
48     public static Test suite() {
49         return new TestSuite(F_AgnosticServiceUsage.class);
50     }
51
52     public void setUp() throws Exception JavaDoc {
53         super.setUp();
54     }
55
56     public void tearDown() throws Exception JavaDoc {
57         super.tearDown();
58     }
59
60     protected WsClient1Home getHome() throws Exception JavaDoc {
61         if (home == null) {
62             home = (WsClient1Home) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME),WsClient1Home.class) ;
63         }
64         assertTrue(home != null);
65         return home;
66     }
67
68     public void testJNDILookupWithJNDIName() throws Exception JavaDoc {
69         WsClient1 wsc = getHome().create();
70         assertFalse("lookup with jndi name must fail", wsc.lookupServiceJNDI());
71         wsc.remove();
72     }
73
74     public void testJNDILookupWithServiceRefName() throws Exception JavaDoc {
75         WsClient1 wsc = getHome().create();
76         assertTrue("lookup with service-ref-name fail", wsc.lookupServiceName());
77         wsc.remove();
78     }
79
80     public static void main (String JavaDoc args[]) {
81         String JavaDoc testtorun = null;
82         // Get args
83
for (int argn = 0; argn < args.length; argn++) {
84             String JavaDoc s_arg = args[argn];
85             if (s_arg.equals("-n")) {
86                 testtorun = args[++argn];
87             }
88         }
89         if (testtorun == null) {
90             junit.textui.TestRunner.run(suite());
91         } else {
92             junit.textui.TestRunner.run(new F_AgnosticServiceUsage(testtorun));
93         }
94     }
95
96 }
97
Popular Tags