KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > ws > jaxws > webserviceref > WebServiceRefClientTestCase


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2006, Red Hat Middleware LLC, and individual contributors
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.test.ws.jaxws.webserviceref;
23
24 import java.io.File JavaDoc;
25 import java.net.MalformedURLException JavaDoc;
26 import java.net.URL JavaDoc;
27
28 import javax.xml.namespace.QName JavaDoc;
29 import javax.xml.ws.Service;
30
31 import junit.framework.Test;
32
33 import org.jboss.test.ws.JBossWSTest;
34 import org.jboss.test.ws.JBossWSTestSetup;
35 import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
36 import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
37
38 /**
39  * Test the JAXWS annotation: javax.xml.ws.WebServiceref
40  *
41  * @author Thomas.Diesler@jboss.com
42  * @since 23-Oct-2005
43  */

44 public class WebServiceRefClientTestCase extends JBossWSTest
45 {
46    public final String JavaDoc TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-webserviceref";
47    
48    public static Test suite()
49    {
50       return JBossWSTestSetup.newTestSetup(WebServiceRefClientTestCase.class, "jaxws-webserviceref.war, jaxws-webserviceref-client.jar");
51    }
52
53    public void testWSDLAccess() throws MalformedURLException JavaDoc
54    {
55       URL JavaDoc wsdlURL = new URL JavaDoc(TARGET_ENDPOINT_ADDRESS + "?wsdl");
56       WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
57       WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
58       assertNotNull(wsdlDefinitions);
59    }
60    
61    public void testDynamicProxy() throws Exception JavaDoc
62    {
63       URL JavaDoc wsdlURL = getResource("ws/jaxws/webserviceref/META-INF/wsdl/TestEndpoint.wsdl");
64       QName JavaDoc qname = new QName JavaDoc("http://org.jboss.ws/wsref", "TestEndpointService");
65       Service service = Service.create(wsdlURL, qname);
66       TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
67
68       String JavaDoc helloWorld = "Hello World!";
69       Object JavaDoc retObj = port.echo(helloWorld);
70       assertEquals(helloWorld, retObj);
71    }
72
73    public void testApplicationClient() throws Exception JavaDoc
74    {
75       String JavaDoc helloWorld = "Hello World!";
76       ApplicationClient.iniCtx = getInitialContext();
77       //ClientLauncher.launch(ApplicationClient.class.getName(), "jbossws-client", new String[]{helloWorld});
78
//assertEquals(helloWorld, ApplicationClient.retStr);
79
}
80 }
81
Popular Tags