1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.spring.remoting;
12
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertNotNull;
15
16 import java.util.Arrays;
17 import java.util.Collection;
18
19 import org.junit.Test;
20 import org.junit.runners.Parameterized.Parameters;
21 import org.mule.tck.AbstractServiceAndFlowTestCase;
22 import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
23
24 public class SpringRemotingTestCase extends AbstractServiceAndFlowTestCase
25 {
26 private static final String SPRING_HTTP_ENDPOINT = "http://localhost:8003/springService";
27
28 public SpringRemotingTestCase(ConfigVariant variant, String configResources)
29 {
30 super(variant, configResources);
31 }
32
33 @Parameters
34 public static Collection<Object[]> parameters()
35 {
36 return Arrays.asList(new Object[][]{
37 {ConfigVariant.SERVICE, "spring-remoting-mule-config-service.xml"},
38 {ConfigVariant.FLOW, "spring-remoting-mule-config-flow.xml"}
39 });
40 }
41
42 @Test
43 public void testHttpInvokeSpringService() throws Exception
44 {
45 ComplexData cd = new ComplexData("Foo", new Integer(13));
46 HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean();
47 invoker.setServiceInterface(WorkInterface.class);
48 invoker.setServiceUrl(SPRING_HTTP_ENDPOINT);
49 invoker.afterPropertiesSet();
50 WorkInterface worker = (WorkInterface)invoker.getObject();
51 ComplexData data = worker.executeComplexity(cd);
52 assertNotNull(data);
53 assertEquals(data.getSomeString(), "Foo Received");
54 assertEquals(data.getSomeInteger(), new Integer(14));
55 }
56 }