1   package org.seasar.remoting.axis.connector;
2   
3   import java.lang.reflect.Field;
4   
5   import javax.xml.rpc.encoding.TypeMapping;
6   
7   import junit.framework.TestCase;
8   
9   import org.apache.axis.client.Service;
10  import org.apache.axis.constants.Use;
11  import org.apache.axis.encoding.TypeMappingDelegate;
12  import org.apache.axis.encoding.TypeMappingImpl;
13  
14  /***
15   * @author koichik
16   */
17  public class AxisConnectorTest extends TestCase {
18      public AxisConnectorTest() {
19      }
20  
21      public AxisConnectorTest(String name) {
22          super(name);
23      }
24  
25      public void testSetService() throws Exception {
26          Service service = new Service();
27  
28          AxisConnector connector = new AxisConnector();
29          connector.setService(service);
30  
31          TypeMapping delegate = service.getTypeMappingRegistry().getTypeMapping(
32                  Use.DEFAULT.getEncoding());
33          assertTrue("1", delegate instanceof TypeMappingDelegate);
34  
35          Field f = TypeMappingDelegate.class.getDeclaredField("delegate");
36          f.setAccessible(true);
37          Object tm = f.get(delegate);
38          assertTrue("2", tm instanceof TypeMappingImpl);
39  
40          f = TypeMappingImpl.class.getDeclaredField("doAutoTypes");
41          f.setAccessible(true);
42          Boolean doAtuoTypes = (Boolean) f.get(tm);
43          assertTrue("3", doAtuoTypes.booleanValue());
44      }
45  }