1.1 --- a/schema2beans/test/unit/src/TestMain.java Wed Aug 03 20:37:05 2005 +0000
1.2 +++ b/schema2beans/test/unit/src/TestMain.java Sun Aug 07 00:32:00 2005 +0000
1.3 @@ -67,6 +67,10 @@
1.4 generalTest("TestBook");
1.5 }
1.6
1.7 + public void testDupInternalNames() throws IOException, Schema2BeansException, InterruptedException {
1.8 + generalTest("TestDupInternalNames", true, true, true);
1.9 + }
1.10 +
1.11 public void testEvents() throws IOException, Schema2BeansException, InterruptedException {
1.12 generalTest("TestEvents");
1.13 }
1.14 @@ -213,7 +217,7 @@
1.15 public void testBeanWrapper() throws IOException, Schema2BeansException, InterruptedException {
1.16 String testName = "TestBeanWrapper";
1.17 try {
1.18 - System.out.println("Starting "+testName);
1.19 + System.out.println(": Starting "+testName);
1.20 File workDir = getWorkDir();
1.21 System.out.println("workDir="+workDir.toString());
1.22 File schemaFile;
1.23 @@ -304,7 +308,7 @@
1.24 if (testOnly != null && !testOnly.equals(testName))
1.25 return;
1.26 try {
1.27 - System.out.println("Starting "+testName);
1.28 + System.out.println(": Starting "+testName);
1.29 File workDir = getWorkDir();
1.30
1.31 //File diffCommandFile = new File(workDir, "diffCommand");
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/schema2beans/test/unit/src/data/TestDupInternalNames.java Sun Aug 07 00:32:00 2005 +0000
2.3 @@ -0,0 +1,66 @@
2.4 +/*
2.5 + * Sun Public License Notice
2.6 + *
2.7 + * The contents of this file are subject to the Sun Public License
2.8 + * Version 1.0 (the "License"). You may not use this file except in
2.9 + * compliance with the License. A copy of the License is available at
2.10 + * http://www.sun.com/
2.11 + *
2.12 + * The Original Code is NetBeans. The Initial Developer of the Original
2.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
2.14 + * Microsystems, Inc. All Rights Reserved.
2.15 + */
2.16 +
2.17 +/*
2.18 + * TestDupInternalNames - test what happens when different complexTypes
2.19 + * have the same named element declaration
2.20 + * inside of them. Duplicate type names should
2.21 + * get renamed.
2.22 + *
2.23 + * The following test assumes that we know the content of the
2.24 + * graph as we get elements, add and change them. Therefore, the TestDupInternalNames.xml
2.25 + * file and this java test should be kept in sync.
2.26 + *
2.27 + */
2.28 +
2.29 +import java.io.*;
2.30 +import java.util.*;
2.31 +import org.w3c.dom.*;
2.32 +import java.math.*;
2.33 +
2.34 +import root.*;
2.35 +
2.36 +
2.37 +public class TestDupInternalNames extends BaseTest {
2.38 + public static void main(String[] argv) {
2.39 + TestDupInternalNames o = new TestDupInternalNames();
2.40 + if (argv.length > 0)
2.41 + o.setDocumentDir(argv[0]);
2.42 + try {
2.43 + o.run();
2.44 + } catch (Exception e) {
2.45 + e.printStackTrace();
2.46 + System.exit(1);
2.47 + }
2.48 + System.exit(0);
2.49 + }
2.50 +
2.51 + public void run() throws Exception {
2.52 + Root dupInternalNames;
2.53 +
2.54 + this.readDocument();
2.55 +
2.56 + out("creating the bean graph");
2.57 + dupInternalNames = Root.read(doc);
2.58 +
2.59 + // Check that we can read the graph an it is complete
2.60 + out("bean graph created");
2.61 + dupInternalNames.write(out);
2.62 +
2.63 + AnalogInput in = dupInternalNames.getIn();
2.64 + in.setPointNumber(new BigInteger("5"));
2.65 + AnalogOutput o = dupInternalNames.getOut();
2.66 + o.setPointNumber(new BigInteger("89"));
2.67 + dupInternalNames.write(out);
2.68 + }
2.69 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/schema2beans/test/unit/src/data/TestDupInternalNames.xml Sun Aug 07 00:32:00 2005 +0000
3.3 @@ -0,0 +1,16 @@
3.4 +<root xmlns='http://multitrode.com/config'>
3.5 + <in>
3.6 + <pointNumber longname='#345'>1</pointNumber>
3.7 + <subelement>
3.8 + <a>2.3</a>
3.9 + <b>7</b>
3.10 + </subelement>
3.11 + </in>
3.12 + <out>
3.13 + <pointNumber longname='#45'>-9</pointNumber>
3.14 + <subelement>
3.15 + <a>bar</a>
3.16 + <c>90</c>
3.17 + </subelement>
3.18 + </out>
3.19 +</root>
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/schema2beans/test/unit/src/data/TestDupInternalNames.xsd Sun Aug 07 00:32:00 2005 +0000
4.3 @@ -0,0 +1,59 @@
4.4 +<?xml version="1.0" encoding="UTF-8"?>
4.5 +<xs:schema targetNamespace="http://multitrode.com/config"
4.6 + xmlns="http://multitrode.com/config"
4.7 + xmlns:xs="http://www.w3.org/2001/XMLSchema"
4.8 + elementFormDefault="qualified">
4.9 +
4.10 +<xs:element name="root">
4.11 + <xs:complexType>
4.12 + <xs:sequence>
4.13 + <xs:element name="in" type="analogInput"/>
4.14 + <xs:element name="out" type="analogOutput"/>
4.15 + </xs:sequence>
4.16 + </xs:complexType>
4.17 +</xs:element>
4.18 +
4.19 +<xs:complexType name="analogInput">
4.20 +<xs:all>
4.21 +<xs:element default="0" name="pointNumber">
4.22 + <xs:complexType>
4.23 + <xs:simpleContent>
4.24 + <xs:extension base="xs:integer">
4.25 + <xs:attribute default="Point Number" name="longname" type="xs:string"/>
4.26 + </xs:extension>
4.27 + </xs:simpleContent>
4.28 + </xs:complexType>
4.29 +</xs:element>
4.30 +<xs:element name="subelement">
4.31 + <xs:complexType>
4.32 + <xs:sequence>
4.33 + <xs:element name="a" type="xsd:double"/>
4.34 + <xs:element name="b" type="xsd:int"/>
4.35 + </xs:sequence>
4.36 + </xs:complexType>
4.37 +</xs:element>
4.38 +</xs:all>
4.39 +</xs:complexType>
4.40 +<xs:complexType name="analogOutput">
4.41 +<xs:all>
4.42 +<xs:element default="0" name="pointNumber">
4.43 + <xs:complexType>
4.44 + <xs:simpleContent>
4.45 + <xs:extension base="xs:integer">
4.46 + <xs:attribute default="Point Number" name="longname" type="xs:string"/>
4.47 + </xs:extension>
4.48 + </xs:simpleContent>
4.49 + </xs:complexType>
4.50 +</xs:element>
4.51 +<xs:element name="subelement">
4.52 + <xs:complexType>
4.53 + <xs:sequence>
4.54 + <xs:element name="a" type="xsd:string"/>
4.55 + <xs:element name="c" type="xsd:int"/>
4.56 + </xs:sequence>
4.57 + </xs:complexType>
4.58 +</xs:element>
4.59 +</xs:all>
4.60 +</xs:complexType>
4.61 +
4.62 +</xs:schema>
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testDupInternalNames.pass Sun Aug 07 00:32:00 2005 +0000
5.3 @@ -0,0 +1,56 @@
5.4 +Calling GenBeans.doIt
5.5 +Bean Tree:
5.6 +root <root> : Root
5.7 + in <in> : AnalogInput
5.8 + pointNumber <pointNumber> : java.math.BigInteger
5.9 + [attr: longname CDATA #IMPLIED Point Number : java.lang.String]
5.10 + subelement <subelement> : Subelement
5.11 + a <a> : double
5.12 + b <b> : int
5.13 + out <out> : AnalogOutput
5.14 + pointNumber <pointNumber> : java.math.BigInteger
5.15 + [attr: longname CDATA #IMPLIED Point Number : java.lang.String]
5.16 + subelement <subelement> : SubelementAnalogOutput
5.17 + a <a> : java.lang.String
5.18 + c <c> : int
5.19 +
5.20 +Compiling
5.21 +Finished compiling: 0
5.22 +out: TestDupInternalNames - creating the DOM document
5.23 +out: TestDupInternalNames - creating the bean graph
5.24 +out: TestDupInternalNames - bean graph created
5.25 +out: <?xml version='1.0' encoding='UTF-8' ?>
5.26 +out: <root xmlns='http://multitrode.com/config'>
5.27 +out: <in>
5.28 +out: <pointNumber longname='#345'>1</pointNumber>
5.29 +out: <subelement>
5.30 +out: <a>2.3</a>
5.31 +out: <b>7</b>
5.32 +out: </subelement>
5.33 +out: </in>
5.34 +out: <out>
5.35 +out: <pointNumber longname='#45'>-9</pointNumber>
5.36 +out: <subelement>
5.37 +out: <a>bar</a>
5.38 +out: <c>90</c>
5.39 +out: </subelement>
5.40 +out: </out>
5.41 +out: </root>
5.42 +out: <?xml version='1.0' encoding='UTF-8' ?>
5.43 +out: <root xmlns='http://multitrode.com/config'>
5.44 +out: <in>
5.45 +out: <pointNumber longname='#345'>5</pointNumber>
5.46 +out: <subelement>
5.47 +out: <a>2.3</a>
5.48 +out: <b>7</b>
5.49 +out: </subelement>
5.50 +out: </in>
5.51 +out: <out>
5.52 +out: <pointNumber longname='#45'>89</pointNumber>
5.53 +out: <subelement>
5.54 +out: <a>bar</a>
5.55 +out: <c>90</c>
5.56 +out: </subelement>
5.57 +out: </out>
5.58 +out: </root>
5.59 +Finished running TestDupInternalNames: 0
6.1 --- a/schema2beans/test/unit/src/data/goldenfiles/TestMain/testNamespace.pass Wed Aug 03 20:37:05 2005 +0000
6.2 +++ b/schema2beans/test/unit/src/data/goldenfiles/TestMain/testNamespace.pass Sun Aug 07 00:32:00 2005 +0000
6.3 @@ -28,7 +28,7 @@
6.4 out: <config-property-type>int</config-property-type>
6.5 out: <description>now - birthday in years</description>
6.6 out: </config-property>
6.7 -out: <more-info xmlns:simple='http://anything.org/simple'>
6.8 +out: <more-info xmlns:sns='http://anything.org/simple'>
6.9 out: </more-info>
6.10 out: </namespaceSample>
6.11 out: TestNamespace - Changed description
6.12 @@ -40,7 +40,7 @@
6.13 out: <config-property-type>int</config-property-type>
6.14 out: <description>"now - birthday" (units: year)</description>
6.15 out: </config-property>
6.16 -out: <more-info xmlns:simple='http://anything.org/simple'>
6.17 +out: <more-info xmlns:sns='http://anything.org/simple'>
6.18 out: </more-info>
6.19 out: </namespaceSample>
6.20 Finished running TestNamespace: 0