You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Glen Daniels <gl...@thoughtcraft.com> on 2005/02/18 14:46:23 UTC
Re: cvs commit: ws-axis/java/test/encoding TestDefaultTM.java
PackageTests.java
Thanks for the catch, Jongjin! Dims already got around to fixing it. :)
--G
Jongjin Choi wrote:
> Glen,
>
> I think the TestDefaultTM.java's package should be 'test.encoding' instead of'encoding'
>
> /Jongjin
>
> ----- Original Message -----
> From: <gd...@apache.org>
> To: <ws...@apache.org>
> Sent: Friday, February 18, 2005 5:05 AM
> Subject: cvs commit: ws-axis/java/test/encoding TestDefaultTM.java PackageTests.java
>
>
>
>>gdaniels 2005/02/17 12:05:06
>>
>> Modified: java/src/org/apache/axis/encoding
>> DefaultJAXRPC11TypeMappingImpl.java
>> TypeMappingRegistryImpl.java
>> java/test/encoding PackageTests.java
>> Added: java/test/encoding TestDefaultTM.java
>> Log:
>> Fix up type mappings.
>>
>> The DefaultJAXRPC11TypeMappingImpl shouldn't have extended
>> DefaultSOAPEncodedTMI, because that means that SOAP encoded
>> types would be polluting the default typemapping. According to
>> JAX-RPC (and common sense) the default TM is not supposed to have
>> any encodingStyle-specific types in it.
>>
>> JAXRPC type mapping now extends the normal type mapping, is
>> correctly registered as the defaultDelTM when using "1.3" as the
>> TypeMappingVersion (yuk), and there's a new test to check to make
>> sure SOAPENC_STRING is *not* mapped for the default TM no
>> matter which TMV we select.
>>
>> Revision Changes Path
>> 1.10 +1 -1 ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java
>>
>> Index: DefaultJAXRPC11TypeMappingImpl.java
>> ===================================================================
>> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/DefaultJAXRPC11TypeMappingImpl.java,v
>> retrieving revision 1.9
>> retrieving revision 1.10
>> diff -u -r1.9 -r1.10
>> --- DefaultJAXRPC11TypeMappingImpl.java 12 Feb 2005 04:41:20 -0000 1.9
>> +++ DefaultJAXRPC11TypeMappingImpl.java 17 Feb 2005 20:05:05 -0000 1.10
>> @@ -29,7 +29,7 @@
>> * This is the implementation of the axis Default JAX-RPC SOAP Encoding TypeMapping
>> * See DefaultTypeMapping for more information.
>> */
>> -public class DefaultJAXRPC11TypeMappingImpl extends DefaultSOAPEncodingTypeMappingImpl {
>> +public class DefaultJAXRPC11TypeMappingImpl extends DefaultTypeMappingImpl {
>>
>> private static DefaultJAXRPC11TypeMappingImpl tm = null;
>>
>>
>>
>>
>> 1.33 +30 -24 ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
>>
>> Index: TypeMappingRegistryImpl.java
>> ===================================================================
>> RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
>> retrieving revision 1.32
>> retrieving revision 1.33
>> diff -u -r1.32 -r1.33
>> --- TypeMappingRegistryImpl.java 17 Feb 2005 15:34:02 -0000 1.32
>> +++ TypeMappingRegistryImpl.java 17 Feb 2005 20:05:05 -0000 1.33
>> @@ -247,39 +247,44 @@
>> * if an invalid type mapping is specified or the delegate is already set
>> */
>> public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {
>> -// if (mapping == null ||
>> -// !(mapping instanceof TypeMapping)) {
>> -// throw new IllegalArgumentException(
>> -// Messages.getMessage("badTypeMapping"));
>> -// }
>> -//
>> -// /* Don't allow this call after the delegate() method since
>> -// * the TMR's TypeMappings will be using the default type mapping
>> -// * of the secondary TMR.
>> -// */
>> -// if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
>> -// throw new IllegalArgumentException(
>> -// Messages.getMessage("defaultTypeMappingSet"));
>> -// }
>> -//
>> -// defaultDelTM.setDelegate((TypeMapping) mapping);
>> + if (mapping == null ||
>> + !(mapping instanceof TypeMapping)) {
>> + throw new IllegalArgumentException(
>> + Messages.getMessage("badTypeMapping"));
>> + }
>> +
>> + /* Don't allow this call after the delegate() method since
>> + * the TMR's TypeMappings will be using the default type mapping
>> + * of the secondary TMR.
>> + */
>> + if (defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
>> + throw new IllegalArgumentException(
>> + Messages.getMessage("defaultTypeMappingSet"));
>> + }
>> +
>> + defaultDelTM.setDelegate((TypeMapping) mapping);
>> }
>>
>> + /**
>> + * Set up the default type mapping (and the SOAP encoding type mappings)
>> + * as per the passed "version" option.
>> + *
>> + * @param version
>> + */
>> public void doRegisterFromVersion(String version) {
>> - TypeMapping tm;
>> - if (version == null || version.equals("1.0")) {
>> - tm = DefaultSOAPEncodingTypeMappingImpl.getSingleton();
>> + if (version == null || version.equals("1.0") || version.equals("1.2")) {
>> + // Do nothing, just register SOAPENC mapping
>> } else if (version.equals("1.1")) {
>> + // Do nothing, no SOAPENC mapping
>> return;
>> - } else if (version.equals("1.2")) {
>> - tm = DefaultSOAPEncodingTypeMappingImpl.create();
>> } else if (version.equals("1.3")) {
>> - tm = DefaultJAXRPC11TypeMappingImpl.create();
>> + // Reset the default TM to the JAXRPC version, then register SOAPENC
>> + TypeMapping tm = DefaultJAXRPC11TypeMappingImpl.create();
>> + defaultDelTM = new TypeMappingDelegate(tm);
>> } else {
>> throw new RuntimeException(org.apache.axis.utils.Messages.getMessage("j2wBadTypeMapping00"));
>> }
>> - registerSOAPENCDefault(tm);
>> - defaultDelTM = new TypeMappingDelegate(tm);
>> + registerSOAPENCDefault(DefaultSOAPEncodingTypeMappingImpl.getSingleton());
>> }
>> /**
>> * Force registration of the given mapping as the SOAPENC default mapping
>> @@ -288,6 +293,7 @@
>> private void registerSOAPENCDefault(TypeMapping mapping) {
>> registerForced(Constants.URI_SOAP11_ENC, mapping);
>> registerForced(Constants.URI_SOAP12_ENC, mapping);
>> + mapping.setDelegate(defaultDelTM);
>> }
>>
>> /**
>>
>>
>>
>> 1.32 +1 -0 ws-axis/java/test/encoding/PackageTests.java
>>
>> Index: PackageTests.java
>> ===================================================================
>> RCS file: /home/cvs/ws-axis/java/test/encoding/PackageTests.java,v
>> retrieving revision 1.31
>> retrieving revision 1.32
>> diff -u -r1.31 -r1.32
>> --- PackageTests.java 26 Apr 2004 11:51:43 -0000 1.31
>> +++ PackageTests.java 17 Feb 2005 20:05:06 -0000 1.32
>> @@ -44,6 +44,7 @@
>> suite.addTestSuite(TestCircularRefs.class);
>> suite.addTestSuite(TestAutoTypes.class);
>> suite.addTestSuite(EncodingTest.class);
>> + suite.addTestSuite(TestDefaultTM.class);
>> return suite;
>> }
>> }
>>
>>
>>
>> 1.1 ws-axis/java/test/encoding/TestDefaultTM.java
>>
>> Index: TestDefaultTM.java
>> ===================================================================
>> /*
>> * Copyright 2002-2004 The Apache Software Foundation.
>> *
>> * Licensed under the Apache License, Version 2.0 (the "License");
>> * you may not use this file except in compliance with the License.
>> * You may obtain a copy of the License at
>> *
>> * http://www.apache.org/licenses/LICENSE-2.0
>> *
>> * Unless required by applicable law or agreed to in writing, software
>> * distributed under the License is distributed on an "AS IS" BASIS,
>> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>> * See the License for the specific language governing permissions and
>> * limitations under the License.
>> */
>>
>> package encoding;
>>
>> import junit.framework.TestCase;
>> import org.apache.axis.encoding.TypeMappingRegistryImpl;
>> import org.apache.axis.Constants;
>>
>> import javax.xml.rpc.encoding.TypeMapping;
>>
>> /**
>> * Default Type Mapping tests
>> */
>> public class TestDefaultTM extends TestCase {
>> /**
>> * This test makes sure that there aren't any SOAPENC types
>> * mapped in the default type mappings for any of the valid
>> * "version" strings.
>> *
>> * @throws Exception
>> */
>> public void testNoSOAPENCTypes() throws Exception {
>> checkTypes(null);
>> checkTypes("1.0");
>> checkTypes("1.1");
>> checkTypes("1.2");
>> checkTypes("1.3");
>> }
>>
>> private void checkTypes(String version) throws Exception {
>> TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
>> tmr.doRegisterFromVersion(version);
>> TypeMapping tm = tmr.getDefaultTypeMapping();
>> assertNull("Found mapping for soapenc:string in TM version " + version,
>> tm.getDeserializer(null, Constants.SOAP_STRING));
>> }
>> }
>>
>>
>>
>
>>