| 1 |
/* |
| 2 |
* Copyright 2002-2004 The Apache Software Foundation. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
package test.typedesc; |
| 17 |
|
| 18 |
import java.util.ArrayList; |
| 19 |
import java.util.Locale; |
| 20 |
|
| 21 |
import javax.wsdl.Definition; |
| 22 |
import javax.wsdl.factory.WSDLFactory; |
| 23 |
|
| 24 |
import org.apache.axis.description.JavaServiceDesc; |
| 25 |
import org.apache.axis.description.ServiceDesc; |
| 26 |
import org.apache.axis.encoding.DefaultTypeMappingImpl; |
| 27 |
import org.apache.axis.encoding.TypeMapping; |
| 28 |
import org.apache.axis.wsdl.fromJava.Namespaces; |
| 29 |
import org.apache.axis.wsdl.fromJava.Types; |
| 30 |
|
| 31 |
import junit.framework.TestCase; |
| 32 |
|
| 33 |
public class TestTypesNonBeanCompatible extends TestCase { |
| 34 |
|
| 35 |
private Types types; |
| 36 |
|
| 37 |
protected void setUp() throws Exception { |
| 38 |
|
| 39 |
Definition def = WSDLFactory.newInstance().newDefinition(); |
| 40 |
TypeMapping tm = DefaultTypeMappingImpl.getSingletonDelegate(); |
| 41 |
Namespaces namespaces = new Namespaces(); |
| 42 |
ServiceDesc serviceDesc = new JavaServiceDesc(); |
| 43 |
|
| 44 |
types = new Types(def, tm, tm, namespaces, "any:name.space", new ArrayList(), serviceDesc); |
| 45 |
} |
| 46 |
|
| 47 |
/* |
| 48 |
Commented out for now because the suggested patch breaks Object arrays |
| 49 |
|
| 50 |
// Tests for Axis-1720 - http://nagoya.apache.org/jira/browse/AXIS-1720 |
| 51 |
public void testWriteTypeNonBeanCompatibleOnce() throws Exception { |
| 52 |
|
| 53 |
String schema = types.writeType(Locale.class); |
| 54 |
assertEquals("Schema should be null for non-bean-compatible types", null, schema); |
| 55 |
} |
| 56 |
|
| 57 |
public void testWriteTypeNonBeanCompatibleTwice() throws Exception { |
| 58 |
|
| 59 |
String schema = types.writeType(Locale.class); |
| 60 |
assertEquals("Schema should be null for non-bean-compatible types", null, schema); |
| 61 |
|
| 62 |
schema = types.writeType(Locale.class); |
| 63 |
assertEquals("Schema should be null for non-bean-compatible types", null, schema); |
| 64 |
} |
| 65 |
|
| 66 |
public void testWriteTypeNonBeanCompatibleDifferent() throws Exception { |
| 67 |
|
| 68 |
String schema = types.writeType(Locale.class); |
| 69 |
assertEquals("Schema should be null for non-bean-compatible types", null, schema); |
| 70 |
|
| 71 |
schema = types.writeType(Locale.class); |
| 72 |
assertEquals("Schema should be null for non-bean-compatible types", null, schema); |
| 73 |
} |
| 74 |
*/ |
| 75 |
|
| 76 |
public void testWriteObjectType() throws Exception { |
| 77 |
|
| 78 |
String schema = types.writeType(Object.class); |
| 79 |
assertNotNull("Schema should NOT be null for Object class", schema); |
| 80 |
|
| 81 |
schema = types.writeType(Object[].class); |
| 82 |
assertNotNull("Schema should NOT be be null for Object[] class", schema); |
| 83 |
} |
| 84 |
|
| 85 |
} |