1   /*
2    * $Id: ClientTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.cxf.jaxws;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  import java.util.HashMap;
18  import java.util.Map;
19  
20  import org.apache.hello_world_soap_http.GreeterImpl;
21  
22  public class ClientTestCase extends FunctionalTestCase
23  {
24      public void testGeneratedClientWithQuartz() throws Exception
25      {
26          GreeterImpl impl = getGreeter();
27          
28          Thread.sleep(3000);
29          
30          assertEquals(1, impl.getInvocationCount());
31      }
32  
33      private GreeterImpl getGreeter() throws Exception
34      {
35          Object instance = getComponent("greeterService");
36          
37          return (GreeterImpl) instance;
38      }
39  
40      public void testClientWithMuleClient() throws Exception
41      {
42          MuleClient client = new MuleClient();
43          Map<String, Object> props = new HashMap<String, Object>();
44          props.put("operation", "greetMe");
45          MuleMessage result = client.send("clientEndpoint", "Dan", props);
46          assertEquals("Hello Dan", result.getPayload());
47          
48          GreeterImpl impl = getGreeter();
49          
50          Thread.sleep(3000);
51          
52          assertEquals(2, impl.getInvocationCount());
53      }
54      
55      protected String getConfigResources()
56      {
57          return "jaxws-client-conf.xml";
58      }
59  
60  }