KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jbossnet > external > ExternalUnitTestCase


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 // $Id: ExternalUnitTestCase.java,v 1.1.1.1.6.4 2004/12/01 15:41:52 tdiesler Exp $
9

10 package org.jboss.test.jbossnet.external;
11
12 import junit.framework.Test;
13 import org.jboss.test.jbossnet.JBossNetTestBase;
14
15 import javax.xml.namespace.QName JavaDoc;
16 import java.net.URL JavaDoc;
17
18 /**
19  * tests connectivity to external, global web services.
20  * @author cgjung
21  * @author Thomas.Diesler@jboss.org
22  * @since 10.2002
23  */

24 public class ExternalUnitTestCase extends JBossNetTestBase
25 {
26    private QName JavaDoc FEDERATED_SERVICE = new QName JavaDoc("http://" + getServerHost() + ":8080/jboss-net/services/FederatedService", "FederatedServiceLocalService");
27
28    // Constructors --------------------------------------------------
29
public ExternalUnitTestCase(String JavaDoc name)
30    {
31       super(name);
32    }
33
34    /** the session bean with which we interact */
35    FederatedService federation;
36
37    /** setup the bean */
38    public void setUp() throws Exception JavaDoc
39    {
40       super.setUp();
41       URL JavaDoc wsdlURL = new URL JavaDoc(SERVICES_LOCATION + "/FederatedService?wsdl");
42       federation = (FederatedService)createService(wsdlURL, FEDERATED_SERVICE).getPort(FederatedService.class);
43    }
44
45    /** test a federated call */
46    public void testFederated() throws Exception JavaDoc
47    {
48       String JavaDoc result = federation.findAndTranslate("JBoss is a killer server and Mr. Fleury is a damned genius");
49       assertNotNull("Result is null", result);
50       System.out.println("Result: " + result);
51       String JavaDoc shittimes = "This service is currently disabled.";
52       assertTrue(result, result.indexOf("JBoss") >= 0 || shittimes.equals(result));
53    }
54
55    /** where the config is stored */
56    protected String JavaDoc getAxisConfiguration()
57    {
58       return "jbossnet/external/client/client-config.wsdd";
59    }
60
61    /** this is to deploy the whole ear */
62    public static Test suite() throws Exception JavaDoc
63    {
64       return getDeploySetup(ExternalUnitTestCase.class, "jbossnet-external.ear");
65    }
66
67    public static void main(String JavaDoc[] args)
68    {
69       junit.textui.TestRunner.run(ExternalUnitTestCase.class);
70    }
71 }
72
Popular Tags