1   /*
2    * $Id: SpringRemotingTestCase.java 7963 2007-08-21 08:53:15Z 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.extras.spring.remoting;
12  
13  import org.mule.tck.FunctionalTestCase;
14  
15  import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
16  
17  public class SpringRemotingTestCase extends FunctionalTestCase
18  {
19      private static final String SPRING_HTTP_ENDPOINT = "http://localhost:8003/springService";
20  
21      protected String getConfigResources()
22      {
23          return "spring-remoting-mule-config.xml";
24      }
25  
26      public void testHttpInvokeSpringService() throws Exception
27      {
28          ComplexData cd = new ComplexData("Foo", new Integer(13));
29          HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean();
30          invoker.setServiceInterface(WorkInterface.class);
31          invoker.setServiceUrl(SPRING_HTTP_ENDPOINT);
32          invoker.afterPropertiesSet();
33          WorkInterface worker = (WorkInterface)invoker.getObject();
34          ComplexData data = worker.executeComplexity(cd);
35          assertNotNull(data);
36          assertEquals(data.getSomeString(), "Foo Received");
37          assertEquals(data.getSomeInteger(), new Integer(14));
38      }
39  }