| 1 |
package test.encoding; |
| 2 |
|
| 3 |
import javax.xml.namespace.QName; |
| 4 |
|
| 5 |
import junit.framework.TestCase; |
| 6 |
|
| 7 |
import org.apache.axis.encoding.TypeMappingRegistry; |
| 8 |
import org.apache.axis.encoding.TypeMappingDelegate; |
| 9 |
import org.apache.axis.server.AxisServer; |
| 10 |
import org.apache.axis.wsdl.fromJava.Namespaces; |
| 11 |
import org.apache.axis.wsdl.fromJava.Types; |
| 12 |
|
| 13 |
/** |
| 14 |
* Test auto-typing. |
| 15 |
*/ |
| 16 |
public class TestAutoTypes extends TestCase { |
| 17 |
|
| 18 |
private AxisServer server = new AxisServer(); |
| 19 |
|
| 20 |
public TestAutoTypes(String name) { |
| 21 |
super(name); |
| 22 |
} |
| 23 |
|
| 24 |
public void testAutoTypes() throws Exception |
| 25 |
{ |
| 26 |
TypeMappingRegistry tmr = server.getTypeMappingRegistry(); |
| 27 |
TypeMappingDelegate tm = (TypeMappingDelegate)tmr.getDefaultTypeMapping(); |
| 28 |
tm.setDoAutoTypes(true); |
| 29 |
|
| 30 |
QName qname = tm.getTypeQName( AttributeBean.class ); |
| 31 |
assertEquals( "http://encoding.test", |
| 32 |
qname.getNamespaceURI() ); |
| 33 |
assertEquals( "AttributeBean", qname.getLocalPart() ); |
| 34 |
|
| 35 |
assertTrue( tm.getDeserializer(qname) != null ); |
| 36 |
assertTrue( tm.getSerializer(AttributeBean.class) != null ); |
| 37 |
|
| 38 |
assertEquals( |
| 39 |
"http://encoding.test", |
| 40 |
Namespaces.makeNamespace(AttributeBean[].class.getName())); |
| 41 |
assertEquals( |
| 42 |
"AttributeBean[]", |
| 43 |
Types.getLocalNameFromFullName(AttributeBean[].class.getName())); |
| 44 |
|
| 45 |
// qname = tm.getTypeQName( AttributeBean[].class ); |
| 46 |
// assertEquals( "http://encoding.test", |
| 47 |
// qname.getNamespaceURI() ); |
| 48 |
// assertEquals( "AttributeBean[]", qname.getLocalPart() ); |
| 49 |
|
| 50 |
} |
| 51 |
} |