1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.cxf.employee;
12
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertTrue;
15
16 import org.mule.tck.AbstractServiceAndFlowTestCase;
17 import org.mule.tck.junit4.rule.DynamicPort;
18
19 import java.util.Arrays;
20 import java.util.Collection;
21
22 import org.junit.Rule;
23 import org.junit.Test;
24 import org.junit.runners.Parameterized.Parameters;
25
26 public class MtomClientTestCase extends AbstractServiceAndFlowTestCase
27 {
28 @Rule
29 public DynamicPort dynamicPort = new DynamicPort("port1");
30
31 public MtomClientTestCase(ConfigVariant variant, String configResources)
32 {
33 super(variant, configResources);
34 }
35
36 @Parameters
37 public static Collection<Object[]> parameters()
38 {
39 return Arrays.asList(new Object[][]{
40 {ConfigVariant.SERVICE, "mtom-client-conf-service.xml"},
41 {ConfigVariant.FLOW, "mtom-client-conf-flow.xml"}
42 });
43 }
44
45 @Test
46 public void testEchoService() throws Exception
47 {
48 EmployeeDirectoryImpl svc = (EmployeeDirectoryImpl) getComponent("employeeDirectoryService");
49
50 int count = 0;
51 while (svc.getInvocationCount() == 0 && count < 5000) {
52 count += 500;
53 Thread.sleep(500);
54 }
55
56 assertEquals(1, svc.getInvocationCount());
57
58
59 assertTrue(AttachmentVerifyInterceptor.HasAttachments);
60 }
61
62 }
63