KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > appfuse > service > EchoWebServiceTest


1 package org.appfuse.service;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.codehaus.xfire.spring.AbstractXFireSpringTest;
6 import org.jdom.Document;
7 import org.springframework.context.ApplicationContext;
8 import org.springframework.context.support.ClassPathXmlApplicationContext;
9
10 public class EchoWebServiceTest extends AbstractXFireSpringTest {
11
12     protected final Log log = LogFactory.getLog(getClass());
13
14     public void setUp() throws Exception JavaDoc {
15         super.setUp();
16     }
17     
18     public void testGetWsdl() throws Exception JavaDoc {
19         Document doc = getWSDLDocument("Echo");
20         //printNode(doc);
21

22         assertValid("//xsd:element[@name=\"echo\"]", doc);
23         assertValid("//xsd:element[@name=\"echoResponse\"]", doc);
24     }
25     
26     public void testCallEcho() throws Exception JavaDoc {
27         Document response =
28             invokeService("Echo", "/org/appfuse/service/echo.xml");
29         //printNode(response);
30

31         addNamespace("service","http://test.xfire.codehaus.org");
32         assertValid("//service:echoResponse/service:out[text()=\"Hello world!\"]",response);
33
34
35     }
36
37     protected ApplicationContext createContext() {
38         return new ClassPathXmlApplicationContext(new String JavaDoc[]{
39                 "org/appfuse/service/applicationContext-test.xml",
40                 "org/appfuse/service/applicationContext-webservice.xml"});
41     }
42     
43
44 }
45
Popular Tags