User: jung    
  Date: 00/12/04 04:36:46

  Modified:    src/org/zoap/xml/test Xml.java test.dfPackage
  Log:
  adopted to latest jboss container,
  
  added decimal and date
  
  removed some problems due to forward-referencing in meta-data
  
  added serialisation policy
  
  Revision  Changes    Path
  1.2       +1063 -952 zoap/src/org/zoap/xml/test/Xml.java
  
  Index: Xml.java
  ===================================================================
  RCS file: /products/cvs/ejboss/zoap/src/org/zoap/xml/test/Xml.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Xml.java  2000/08/10 21:08:16     1.1
  +++ Xml.java  2000/12/04 12:36:45     1.2
  @@ -1,955 +1,1072 @@
  -/*
  - *   $Id: Xml.java,v 1.1 2000/08/10 21:08:16 jung Exp $
  - *   Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
  - *   D-66299 Friedrichsthal, Germany. All Rights Reserved.
  - *
  - *   License Statement
  - *
  - *   Redistribution and use of this software and associated documentation 
("Software"), with or without
  - *   modification, are permitted provided that the following conditions are met:
  - *
  - *   1.      Redistributions of source code must retain copyright statements and 
notices.
  - *           Redistributions must also contain a copy of this document.
  - *
  - *   2.      Redistributions in binary form must reproduce the attached copyright 
notice, this list of
  - *           conditions and the following disclaimer in the documentation and/or 
other materials provided
  - *           with the distribution.
  - *
  - *   3.      The end-user documentation included with the redistribution, if any, 
must include the following
  - *           acknowledgment: "This product includes software developed by infor: 
business solutions AG
  - *           (http://www.infor.de/)." Alternately, this acknowledgment may appear 
in the software itself,
  - *           if and wherever such third-party acknowledgments normally appear.
  - *
  - *   4.      The name "infor" must not be used to endorse or promote products 
derived from this
  - *           Software without prior written permission of infor: business solutions 
AG.
  - *           For written permission, please contact [EMAIL PROTECTED]
  - *
  - *   5.      Products derived from this Software may not be called "infor" nor may 
"infor" appear
  - *           in their names without prior written permission of infor: business 
solutions AG. infor
  - *           is a registered trademark of infor:business solutions AG.
  - *
  - *   Disclaimer
  - *
  - *   THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS 
IS" AND ANY
  - *   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF
  - *   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  - *
  - *   IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT,
  - *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO,
  - *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
BUSINESS INTERRUPTION)
  - *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT
  - *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE,
  - *   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  - */
  -
  -package org.zoap.xml.test;
  -
  -import org.zoap.xml.XmlObjectWriter;
  -import org.zoap.xml.XmlObjectReader;
  -import org.zoap.xml.Schema;
  -import org.zoap.xml.Type;
  -import org.zoap.xml.Attribute;
  -import org.zoap.xml.Element;
  -import org.zoap.xml.XmlException;
  -import org.zoap.xml.URNResolver;
  -import org.zoap.xml.Binding;
  -
  -import org.zoap.xml.meta.BooleanType;
  -import org.zoap.xml.meta.ByteType;
  -import org.zoap.xml.meta.builtin.CharacterType;
  -import org.zoap.xml.meta.IntegerType;
  -import org.zoap.xml.meta.LongType;
  -import org.zoap.xml.meta.ShortType;
  -import org.zoap.xml.meta.FloatType;
  -import org.zoap.xml.meta.DoubleType;
  -
  -import org.zoap.xml.meta.builtin.DefaultBinding;
  -import org.zoap.xml.meta.builtin.DefaultMetaBinding;
  -import org.zoap.xml.meta.builtin.ClassType;
  -import org.zoap.xml.meta.builtin.NameAttribute;
  -import org.zoap.xml.meta.builtin.RefAttribute;
  -import org.zoap.xml.meta.builtin.FieldAttribute;
  -import org.zoap.xml.meta.builtin.FieldElement;
  -import org.zoap.xml.meta.builtin.ClassElement;
  -import org.zoap.xml.meta.builtin.CollectionElement;
  -import org.zoap.xml.meta.builtin.CollectionType;
  -import org.zoap.xml.meta.builtin.ZoapSchema;
  -
  -import java.net.URL;
  -
  -import java.util.Collection;
  -
  -import de.infor.ce.util.URN;
  -
  -import de.infor.businessobjects.test.TestObject;
  -import de.infor.businessobjects.test.TestObject1;
  -import de.infor.businessobjects.test.TestObject2;
  -import de.infor.businessobjects.test.TestObject3;
  -
  -
  -/**
  - *      A unit test for checking low-level features of the XML service
  - *      @see <related>
  - *      @author $Author: jung $
  - *      @version $Revision: 1.1 $
  - */
  -
  -public class Xml extends junit.framework.TestCase {
  -
  -     public Xml(String name) {
  -             super(name);
  -     }
  -
  -     public static void main(String[] args) {
  -
  -             junit.textui.TestRunner runner = new junit.textui.TestRunner();
  -
  -             try {
  -                     runner.run(suite());
  -             } catch (Exception e) {
  -             }
  -     }
  -
  -     public static junit.framework.Test suite() {
  -
  -             return new junit.framework.TestSuite(Xml.class);
  -
  -     }
  -
  -     public void setUp() {
  -     }
  -
  -     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  -
  -     public void testBoolean() throws java.io.IOException, ClassNotFoundException {
  -
  -             java.io.StringWriter stringWriter = new java.io.StringWriter();
  -
  -             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  -
  -             xmlObjectWriter.writeBoolean(true);
  -
  -             java.io.StringReader stringStream =
  -             new java.io.StringReader(stringWriter.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  -
  -             assert("Testing writing and reading of boolean", 
xmlObjectReader.readBoolean() == true);
  -
  -     }
  -
  -     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  -
  -     public void testString() throws java.io.IOException, ClassNotFoundException {
  -
  -             java.io.StringWriter stringWriter = new java.io.StringWriter();
  -
  -             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  -
  -             xmlObjectWriter.writeUTF("42");
  -
  -             java.io.StringReader stringStream =
  -             new java.io.StringReader(stringWriter.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  -
  -             assert("Testing writing and reading of string", 
"42".equals(xmlObjectReader.readUTF()));
  -
  -     }
  -
  -     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  -
  -     public void testByte() throws java.io.IOException, ClassNotFoundException {
  -
  -             java.io.StringWriter stringWriter = new java.io.StringWriter();
  -
  -             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  -
  -             xmlObjectWriter.writeByte((byte)42);
  -
  -             java.io.StringReader stringStream =
  -             new java.io.StringReader(stringWriter.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  -
  -             assert("Testing writing and reading of byte", 42 == 
xmlObjectReader.readByte());
  -
  -     }
  -
  -     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  -
  -     public void testObject() throws java.io.IOException, ClassNotFoundException {
  -
  -             java.io.StringWriter stringWriter = new java.io.StringWriter();
  -
  -             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  -
  -             TestObject2 testObject = new TestObject2();
  -             TestObject3 testObject2 = new TestObject3();
  -
  -             testObject.setTestInherited(true);
  -
  -             testObject.setTestBoolean(true);
  -
  -             testObject.setTestPublic(true);
  -
  -             testObject.setTestProtected(true);
  -
  -             testObject.setTestPrivate(true);
  -
  -             testObject.setTestStatic(true);
  -
  -             testObject.setTestTransient(true);
  -
  -             testObject.setTestByte((byte)42);
  -
  -             testObject.setTestInteger(42);
  -
  -             testObject.setTestShort((short)42);
  -
  -             testObject.setTestCharacter('z');
  -
  -             testObject.setTestLong((long)42);
  -
  -             testObject.setTestFloat((float)42.0);
  -
  -             testObject.setTestDouble((double)42.0);
  -
  -             testObject.setTestString("42");
  -
  -             testObject.setTestReference(testObject2);
  -
  -             testObject.setTestArray(new TestObject3[] { testObject2 });
  -
  -             testObject.setTestCollection(new java.util.Vector());
  -
  -             testObject.getTestCollection().add(testObject2);
  -
  -             testObject.setTestExtension(true);
  -
  -             testObject2.setTestReturn(testObject);
  -
  -             xmlObjectWriter.writeObject(testObject);
  -
  -             // maybe we could add some literal comparison of the stream
  -             // but this would be painful to construct and not
  -             // quite independent of the internal techniques, so we leave it
  -             // for the moment
  -
  -             java.io.StringReader stringStream =
  -             new java.io.StringReader(stringWriter.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  -
  -             TestObject2 testObject3 = (TestObject2)xmlObjectReader.readObject();
  -
  -             assert("Asserting inherited attribute", testObject3.getTestInherited() 
!=
  -             testObject.getTestInherited());
  -
  -             assert("Asserting private attribute", testObject3.isTestPrivate() ==
  -             testObject.isTestPrivate());
  -
  -             assert("Asserting protected attribute", testObject3.isTestProtected() 
==
  -             testObject.isTestProtected());
  -
  -             assert("Asserting public attribute", testObject3.isTestPublic() ==
  -             testObject.isTestPublic());
  -
  -             assert("Asserting static attribute", testObject3.isTestStatic() ==
  -             testObject.isTestStatic());
  -
  -             assert("Asserting transient attribute", testObject3.isTestTransient() 
!=
  -             testObject.isTestTransient());
  -
  -             assert("Asserting boolean attribute", testObject3.isTestBoolean() ==
  -             testObject.isTestBoolean());
  -
  -             assert("Asserting byte attribute", testObject3.getTestByte() ==
  -             testObject.getTestByte());
  -
  -             assert("Asserting char attribute", testObject3.getTestCharacter() ==
  -             testObject.getTestCharacter());
  -
  -             assert("Asserting integer attribute", testObject3.getTestInteger() ==
  -             testObject.getTestInteger());
  -
  -             assert("Asserting short attribute", testObject3.getTestShort() ==
  -             testObject.getTestShort());
  -
  -             assert("Asserting long attribute", testObject3.getTestLong() ==
  -             testObject.getTestLong());
  -
  -             assert("Asserting float attribute", testObject3.getTestFloat() ==
  -             testObject.getTestFloat());
  -
  -             assert("Asserting double attribute", testObject3.getTestDouble() ==
  -             testObject.getTestDouble());
  -
  -             assert("Asserting string attribute", testObject.getTestString().
  -             equals(testObject3.getTestString()));
  -
  -             assert("Asserting reference attribute", testObject3.getTestReference().
  -             getTestReturn() == testObject3);
  -
  -             assert("Asserting array element", testObject3.getTestArray() != null &&
  -             testObject3.getTestArray().length == 1 && testObject3.getTestArray() 
[0] ==
  -             testObject3.getTestReference());
  -
  -             assert("Asserting collection element", testObject3.getTestCollection() 
!= null &&
  -             testObject3.getTestCollection().size() == 1 && 
testObject3.getTestCollection().get(0) ==
  -             testObject3.getTestReference());
  -
  -             assert("Asserting extension attribute", testObject3.isTestExtension() 
==
  -             testObject.isTestExtension());
  -
  -             xmlObjectReader.close();
  -
  -             xmlObjectWriter.close();
  -     }
  -
  -     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  -
  -     public void testArray() throws java.io.IOException, ClassNotFoundException {
  -
  -             java.io.StringWriter stringWriter = new java.io.StringWriter();
  -
  -             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  -
  -             TestObject2 testObject = new TestObject2();
  -
  -             xmlObjectWriter.writeObject(new TestObject[] { testObject, testObject 
});
  -
  -             // maybe we could add some literal comparison of the stream
  -             // but this would be painful to construct and not
  -             // quite independent of the internal techniques, so we leave it
  -             // for the moment
  -
  -             java.io.StringReader stringStream =
  -             new java.io.StringReader(stringWriter.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  -
  -             TestObject[] testObject2 = (TestObject[]) xmlObjectReader.readObject();
  -
  -             assert("Asserting array", testObject2.length == 2 && testObject2[0] == 
testObject2[1]);
  -     }
  -
  -
  -     public void testMeta() throws XmlException, java.io.IOException, 
ClassNotFoundException {
  -
  -             URL resource=Thread.currentThread().getContextClassLoader().
  -                     getResource("META-INF/businessobjects/TestObject2.xsd");
  -
  -
  -             URN firstUrn = new URN(resource.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(new
  -             java.io.InputStreamReader(resource.openStream()), firstUrn, new 
DefaultMetaBinding());
  -
  -             Schema testSchema = (Schema)xmlObjectReader.readObject();
  -
  -             assert("Testing target namespace",
  -             new 
de.infor.ce.util.URN("http://schemas.infor.de/businessobjects/test/TestObject2").
  -             equals(testSchema.getUrn()));
  -
  -             assert("Testing side effect", 
testSchema.equals(xmlObjectReader.getBinding().
  -             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject2"))));
  -
  -             Type firstType = testSchema.getType("TestObject2Type");
  -
  -             assert("Testing first type type", firstType instanceof ClassType);
  -
  -             assert("Testing first type name", 
"TestObject2Type".equals(firstType.getTypeName()));
  -
  -             assert("Testing first type schema", 
testSchema.equals(firstType.getTypeSchema()));
  -
  -             assert("Testing first type associated class", 
de.infor.businessobjects.test.TestObject2.class.
  -             equals(firstType.getAssociatedClass()));
  -
  -             Type superType = firstType.getSuperType();
  -
  -             Schema superTypeSchema = superType.getTypeSchema();
  -
  -             assert("Testing first type supertype", superType instanceof ClassType 
&&
  -             "TestObject1Type".equals(superType.getTypeName()) &&
  -             superTypeSchema.
  -             equals(xmlObjectReader.getBinding().
  -             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject1"))));
  -
  -             Type superSuperType = superType.getSuperType();
  -
  -             Schema superSuperTypeSchema = superSuperType.getTypeSchema();
  -
  -             assert("Testing first type supersupertype", superSuperType instanceof 
ClassType &&
  -             "TestObjectType".equals(superSuperType.getTypeName()) &&
  -             superSuperTypeSchema.
  -             equals(xmlObjectReader.getBinding().
  -             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject"))));
  -
  -             Type superSuperSuperType = superSuperType.getSuperType();
  -
  -             Schema superSuperSuperTypeSchema = superSuperSuperType.getTypeSchema();
  -
  -             assert("Testing first type supersupersupertype", superSuperSuperType 
instanceof ClassType &&
  -             "ObjectType".equals(superSuperSuperType.getTypeName()) &&
  -             superSuperSuperTypeSchema.
  -             equals(xmlObjectReader.getBinding().
  -             getSchema(new URN("http://xml.zoap.org/java/lang/Object"))));
  -
  -             Attribute[] subAttributes = firstType.getAttributes(null);
  -
  -             assert("Testing type attributes", subAttributes != null && 
subAttributes.length == 1);
  -
  -             Attribute nameAttribute = 
firstType.getAttribute(ZoapSchema.getZoapSchema(), "name");
  -
  -             assert("Testing first type name attribute", 
NameAttribute.getNameAttribute().
  -             equals(nameAttribute));
  -
  -             Attribute refAttribute = 
firstType.getAttribute(ZoapSchema.getZoapSchema(), "ref");
  -
  -             assert("Testing first type ref attribute", 
RefAttribute.getRefAttribute().
  -             equals(refAttribute));
  -
  -             Attribute testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testBoolean");
  -
  -             assert("Testing first type boolean attribute", testAttribute 
instanceof FieldAttribute);
  -
  -             assert("Testing first type boolean attribute name", 
"testBoolean".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type boolean attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type boolean attribute type", 
BooleanType.getBooleanType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type boolean attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type boolean attribute field name", 
"testBoolean".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testPrivate");
  -
  -             assert("Testing first type private attribute", testAttribute 
instanceof FieldAttribute);
  -
  -             assert("Testing first type private attribute name", 
"testPrivate".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type private attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type private attribute type", 
BooleanType.getBooleanType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type private attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type private attribute field name", 
"testPrivate".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testPublic");
  -
  -             assert("Testing first type public attribute", testAttribute instanceof 
FieldAttribute);
  -
  -             assert("Testing first type public attribute name", 
"testPublic".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type public attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type public attribute type", 
BooleanType.getBooleanType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type public attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type public attribute field name", "testPublic".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testProtected");
  -
  -             assert("Testing first type protected attribute", testAttribute 
instanceof FieldAttribute);
  -
  -             assert("Testing first type protected attribute name", 
"testProtected".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type protected attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type protected attribute type", 
BooleanType.getBooleanType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type protected attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type protected attribute field name", 
"testProtected".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testByte");
  -
  -             assert("Testing first type byte attribute", testAttribute instanceof 
FieldAttribute);
  -
  -             assert("Testing first type byte attribute name", 
"testByte".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type byte attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type byte attribute type", 
ByteType.getByteType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type byte attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type byte attribute field name", "testByte".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testCharacter");
  -
  -             assert("Testing first type character attribute", testAttribute 
instanceof FieldAttribute);
  -
  -             assert("Testing first type character attribute name", 
"testCharacter".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type character attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type character attribute type", 
CharacterType.getCharacterType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type character attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type character attribute field name", 
"testCharacter".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testInteger");
  -
  -             assert("Testing first type integer attribute", testAttribute 
instanceof FieldAttribute);
  -
  -             assert("Testing first type integer attribute name", 
"testInteger".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type integer attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type integer attribute type", 
IntegerType.getIntegerType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type integer attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type integer attribute field name", 
"testInteger".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testFloat");
  -
  -             assert("Testing first type float attribute", testAttribute instanceof 
FieldAttribute);
  -
  -             assert("Testing first type float attribute name", 
"testFloat".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type float attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type float attribute type", 
FloatType.getFloatType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type float attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type float attribute field name", "testFloat".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testDouble");
  -
  -             assert("Testing first type double attribute", testAttribute instanceof 
FieldAttribute);
  -
  -             assert("Testing first type double attribute name", 
"testDouble".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type double attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type double attribute type", 
DoubleType.getDoubleType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type double attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type double attribute field name", "testDouble".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testShort");
  -
  -             assert("Testing first type short attribute", testAttribute instanceof 
FieldAttribute);
  -
  -             assert("Testing first type short attribute name", 
"testShort".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type short attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type short attribute type", 
ShortType.getShortType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type short attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type short attribute field name", "testShort".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             testAttribute = firstType.
  -             getAttribute(superTypeSchema, "testLong");
  -
  -             assert("Testing first type long attribute", testAttribute instanceof 
FieldAttribute);
  -
  -             assert("Testing first type long attribute name", 
"testLong".equals(testAttribute.
  -             getAppearanceName()));
  -
  -             assert("Testing first type long attribute schema", 
superTypeSchema.equals(testAttribute.
  -             getAppearanceSchema()));
  -
  -             assert("Testing first type long attribute type", 
LongType.getLongType().equals(
  -             testAttribute.getType()));
  -
  -             assert("Testing first type long attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type long attribute field name", "testLong".
  -             equals(((FieldAttribute)testAttribute).getFieldName()));
  -
  -             Attribute firstSubAttribute = firstType.getAttribute(testSchema, 
"testExtension");
  -
  -             assert("Testing first type extension attribute type", 
firstSubAttribute instanceof FieldAttribute);
  -
  -             assert("Testing first type extension attribute name", 
"testExtension".equals(firstSubAttribute.getAppearanceName()));
  -
  -             assert("Testing first type extension attribute schema", 
testSchema.equals(firstSubAttribute.getAppearanceSchema()));
  -
  -             assert("Testing first type extension attribute associatedClass", 
de.infor.businessobjects.test.TestObject2.class.
  -             equals(((FieldAttribute)firstSubAttribute).getAssociatedClass()));
  -
  -             assert("Testing first type extension attribute fieldName", 
"testExtension".
  -             equals(((FieldAttribute)firstSubAttribute).getFieldName()));
  -
  -             Type firstSubAttributeType = firstSubAttribute.getType();
  -
  -             assert("Testing first type extension attribute field type", 
BooleanType.getBooleanType().
  -             equals(firstSubAttributeType));
  -
  -             Element[] subElements = firstType.getElements(null);
  -
  -             assert("Testing type elements", subElements == null || 
subElements.length == 0);
  -
  -             Element firstSubElement = firstType.getElement(superTypeSchema, 
"testReference");
  -
  -             assert("Testing first element", firstSubElement instanceof 
FieldElement);
  -
  -             assert("Testing first element name", 
"testReference".equals(firstSubElement.getAppearanceName()));
  -
  -             assert("Testing first element schema", superTypeSchema.
  -             equals(firstSubElement.getAppearanceSchema()));
  -
  -             assert("Testing second element field name", "testReference".
  -             equals(((FieldElement)firstSubElement).getFieldName()));
  -
  -             assert("Testing second element field associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldElement)firstSubElement).getAssociatedClass()));
  -
  -             Type firstSubElementType = firstSubElement.getType();
  -
  -             assert("Testing first element field type", firstSubElementType 
instanceof ClassType);
  -
  -             assert("Testing first element field name", "TestObject3Type".
  -             equals(firstSubElementType.getTypeName()));
  -
  -             Schema firstSubElementTypeSchema = firstSubElementType.getTypeSchema();
  -
  -             assert("Testing first element field type schema", 
firstSubElementTypeSchema.
  -             equals(xmlObjectReader.getBinding().
  -             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject3"))));
  -
  -             assert("Testing first element field type supertype", 
superSuperSuperType.
  -             equals(firstSubElementType.getSuperType()));
  -
  -             Element firstSubElementTypeSubElement = firstSubElementType.
  -             getElement(firstSubElementTypeSchema, "testReturn");
  -
  -             assert("Testing first element field type first element", 
firstSubElementTypeSubElement instanceof
  -             FieldElement);
  -
  -             assert("Testing first element field type first element name", 
"testReturn".
  -             equals(firstSubElementTypeSubElement.getAppearanceName()));
  -
  -             assert("Testing first element field type first element schema", 
firstSubElementTypeSchema.
  -             equals(firstSubElementTypeSubElement.getAppearanceSchema()));
  -
  -             assert("Testing first element field type first element field name", 
"testReturn".
  -             equals(((FieldElement)firstSubElementTypeSubElement).
  -             getFieldName()));
  -
  -             assert("Testing first element field type first element field class",
  -             de.infor.businessobjects.test.TestObject3.class.
  -             equals(((FieldElement)firstSubElementTypeSubElement).
  -             getAssociatedClass()));
  -
  -             assert("Testing first element field type firs element type", superType.
  -             equals(firstSubElementTypeSubElement.getType()));
  -
  -
  -             Element secondSubElement = firstType.getElement(superTypeSchema, 
"testArray");
  -
  -             assert("Testing array element", secondSubElement instanceof 
FieldElement);
  -
  -             assert("Testing array element name", 
"testArray".equals(secondSubElement.
  -             getAppearanceName()));
  -
  -             assert("Testing array element schema", superTypeSchema.
  -             equals(secondSubElement.getAppearanceSchema()));
  -
  -             assert("Testing array element field name", "testArray".
  -             equals(((FieldElement)secondSubElement).getFieldName()));
  -
  -             assert("Testing array element field associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldElement)secondSubElement).getAssociatedClass()));
  -
  -             Type secondSubElementType = secondSubElement.getType();
  -
  -             assert("Testing second element field type", secondSubElementType 
instanceof CollectionType);
  -
  -             assert("Testing second element field type name", 
"TestObject3CollectionType".
  -             equals(secondSubElementType.getTypeName()));
  -
  -             Schema secondSubElementTypeSchema = 
secondSubElementType.getTypeSchema();
  -
  -             assert("Testing second element field type schema", 
secondSubElementTypeSchema.
  -             equals(xmlObjectReader.getBinding().
  -             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject3"))));
  -
  -             assert("Testing first element field type element", 
firstSubElementType.equals(secondSubElementType.
  -             getElement(secondSubElementTypeSchema, "TestObject3").getType()));
  -
  -             assert("Testing second element field type associated class",
  -             Class.forName("[Lde.infor.businessobjects.test.TestObject3;").
  -             equals(secondSubElementType.getAssociatedClass()));
  -
  -             Element thirdSubElement = firstType.getElement(superTypeSchema, 
"testCollection");
  -
  -             assert("Testing collection element", thirdSubElement instanceof 
FieldElement);
  -
  -             assert("Testing collection element name", 
"testCollection".equals(thirdSubElement.
  -             getAppearanceName()));
  -
  -             assert("Testing collection element schema", superTypeSchema.
  -             equals(thirdSubElement.getAppearanceSchema()));
  -
  -             assert("Testing collection element field name", "testCollection".
  -             equals(((FieldElement)thirdSubElement).getFieldName()));
  -
  -             assert("Testing collection element field associated class", 
de.infor.businessobjects.test.TestObject1.class.
  -             equals(((FieldElement)secondSubElement).getAssociatedClass()));
  -
  -             Type thirdSubElementType = thirdSubElement.getType();
  -
  -             assert("Testing third element field type", thirdSubElementType 
instanceof CollectionType);
  -
  -             assert("Testing third element field type name", 
"TestObject3CollectionVectorType".
  -             equals(thirdSubElementType.getTypeName()));
  -
  -             Schema thirdSubElementTypeSchema = thirdSubElementType.getTypeSchema();
  -
  -             assert("Testing third element field type schema", 
thirdSubElementTypeSchema.
  -             equals(xmlObjectReader.getBinding().
  -             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject3"))));
  -
  -             assert("Testing third element field type element", 
firstSubElementType.equals(thirdSubElementType.
  -             getElement(thirdSubElementTypeSchema, "TestObject3").getType()));
  -
  -             assert("Testing third element field type associated class",
  -             java.util.Vector.class.
  -             equals(thirdSubElementType.getAssociatedClass()));
  -
  -     }
  -
  -
  -     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  -
  -     public void testObjectMeta() throws java.io.IOException, 
ClassNotFoundException {
  -
  -             URL resource=Thread.currentThread().getContextClassLoader().
  -                     getResource("META-INF/businessobjects/TestObject2.xsd");
  -
  -             URN firstUrn = new URN(resource.toString());
  -
  -             Binding binding=new DefaultMetaBinding();
  -
  -             XmlObjectReader metaReader = new XmlObjectReader(new
  -             java.io.InputStreamReader(resource.openStream()), firstUrn, binding);
  -
  -             metaReader.readObject();
  -
  -             java.io.StringWriter stringWriter = new java.io.StringWriter();
  -
  -             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
binding);
  -
  -             TestObject2 testObject = new TestObject2();
  -             TestObject3 testObject2 = new TestObject3();
  -
  -             testObject.setTestInherited(true);
  -
  -             testObject.setTestBoolean(true);
  -
  -             testObject.setTestPublic(true);
  -
  -             testObject.setTestProtected(true);
  -
  -             testObject.setTestPrivate(true);
  -
  -             testObject.setTestStatic(true);
  -
  -             testObject.setTestTransient(true);
  -
  -             testObject.setTestByte((byte)42);
  -
  -             testObject.setTestInteger(42);
  -
  -             testObject.setTestShort((short)42);
  -
  -             testObject.setTestCharacter('z');
  -
  -             testObject.setTestLong((long)42);
  -
  -             testObject.setTestFloat((float)42.0);
  -
  -             testObject.setTestDouble((double)42.0);
  -
  -             testObject.setTestString("42");
  -
  -             testObject.setTestReference(testObject2);
  -
  -             testObject.setTestArray(new TestObject3[] { testObject2 });
  -
  -             testObject.setTestCollection(new java.util.Vector());
  -
  -             testObject.getTestCollection().add(testObject2);
  -
  -             testObject.setTestExtension(true);
  -
  -             testObject2.setTestReturn(testObject);
  -
  -             xmlObjectWriter.writeObject(testObject);
  -
  -             // maybe we could add some literal comparison of the stream
  -             // but this would be painful to construct and not
  -             // quite independent of the internal techniques, so we leave it
  -             // for the moment
  -
  -             java.io.StringReader stringStream =
  -             new java.io.StringReader(stringWriter.toString());
  -
  -             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
binding);
  -
  -             TestObject2 testObject3 = (TestObject2)xmlObjectReader.readObject();
  -
  -             assert("Asserting inherited attribute", testObject3.getTestInherited() 
!=
  -             testObject.getTestInherited());
  -
  -             assert("Asserting private attribute", testObject3.isTestPrivate() ==
  -             testObject.isTestPrivate());
  -
  -             assert("Asserting protected attribute", testObject3.isTestProtected() 
==
  -             testObject.isTestProtected());
  -
  -             assert("Asserting public attribute", testObject3.isTestPublic() ==
  -             testObject.isTestPublic());
  -
  -             assert("Asserting static attribute", testObject3.isTestStatic() ==
  -             testObject.isTestStatic());
  -
  -             assert("Asserting transient attribute", testObject3.isTestTransient() 
!=
  -             testObject.isTestTransient());
  -
  -             assert("Asserting boolean attribute", testObject3.isTestBoolean() ==
  -             testObject.isTestBoolean());
  -
  -             assert("Asserting byte attribute", testObject3.getTestByte() ==
  -             testObject.getTestByte());
  -
  -             assert("Asserting char attribute", testObject3.getTestCharacter() ==
  -             testObject.getTestCharacter());
  -
  -             assert("Asserting integer attribute", testObject3.getTestInteger() ==
  -             testObject.getTestInteger());
  -
  -             assert("Asserting short attribute", testObject3.getTestShort() ==
  -             testObject.getTestShort());
  -
  -             assert("Asserting long attribute", testObject3.getTestLong() ==
  -             testObject.getTestLong());
  -
  -             assert("Asserting float attribute", testObject3.getTestFloat() ==
  -             testObject.getTestFloat());
  -
  -             assert("Asserting double attribute", testObject3.getTestDouble() ==
  -             testObject.getTestDouble());
  -
  -             assert("Asserting string attribute", testObject.getTestString().
  -             equals(testObject3.getTestString()));
  -
  -             assert("Asserting reference attribute", testObject3.getTestReference().
  -             getTestReturn() == testObject3);
  -
  -             assert("Asserting array element", testObject3.getTestArray() != null &&
  -             testObject3.getTestArray().length == 1 && testObject3.getTestArray() 
[0] ==
  -             testObject3.getTestReference());
  -
  -             assert("Asserting collection element", testObject3.getTestCollection() 
!= null &&
  -             testObject3.getTestCollection().size() == 1 && 
testObject3.getTestCollection().get(0) ==
  -             testObject3.getTestReference());
  -
  -             assert("Asserting extension attribute", testObject3.isTestExtension() 
==
  -             testObject.isTestExtension());
  -
  -             xmlObjectReader.close();
  -
  -             xmlObjectWriter.close();
  -     }
  -
  -
  -     public void tearDown() {
  -     }
  -
  -} // Xml
  -
  -/**
  +/*
  + *   $Id: Xml.java,v 1.2 2000/12/04 12:36:45 jung Exp $
  + *   Copyright 2000 (C) infor:business solutions AG, Hauerstrasse 12,
  + *   D-66299 Friedrichsthal, Germany. All Rights Reserved.
  + *
  + *   License Statement
  + *
  + *   Redistribution and use of this software and associated documentation 
("Software"), with or without
  + *   modification, are permitted provided that the following conditions are met:
  + *
  + *   1.      Redistributions of source code must retain copyright statements and 
notices.
  + *           Redistributions must also contain a copy of this document.
  + *
  + *   2.      Redistributions in binary form must reproduce the attached copyright 
notice, this list of
  + *           conditions and the following disclaimer in the documentation and/or 
other materials provided
  + *           with the distribution.
  + *
  + *   3.      The end-user documentation included with the redistribution, if any, 
must include the following
  + *           acknowledgment: "This product includes software developed by infor: 
business solutions AG
  + *           (http://www.infor.de/)." Alternately, this acknowledgment may appear 
in the software itself,
  + *           if and wherever such third-party acknowledgments normally appear.
  + *
  + *   4.      The name "infor" must not be used to endorse or promote products 
derived from this
  + *           Software without prior written permission of infor: business solutions 
AG.
  + *           For written permission, please contact [EMAIL PROTECTED]
  + *
  + *   5.      Products derived from this Software may not be called "infor" nor may 
"infor" appear
  + *           in their names without prior written permission of infor: business 
solutions AG. infor
  + *           is a registered trademark of infor:business solutions AG.
  + *
  + *   Disclaimer
  + *
  + *   THIS SOFTWARE IS PROVIDED BY INFOR: BUSINESS SOLUTIONS AG AND CONTRIBUTORS "AS 
IS" AND ANY
  + *   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF
  + *   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  + *
  + *   IN NO EVENT SHALL INFOR: BUSINESS SOLUTIONS AG OR ITS CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT,
  + *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO,
  + *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
BUSINESS INTERRUPTION)
  + *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT
  + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE,
  + *   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + */
  +
  +package org.zoap.xml.test;
  +
  +import org.zoap.xml.XmlObjectWriter;
  +import org.zoap.xml.XmlObjectReader;
  +import org.zoap.xml.Schema;
  +import org.zoap.xml.Type;
  +import org.zoap.xml.Attribute;
  +import org.zoap.xml.Element;
  +import org.zoap.xml.XmlException;
  +import org.zoap.xml.URNResolver;
  +import org.zoap.xml.Binding;
  +
  +import org.zoap.xml.meta.BooleanType;
  +import org.zoap.xml.meta.DecimalType;
  +import org.zoap.xml.meta.ByteType;
  +import org.zoap.xml.meta.builtin.CharacterType;
  +import org.zoap.xml.meta.builtin.DateType;
  +import org.zoap.xml.meta.IntegerType;
  +import org.zoap.xml.meta.LongType;
  +import org.zoap.xml.meta.ShortType;
  +import org.zoap.xml.meta.FloatType;
  +import org.zoap.xml.meta.DoubleType;
  +
  +import org.zoap.xml.meta.builtin.DefaultBinding;
  +import org.zoap.xml.meta.builtin.DefaultMetaBinding;
  +import org.zoap.xml.meta.builtin.ClassType;
  +import org.zoap.xml.meta.builtin.NameAttribute;
  +import org.zoap.xml.meta.builtin.RefAttribute;
  +import org.zoap.xml.meta.builtin.FieldAttribute;
  +import org.zoap.xml.meta.builtin.FieldElement;
  +import org.zoap.xml.meta.builtin.ClassElement;
  +import org.zoap.xml.meta.builtin.CollectionElement;
  +import org.zoap.xml.meta.builtin.CollectionType;
  +import org.zoap.xml.meta.builtin.ZoapSchema;
  +
  +import java.net.URL;
  +
  +import java.util.Collection;
  +
  +import de.infor.ce.util.URN;
  +
  +import de.infor.businessobjects.test.TestObject;
  +import de.infor.businessobjects.test.TestObject1;
  +import de.infor.businessobjects.test.TestObject2;
  +import de.infor.businessobjects.test.TestObject3;
  +
  +import java.math.BigDecimal;
  +import java.util.Date;
  +
  +
  +/**
  + *      A unit test for checking low-level features of the XML service
  + *      @see <related>
  + *      @author $Author: jung $
  + *      @version $Revision: 1.2 $
  + */
  +
  +public class Xml extends junit.framework.TestCase {
  +
  +     public Xml(String name) {
  +             super(name);
  +     }
  +
  +     public static void main(String[] args) {
  +
  +             junit.textui.TestRunner runner = new junit.textui.TestRunner();
  +
  +             try {
  +                     runner.run(suite());
  +             } catch (Exception e) {
  +             }
  +     }
  +
  +     public static junit.framework.Test suite() {
  +
  +             return new junit.framework.TestSuite(Xml.class);
  +
  +     }
  +
  +     public void setUp() {
  +     }
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testBoolean() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             xmlObjectWriter.writeBoolean(true);
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +             assert("Testing writing and reading of boolean", 
xmlObjectReader.readBoolean() == true);
  +
  +     }
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testDate() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             xmlObjectWriter.writeObject(new Date((long) 42));
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +             System.out.println(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +        Date result=(Date)      xmlObjectReader.readObject();
  +
  +             assert("Testing writing and reading of date", result.getTime()==42);
  +     }
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testDecimal() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             xmlObjectWriter.writeObject(new BigDecimal("42.0"));
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +        BigDecimal result=(BigDecimal)      xmlObjectReader.readObject();
  +
  +             assert("Testing writing and reading of boolean", 
result.doubleValue()==42.0);
  +     }
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testString() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             xmlObjectWriter.writeUTF("42���</>\'&\"");
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +        // System.out.println(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +        String result=xmlObjectReader.readUTF();
  +
  +             assert("Testing writing and reading of string", 
"42���</>\'&\"".equals(result));
  +
  +     }
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testByte() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             xmlObjectWriter.writeByte((byte)42);
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +             assert("Testing writing and reading of byte", 42 == 
xmlObjectReader.readByte());
  +
  +     }
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testObject() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             TestObject2 testObject = new TestObject2();
  +             TestObject3 testObject2 = new TestObject3();
  +
  +             testObject.setTestInherited(true);
  +
  +             testObject.setTestBoolean(true);
  +
  +             testObject.setTestPublic(true);
  +
  +             testObject.setTestProtected(true);
  +
  +             testObject.setTestPrivate(true);
  +
  +             testObject.setTestStatic(true);
  +
  +             testObject.setTestTransient(true);
  +
  +             testObject.setTestByte((byte)42);
  +
  +             testObject.setTestInteger(42);
  +
  +             testObject.setTestShort((short)42);
  +
  +             testObject.setTestCharacter('z');
  +
  +             testObject.setTestLong((long)42);
  +
  +             testObject.setTestFloat((float)42.0);
  +
  +             testObject.setTestDouble((double)42.0);
  +
  +
  +             testObject.setTestDate(new Date((long)42));
  +
  +             testObject.setTestString("42���</>\'&\"");
  +
  +             testObject.setTestReference(testObject2);
  +
  +        testObject.setTestDecimal(new BigDecimal("42.0"));
  +
  +             testObject.setTestArray(new TestObject3[] { testObject2 });
  +
  +             testObject.setTestCollection(new java.util.Vector());
  +
  +             testObject.getTestCollection().add(testObject2);
  +
  +             testObject.setTestExtension(true);
  +
  +             testObject2.setTestReturn(testObject);
  +
  +             xmlObjectWriter.writeObject(testObject);
  +
  +             // maybe we could add some literal comparison of the stream
  +             // but this would be painful to construct and not
  +             // quite independent of the internal techniques, so we leave it
  +             // for the moment
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +        // System.out.println(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +             TestObject2 testObject3 = (TestObject2)xmlObjectReader.readObject();
  +
  +             assert("Asserting inherited attribute", testObject3.getTestInherited() 
!=
  +             testObject.getTestInherited());
  +
  +             assert("Asserting private attribute", testObject3.isTestPrivate() ==
  +             testObject.isTestPrivate());
  +
  +             assert("Asserting protected attribute", testObject3.isTestProtected() 
==
  +             testObject.isTestProtected());
  +
  +             assert("Asserting public attribute", testObject3.isTestPublic() ==
  +             testObject.isTestPublic());
  +
  +             assert("Asserting static attribute", testObject3.isTestStatic() ==
  +             testObject.isTestStatic());
  +
  +             assert("Asserting transient attribute", testObject3.isTestTransient() 
!=
  +             testObject.isTestTransient());
  +
  +             assert("Asserting boolean attribute", testObject3.isTestBoolean() ==
  +             testObject.isTestBoolean());
  +
  +             assert("Asserting byte attribute", testObject3.getTestByte() ==
  +             testObject.getTestByte());
  +
  +             assert("Asserting char attribute", testObject3.getTestCharacter() ==
  +             testObject.getTestCharacter());
  +
  +             assert("Asserting integer attribute", testObject3.getTestInteger() ==
  +             testObject.getTestInteger());
  +
  +             assert("Asserting short attribute", testObject3.getTestShort() ==
  +             testObject.getTestShort());
  +
  +             assert("Asserting long attribute", testObject3.getTestLong() ==
  +             testObject.getTestLong());
  +
  +             assert("Asserting float attribute", testObject3.getTestFloat() ==
  +             testObject.getTestFloat());
  +
  +             assert("Asserting double attribute", testObject3.getTestDouble() ==
  +             testObject.getTestDouble());
  +
  +             assert("Asserting date attribute", testObject3.getTestDate().equals(
  +             testObject.getTestDate()));
  +
  +             assert("Asserting string attribute", testObject.getTestString().
  +             equals(testObject3.getTestString()));
  +
  +             assert("Asserting string attribute", testObject.getTestDecimal().
  +             equals(testObject3.getTestDecimal()));
  +
  +             assert("Asserting reference attribute", testObject3.getTestReference().
  +             getTestReturn() == testObject3);
  +
  +             assert("Asserting array element", testObject3.getTestArray() != null &&
  +             testObject3.getTestArray().length == 1 && testObject3.getTestArray() 
[0] ==
  +             testObject3.getTestReference());
  +
  +             assert("Asserting collection element", testObject3.getTestCollection() 
!= null &&
  +             testObject3.getTestCollection().size() == 1 && 
testObject3.getTestCollection().get(0) ==
  +             testObject3.getTestReference());
  +
  +             assert("Asserting extension attribute", testObject3.isTestExtension() 
==
  +             testObject.isTestExtension());
  +
  +             xmlObjectReader.close();
  +
  +             xmlObjectWriter.close();
  +     }
  +
  +
  +    /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testArray() throws java.io.IOException, ClassNotFoundException {
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
new DefaultBinding());
  +
  +             TestObject2 testObject = new TestObject2();
  +
  +             xmlObjectWriter.writeObject(new TestObject[] { testObject, testObject 
});
  +
  +             // maybe we could add some literal comparison of the stream
  +             // but this would be painful to construct and not
  +             // quite independent of the internal techniques, so we leave it
  +             // for the moment
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
new DefaultBinding());
  +
  +             TestObject[] testObject2 = (TestObject[]) xmlObjectReader.readObject();
  +
  +             assert("Asserting array", testObject2.length == 2 && testObject2[0] == 
testObject2[1]);
  +     }
  +
  +
  +     public void testMeta() throws XmlException, java.io.IOException, 
ClassNotFoundException {
  +
  +             URL resource=Thread.currentThread().getContextClassLoader().
  +                     getResource("META-INF/businessobjects/TestObject2.xsd");
  +
  +
  +             URN firstUrn = new URN(resource.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(new
  +             java.io.InputStreamReader(resource.openStream()), firstUrn, new 
DefaultMetaBinding());
  +
  +             Schema testSchema = (Schema)xmlObjectReader.readObject();
  +
  +             assert("Testing target namespace",
  +             new 
de.infor.ce.util.URN("http://schemas.infor.de/businessobjects/test/TestObject2").
  +             equals(testSchema.getUrn()));
  +
  +             assert("Testing side effect", 
testSchema.equals(xmlObjectReader.getBinding().
  +             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject2"))));
  +
  +             Type firstType = testSchema.getType("TestObject2Type");
  +
  +             assert("Testing first type type", firstType instanceof ClassType);
  +
  +             assert("Testing first type name", 
"TestObject2Type".equals(firstType.getTypeName()));
  +
  +             assert("Testing first type schema", 
testSchema.equals(firstType.getTypeSchema()));
  +
  +             assert("Testing first type associated class", 
de.infor.businessobjects.test.TestObject2.class.
  +             equals(firstType.getAssociatedClass()));
  +
  +             Type superType = firstType.getSuperType();
  +
  +             Schema superTypeSchema = superType.getTypeSchema();
  +
  +             assert("Testing first type supertype", superType instanceof ClassType 
&&
  +             "TestObject1Type".equals(superType.getTypeName()) &&
  +             superTypeSchema.
  +             equals(xmlObjectReader.getBinding().
  +             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject1"))));
  +
  +             Type superSuperType = superType.getSuperType();
  +
  +             Schema superSuperTypeSchema = superSuperType.getTypeSchema();
  +
  +             assert("Testing first type supersupertype", superSuperType instanceof 
ClassType &&
  +             "TestObjectType".equals(superSuperType.getTypeName()) &&
  +             superSuperTypeSchema.
  +             equals(xmlObjectReader.getBinding().
  +             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject"))));
  +
  +             Type superSuperSuperType = superSuperType.getSuperType();
  +
  +             Schema superSuperSuperTypeSchema = superSuperSuperType.getTypeSchema();
  +
  +             assert("Testing first type supersupersupertype", superSuperSuperType 
instanceof ClassType &&
  +             "ObjectType".equals(superSuperSuperType.getTypeName()) &&
  +             superSuperSuperTypeSchema.
  +             equals(xmlObjectReader.getBinding().
  +             getSchema(new URN("http://xml.zoap.org/java/lang/Object"))));
  +
  +             Attribute[] subAttributes = firstType.getAttributes(null);
  +
  +             assert("Testing type attributes", subAttributes != null && 
subAttributes.length == 1);
  +
  +             Attribute nameAttribute = 
firstType.getAttribute(ZoapSchema.getZoapSchema(), "name");
  +
  +             assert("Testing first type name attribute", 
NameAttribute.getNameAttribute().
  +             equals(nameAttribute));
  +
  +             Attribute refAttribute = 
firstType.getAttribute(ZoapSchema.getZoapSchema(), "ref");
  +
  +             assert("Testing first type ref attribute", 
RefAttribute.getRefAttribute().
  +             equals(refAttribute));
  +
  +             Attribute testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testBoolean");
  +
  +             assert("Testing first type boolean attribute", testAttribute 
instanceof FieldAttribute);
  +
  +             assert("Testing first type boolean attribute name", 
"testBoolean".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type boolean attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type boolean attribute type", 
BooleanType.getBooleanType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type boolean attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type boolean attribute field name", 
"testBoolean".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testPrivate");
  +
  +             assert("Testing first type private attribute", testAttribute 
instanceof FieldAttribute);
  +
  +             assert("Testing first type private attribute name", 
"testPrivate".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type private attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type private attribute type", 
BooleanType.getBooleanType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type private attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type private attribute field name", 
"testPrivate".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testPublic");
  +
  +             assert("Testing first type public attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type public attribute name", 
"testPublic".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type public attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type public attribute type", 
BooleanType.getBooleanType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type public attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type public attribute field name", "testPublic".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testProtected");
  +
  +             assert("Testing first type protected attribute", testAttribute 
instanceof FieldAttribute);
  +
  +             assert("Testing first type protected attribute name", 
"testProtected".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type protected attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type protected attribute type", 
BooleanType.getBooleanType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type protected attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type protected attribute field name", 
"testProtected".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testByte");
  +
  +             assert("Testing first type byte attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type byte attribute name", 
"testByte".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type byte attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type byte attribute type", 
ByteType.getByteType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type byte attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type byte attribute field name", "testByte".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testCharacter");
  +
  +             assert("Testing first type character attribute", testAttribute 
instanceof FieldAttribute);
  +
  +             assert("Testing first type character attribute name", 
"testCharacter".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type character attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type character attribute type", 
CharacterType.getCharacterType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type character attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type character attribute field name", 
"testCharacter".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testInteger");
  +
  +             assert("Testing first type integer attribute", testAttribute 
instanceof FieldAttribute);
  +
  +             assert("Testing first type integer attribute name", 
"testInteger".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type integer attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type integer attribute type", 
IntegerType.getIntegerType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type integer attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type integer attribute field name", 
"testInteger".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testDecimal");
  +
  +             assert("Testing first type decimal attribute", testAttribute 
instanceof FieldAttribute);
  +
  +             assert("Testing first type decimal attribute name", 
"testDecimal".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type decimal attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type decimal attribute type", 
DecimalType.getDecimalType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type decimal attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type decimal attribute field name", 
"testDecimal".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testFloat");
  +
  +             assert("Testing first type float attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type float attribute name", 
"testFloat".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type float attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type float attribute type", 
FloatType.getFloatType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type float attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type float attribute field name", "testFloat".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testDouble");
  +
  +             assert("Testing first type double attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type double attribute name", 
"testDouble".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type double attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type double attribute type", 
DoubleType.getDoubleType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type double attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type double attribute field name", "testDouble".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testShort");
  +
  +             assert("Testing first type short attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type short attribute name", 
"testShort".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type short attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type short attribute type", 
ShortType.getShortType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type short attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type short attribute field name", "testShort".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testLong");
  +
  +             assert("Testing first type long attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type long attribute name", 
"testLong".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type long attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type long attribute type", 
LongType.getLongType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type long attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type long attribute field name", "testLong".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             testAttribute = firstType.
  +             getAttribute(superTypeSchema, "testDate");
  +
  +             assert("Testing first type date attribute", testAttribute instanceof 
FieldAttribute);
  +
  +             assert("Testing first type date attribute name", 
"testDate".equals(testAttribute.
  +             getAppearanceName()));
  +
  +             assert("Testing first type date attribute schema", 
superTypeSchema.equals(testAttribute.
  +             getAppearanceSchema()));
  +
  +             assert("Testing first type date attribute type", 
DateType.getDateType().equals(
  +             testAttribute.getType()));
  +
  +             assert("Testing first type date attribute associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldAttribute)testAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type date attribute field name", "testDate".
  +             equals(((FieldAttribute)testAttribute).getFieldName()));
  +
  +             Attribute firstSubAttribute = firstType.getAttribute(testSchema, 
"testExtension");
  +
  +             assert("Testing first type extension attribute type", 
firstSubAttribute instanceof FieldAttribute);
  +
  +             assert("Testing first type extension attribute name", 
"testExtension".equals(firstSubAttribute.getAppearanceName()));
  +
  +             assert("Testing first type extension attribute schema", 
testSchema.equals(firstSubAttribute.getAppearanceSchema()));
  +
  +             assert("Testing first type extension attribute associatedClass", 
de.infor.businessobjects.test.TestObject2.class.
  +             equals(((FieldAttribute)firstSubAttribute).getAssociatedClass()));
  +
  +             assert("Testing first type extension attribute fieldName", 
"testExtension".
  +             equals(((FieldAttribute)firstSubAttribute).getFieldName()));
  +
  +             Type firstSubAttributeType = firstSubAttribute.getType();
  +
  +             assert("Testing first type extension attribute field type", 
BooleanType.getBooleanType().
  +             equals(firstSubAttributeType));
  +
  +             Element[] subElements = firstType.getElements(null);
  +
  +             assert("Testing type elements", subElements == null || 
subElements.length == 0);
  +
  +             Element firstSubElement = firstType.getElement(superTypeSchema, 
"testReference");
  +
  +             assert("Testing first element", firstSubElement instanceof 
FieldElement);
  +
  +             assert("Testing first element name", 
"testReference".equals(firstSubElement.getAppearanceName()));
  +
  +             assert("Testing first element schema", superTypeSchema.
  +             equals(firstSubElement.getAppearanceSchema()));
  +
  +             assert("Testing second element field name", "testReference".
  +             equals(((FieldElement)firstSubElement).getFieldName()));
  +
  +             assert("Testing second element field associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldElement)firstSubElement).getAssociatedClass()));
  +
  +             Type firstSubElementType = firstSubElement.getType();
  +
  +             assert("Testing first element field type", firstSubElementType 
instanceof ClassType);
  +
  +             assert("Testing first element field name", "TestObject3Type".
  +             equals(firstSubElementType.getTypeName()));
  +
  +             Schema firstSubElementTypeSchema = firstSubElementType.getTypeSchema();
  +
  +             assert("Testing first element field type schema", 
firstSubElementTypeSchema.
  +             equals(xmlObjectReader.getBinding().
  +             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject3"))));
  +
  +             assert("Testing first element field type supertype", 
superSuperSuperType.
  +             equals(firstSubElementType.getSuperType()));
  +
  +             Element firstSubElementTypeSubElement = firstSubElementType.
  +             getElement(firstSubElementTypeSchema, "testReturn");
  +
  +             assert("Testing first element field type first element", 
firstSubElementTypeSubElement instanceof
  +             FieldElement);
  +
  +             assert("Testing first element field type first element name", 
"testReturn".
  +             equals(firstSubElementTypeSubElement.getAppearanceName()));
  +
  +             assert("Testing first element field type first element schema", 
firstSubElementTypeSchema.
  +             equals(firstSubElementTypeSubElement.getAppearanceSchema()));
  +
  +             assert("Testing first element field type first element field name", 
"testReturn".
  +             equals(((FieldElement)firstSubElementTypeSubElement).
  +             getFieldName()));
  +
  +             assert("Testing first element field type first element field class",
  +             de.infor.businessobjects.test.TestObject3.class.
  +             equals(((FieldElement)firstSubElementTypeSubElement).
  +             getAssociatedClass()));
  +
  +             assert("Testing first element field type firs element type", superType.
  +             equals(firstSubElementTypeSubElement.getType()));
  +
  +
  +             Element secondSubElement = firstType.getElement(superTypeSchema, 
"testArray");
  +
  +             assert("Testing array element", secondSubElement instanceof 
FieldElement);
  +
  +             assert("Testing array element name", 
"testArray".equals(secondSubElement.
  +             getAppearanceName()));
  +
  +             assert("Testing array element schema", superTypeSchema.
  +             equals(secondSubElement.getAppearanceSchema()));
  +
  +             assert("Testing array element field name", "testArray".
  +             equals(((FieldElement)secondSubElement).getFieldName()));
  +
  +             assert("Testing array element field associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldElement)secondSubElement).getAssociatedClass()));
  +
  +             Type secondSubElementType = secondSubElement.getType();
  +
  +             assert("Testing second element field type", secondSubElementType 
instanceof CollectionType);
  +
  +             assert("Testing second element field type name", 
"TestObject3CollectionType".
  +             equals(secondSubElementType.getTypeName()));
  +
  +             Schema secondSubElementTypeSchema = 
secondSubElementType.getTypeSchema();
  +
  +             assert("Testing second element field type schema", 
secondSubElementTypeSchema.
  +             equals(xmlObjectReader.getBinding().
  +             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject3"))));
  +
  +             assert("Testing first element field type element", 
firstSubElementType.equals(secondSubElementType.
  +             getElement(secondSubElementTypeSchema, "TestObject3").getType()));
  +
  +             assert("Testing second element field type associated class",
  +             Class.forName("[Lde.infor.businessobjects.test.TestObject3;").
  +             equals(secondSubElementType.getAssociatedClass()));
  +
  +             Element thirdSubElement = firstType.getElement(superTypeSchema, 
"testCollection");
  +
  +             assert("Testing collection element", thirdSubElement instanceof 
FieldElement);
  +
  +             assert("Testing collection element name", 
"testCollection".equals(thirdSubElement.
  +             getAppearanceName()));
  +
  +             assert("Testing collection element schema", superTypeSchema.
  +             equals(thirdSubElement.getAppearanceSchema()));
  +
  +             assert("Testing collection element field name", "testCollection".
  +             equals(((FieldElement)thirdSubElement).getFieldName()));
  +
  +             assert("Testing collection element field associated class", 
de.infor.businessobjects.test.TestObject1.class.
  +             equals(((FieldElement)secondSubElement).getAssociatedClass()));
  +
  +             Type thirdSubElementType = thirdSubElement.getType();
  +
  +             assert("Testing third element field type", thirdSubElementType 
instanceof CollectionType);
  +
  +             assert("Testing third element field type name", 
"TestObject3CollectionVectorType".
  +             equals(thirdSubElementType.getTypeName()));
  +
  +             Schema thirdSubElementTypeSchema = thirdSubElementType.getTypeSchema();
  +
  +             assert("Testing third element field type schema", 
thirdSubElementTypeSchema.
  +             equals(xmlObjectReader.getBinding().
  +             getSchema(new 
URN("http://schemas.infor.de/businessobjects/test/TestObject3"))));
  +
  +             assert("Testing third element field type element", 
firstSubElementType.equals(thirdSubElementType.
  +             getElement(thirdSubElementTypeSchema, "TestObject3").getType()));
  +
  +             assert("Testing third element field type associated class",
  +             java.util.Vector.class.
  +             equals(thirdSubElementType.getAssociatedClass()));
  +
  +     }
  +
  +
  +     /** test for the basic (de-)serialisation capabilities and the built-in data 
binding using external schema referencing */
  +
  +     public void testObjectMeta() throws java.io.IOException, 
ClassNotFoundException {
  +
  +             URL resource=Thread.currentThread().getContextClassLoader().
  +                     getResource("META-INF/businessobjects/TestObject2.xsd");
  +
  +             URN firstUrn = new URN(resource.toString());
  +
  +             Binding binding=new DefaultMetaBinding();
  +
  +             XmlObjectReader metaReader = new XmlObjectReader(new
  +             java.io.InputStreamReader(resource.openStream()), firstUrn, binding);
  +
  +             metaReader.readObject();
  +
  +             java.io.StringWriter stringWriter = new java.io.StringWriter();
  +
  +             XmlObjectWriter xmlObjectWriter = new XmlObjectWriter(stringWriter, 
binding);
  +
  +             TestObject2 testObject = new TestObject2();
  +             TestObject3 testObject2 = new TestObject3();
  +
  +             testObject.setTestInherited(true);
  +
  +             testObject.setTestBoolean(true);
  +
  +             testObject.setTestPublic(true);
  +
  +             testObject.setTestProtected(true);
  +
  +             testObject.setTestPrivate(true);
  +
  +             testObject.setTestStatic(true);
  +
  +             testObject.setTestTransient(true);
  +
  +             testObject.setTestByte((byte)42);
  +
  +             testObject.setTestInteger(42);
  +
  +             testObject.setTestShort((short)42);
  +
  +             testObject.setTestCharacter('z');
  +
  +             testObject.setTestLong((long)42);
  +
  +             testObject.setTestFloat((float)42.0);
  +
  +             testObject.setTestDouble((double)42.0);
  +
  +             testObject.setTestString("42���</>\'&\"");
  +
  +        testObject.setTestDecimal(new BigDecimal("42.0"));
  +
  +        testObject.setTestDate(new Date((long) 42));
  +
  +             testObject.setTestReference(testObject2);
  +
  +             testObject.setTestArray(new TestObject3[] { testObject2 });
  +
  +             testObject.setTestCollection(new java.util.Vector());
  +
  +             testObject.getTestCollection().add(testObject2);
  +
  +             testObject.setTestExtension(true);
  +
  +             testObject2.setTestReturn(testObject);
  +
  +             xmlObjectWriter.writeObject(testObject);
  +
  +             // maybe we could add some literal comparison of the stream
  +             // but this would be painful to construct and not
  +             // quite independent of the internal techniques, so we leave it
  +             // for the moment
  +
  +             java.io.StringReader stringStream =
  +             new java.io.StringReader(stringWriter.toString());
  +
  +             XmlObjectReader xmlObjectReader = new XmlObjectReader(stringStream, 
binding);
  +
  +             TestObject2 testObject3 = (TestObject2)xmlObjectReader.readObject();
  +
  +             assert("Asserting inherited attribute", testObject3.getTestInherited() 
!=
  +             testObject.getTestInherited());
  +
  +             assert("Asserting private attribute", testObject3.isTestPrivate() ==
  +             testObject.isTestPrivate());
  +
  +             assert("Asserting protected attribute", testObject3.isTestProtected() 
==
  +             testObject.isTestProtected());
  +
  +             assert("Asserting public attribute", testObject3.isTestPublic() ==
  +             testObject.isTestPublic());
  +
  +             assert("Asserting static attribute", testObject3.isTestStatic() ==
  +             testObject.isTestStatic());
  +
  +             assert("Asserting transient attribute", testObject3.isTestTransient() 
!=
  +             testObject.isTestTransient());
  +
  +             assert("Asserting boolean attribute", testObject3.isTestBoolean() ==
  +             testObject.isTestBoolean());
  +
  +             assert("Asserting decimal attribute", 
testObject3.getTestDecimal().equals(testObject.
  +            getTestDecimal()));
  +
  +             assert("Asserting date attribute", 
testObject3.getTestDate().equals(testObject.
  +            getTestDate()));
  +
  +             assert("Asserting byte attribute", testObject3.getTestByte() ==
  +             testObject.getTestByte());
  +
  +             assert("Asserting char attribute", testObject3.getTestCharacter() ==
  +             testObject.getTestCharacter());
  +
  +             assert("Asserting integer attribute", testObject3.getTestInteger() ==
  +             testObject.getTestInteger());
  +
  +             assert("Asserting short attribute", testObject3.getTestShort() ==
  +             testObject.getTestShort());
  +
  +             assert("Asserting long attribute", testObject3.getTestLong() ==
  +             testObject.getTestLong());
  +
  +             assert("Asserting float attribute", testObject3.getTestFloat() ==
  +             testObject.getTestFloat());
  +
  +             assert("Asserting double attribute", testObject3.getTestDouble() ==
  +             testObject.getTestDouble());
  +
  +             assert("Asserting string attribute", testObject.getTestString().
  +             equals(testObject3.getTestString()));
  +
  +             assert("Asserting reference attribute", testObject3.getTestReference().
  +             getTestReturn() == testObject3);
  +
  +             assert("Asserting array element", testObject3.getTestArray() != null &&
  +             testObject3.getTestArray().length == 1 && testObject3.getTestArray() 
[0] ==
  +             testObject3.getTestReference());
  +
  +             assert("Asserting collection element", testObject3.getTestCollection() 
!= null &&
  +             testObject3.getTestCollection().size() == 1 && 
testObject3.getTestCollection().get(0) ==
  +             testObject3.getTestReference());
  +
  +             assert("Asserting extension attribute", testObject3.isTestExtension() 
==
  +             testObject.isTestExtension());
  +
  +             xmlObjectReader.close();
  +
  +             xmlObjectWriter.close();
  +     }
  +
  +
  +     public void tearDown() {
  +     }
  +
  +} // Xml
  +
  +/**
    * $Log: Xml.java,v $
  - * Revision 1.1  2000/08/10 21:08:16  jung
  - * Initial revision
  - * Revision 1.1.2.3  2000/08/04 17:20:20  jung close to beta stadium. Meta-Data 
import now works.
  - * Revision 1.1.2.2  2000/07/17 12:46:21  jung refactored package and meta-model 
Revision 1.1.2.1  2000/07/13 12:46:25  jung
  - * package renaming, most of the zoap stuff now under org.zoap
  - * util and http stay infor.ce, containerInvoker etc move to org.jboss changed the 
makefile, adopted most of the licenses
  - * Revision 1.1.1.1  2000/07/06 14:11:29  jung Import of a pre beta version of ZOAP 
source with a new directory structure,
  - * ant-based make, apache-kind of license, etc. jars are coming later because of 
cvs-history reasons.
  - * Revision 1.1.1.1  2000/06/19 12:04:13  jung imported  ZOAPackage that should go 
into a seperate Open Source project
  - * Revision 1.1.2.1  2000/06/14 12:38:18  jung removed the NEWLINE bug: since 
infor:X was just using
  - * \n to mark the end of a line in serialisation, any subsequent stream processing 
that relies on a proper newline (and any
  - * subsequent derserialisation that tries to grab characters out of a tag) must be 
confused.
  - * When going to \r\n and appropriately adjusting the readCharacters methods in the 
basic types and the DocumentHandler of
  - * XmlObjectReader, this symptom has now vanished. Looks like resolved ... Revision 
1.1  2000/06/05 09:16:56  jung
  - * added an initial revision of infor:X, the XML (de-)serialisation service of 
infor:CE.
  - * supports meta-data structures, namespaces, schemas. lacks collection support, 
forward-references, multiple roots
  - * and external resolution.
  - */
  + * Revision 1.2  2000/12/04 12:36:45  jung
  + * adopted to latest jboss container,
  + *
  + * added decimal and date
  + *
  + * removed some problems due to forward-referencing in meta-data
  + *
  + * added serialisation policy
  + *
  + * Revision 1.2  2000/11/22 14:23:38  jung
  + * added date to test
  + *
  + * Revision 1.1.1.1  2000/11/16 14:50:02  jung
  + * added the up-to-date ZOAP source (how I know: I 
  + * made it).
  + *
  + * Revision 1.1.1.1  2000/08/10 21:08:16  jung
  + * Initial import.
  + *
  + */
  
  
  
  1.2       +33 -33    zoap/src/org/zoap/xml/test/test.dfPackage
  
  Index: test.dfPackage
  ===================================================================
  RCS file: /products/cvs/ejboss/zoap/src/org/zoap/xml/test/test.dfPackage,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- test.dfPackage    2000/08/10 21:08:13     1.1
  +++ test.dfPackage    2000/12/04 12:36:45     1.2
  @@ -1,33 +1,33 @@
  -package id2nzq3c8wpmexoc8wpnwj4;
  -
  -/**
  -@version 2.0
  -@physicalPackage
  -@__modelType diagram 
  -*/
  -class diagram {
  -/**
  -@__ref <oiref:java#Class#org.zoap.xml.test.Xml:oiref><oihard>
  -@__modelType reference 
  -*/
  -class reference26 {
  -}}/**
  -@__tags
  -@shapeType ClassDiagram 
  -*/
  -class __tags {
  -}/**
  -@__options 
  -*/
  -class __options {
  -}/**
  -@__positions 
  
-<oigroup:<oiref:java#Extends#org.zoap.xml.test.TestClass2#org.zoap.xml.test.TestClass1:oiref>=96,315,96,269:oigroup>
  
-<oigroup:<oiref:java#Extends#org.zoap.xml.test.TestClass1#org.zoap.xml.test.TestClass:oiref>=96,164,96,78:oigroup>
  
-<oigroup:<oiref:java#Extends#org.zoap.xml.test.TestClass2#org.zoap.xml.test.TestClass:oiref>=148,542,148,445:oigroup>
  -<oigroup:<oiref:java#Class#org.zoap.xml.test.Xml:oiref>=261,310,179,289,1:oigroup>
  
-<oigroup:MemberLink#<oiref:java#Member#org.zoap.xml.test.TestClass#testArrayE:oiref>=221,445,221,487,295,487,295,413,253,413:oigroup>
  
-<oigroup:MemberLink#<oiref:java#Member#org.zoap.xml.test.TestClass#testReferenceE:oiref>=189,445,189,519,327,519,327,381,253,381:oigroup>
  -*/
  -class __positions {
  -}
  \ No newline at end of file
  +package id2nzq3c8wpmexoc8wpnwj4;
  +
  +/**
  +@version 2.0
  +@physicalPackage
  +@__modelType diagram 
  +*/
  +class diagram {
  +/**
  +@__ref <oiref:java#Class#org.zoap.xml.test.Xml:oiref><oihard>
  +@__modelType reference 
  +*/
  +class reference26 {
  +}}/**
  +@__tags
  +@shapeType ClassDiagram 
  +*/
  +class __tags {
  +}/**
  +@__options 
  +*/
  +class __options {
  +}/**
  +@__positions 
  
+<oigroup:<oiref:java#Extends#org.zoap.xml.test.TestClass2#org.zoap.xml.test.TestClass1:oiref>=96,315,96,269:oigroup>
  
+<oigroup:<oiref:java#Extends#org.zoap.xml.test.TestClass1#org.zoap.xml.test.TestClass:oiref>=96,164,96,78:oigroup>
  
+<oigroup:<oiref:java#Extends#org.zoap.xml.test.TestClass2#org.zoap.xml.test.TestClass:oiref>=148,542,148,445:oigroup>
  +<oigroup:<oiref:java#Class#org.zoap.xml.test.Xml:oiref>=261,310,179,289,1:oigroup>
  
+<oigroup:MemberLink#<oiref:java#Member#org.zoap.xml.test.TestClass#testArrayE:oiref>=221,445,221,487,295,487,295,413,253,413:oigroup>
  
+<oigroup:MemberLink#<oiref:java#Member#org.zoap.xml.test.TestClass#testReferenceE:oiref>=189,445,189,519,327,519,327,381,253,381:oigroup>
  +*/
  +class __positions {
  +}
  
  
  

Reply via email to