View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.cxf.employee;
8   
9   import org.mule.tck.junit4.FunctionalTestCase;
10  import org.mule.tck.junit4.rule.DynamicPort;
11  
12  import org.junit.Rule;
13  import org.junit.Test;
14  
15  import static org.junit.Assert.assertEquals;
16  import static org.junit.Assert.assertTrue;
17  
18  public class MtomClientTestCase extends FunctionalTestCase
19  {
20  
21      @Rule
22      public DynamicPort dynamicPort = new DynamicPort("port1");
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "mtom-client-conf.xml";
28      }
29  
30      @Test
31      public void testEchoService() throws Exception
32      {
33          EmployeeDirectoryImpl svc = (EmployeeDirectoryImpl) getComponent("employeeDirectoryService");
34  
35          int count = 0;
36          while (svc.getInvocationCount() == 0 && count < 5000) {
37              count += 500;
38              Thread.sleep(500);
39          }
40  
41          assertEquals(1, svc.getInvocationCount());
42  
43          // ensure that an attachment was actually sent.
44          assertTrue(AttachmentVerifyInterceptor.HasAttachments);
45      }
46  
47  }
48