You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2007/04/27 00:46:36 UTC

svn commit: r532896 - in /xmlbeans/trunk: src/store/org/apache/xmlbeans/impl/store/ test/cases/xbean/compile/scomp/schemacompiler/ test/cases/xbean/compile/scomp/schemacompiler/ext/ test/src/compile/scomp/detailed/

Author: cezar
Date: Thu Apr 26 15:46:34 2007
New Revision: 532896

URL: http://svn.apache.org/viewvc?view=rev&rev=532896
Log:
Adding test cases for JIRA XMLBEANS-205 and XMLBEANS-278.


Added:
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H1.java
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H2.java
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I1.java
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I2.java
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsd_
    xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsdconfig_
Modified:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java
    xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java?view=diff&rev=532896&r1=532895&r2=532896
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java Thu Apr 26 15:46:34 2007
@@ -1739,8 +1739,8 @@
         //
 
         private static final int _initialBufSize = 4096;
-        private static final int TextLengthCdataThreshold = 32;
-        private static final int EntitizeCharsCountCdataThreshold = 5;
+        private int _cdataLengthThreshold = 32;
+        private int _cdataEntityCountThreshold = 5;
 
         private int _lastEmitIn;
         private int _lastEmitCch;
@@ -1749,9 +1749,6 @@
         private int    _in;
         private int    _out;
         private char[] _buf;
-
-        private int _cdataLengthThreshold = 32;
-        private int _cdataEntityCountThreshold = 5;
     }
 
     static final class OptimizedForSpeedSaver

Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H1.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H1.java?view=auto&rev=532896
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H1.java (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H1.java Thu Apr 26 15:46:34 2007
@@ -0,0 +1,8 @@
+package ext;
+
+public class H1
+{
+    public static void get(org.apache.xmlbeans.XmlObject xo)
+    {
+    }
+}
\ No newline at end of file

Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H2.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H2.java?view=auto&rev=532896
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H2.java (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/H2.java Thu Apr 26 15:46:34 2007
@@ -0,0 +1,9 @@
+package ext;
+
+public class H2
+{
+    public static String get(org.apache.xmlbeans.XmlObject xo)
+    {
+        return null;
+    }
+}
\ No newline at end of file

Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I1.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I1.java?view=auto&rev=532896
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I1.java (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I1.java Thu Apr 26 15:46:34 2007
@@ -0,0 +1,6 @@
+package ext;
+
+public interface I1
+{
+    public void get();
+}
\ No newline at end of file

Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I2.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I2.java?view=auto&rev=532896
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I2.java (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/ext/I2.java Thu Apr 26 15:46:34 2007
@@ -0,0 +1,6 @@
+package ext;
+
+public interface I2
+{
+    public String get();
+}
\ No newline at end of file

Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsd_
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsd_?view=auto&rev=532896
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsd_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsd_ Thu Apr 26 15:46:34 2007
@@ -0,0 +1,37 @@
+<xs:schema targetNamespace="methodsColide_jira205_278"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:po="methodsColide_jira205_278"
+    elementFormDefault="qualified">
+	<xs:element name="purchase-order" type="po:purchaseOrder"/>
+	<xs:complexType name="purchaseOrder">
+			<xs:sequence>
+				<xs:element name="customer" type="po:customer"/>
+				<!--xs:element name="date" type="xs:dateTime" />
+				<xs:element name="line-item" type="po:line-item" minOccurs="0" maxOccurs="unbounded"/>
+				<xs:element name="shipper" type="po:shipper" minOccurs="0"/-->
+				<xs:element name="date" type="xs:dateTime" />
+				<xs:element name="line-item" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+			</xs:sequence>
+	</xs:complexType>
+
+    <xs:complexType name="customer">
+		<xs:sequence>
+			<xs:element name="name" type="xs:string"/>
+			<xs:element name="address" type="xs:string"/>
+		</xs:sequence>
+	</xs:complexType>
+	<!--xs:complexType name="line-item">
+		<xs:sequence>
+			<xs:element name="description" type="xs:string"/>
+			<xs:element name="per-unit-ounces" type="xs:decimal"/>
+			<xs:element name="price" type="xs:double"/>
+			<xs:element name="quantity" type="xs:int"/>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="shipper">
+		<xs:sequence>
+			<xs:element name="name" type="xs:string"/>
+			<xs:element name="per-ounce-rate" type="xs:decimal"/>
+		</xs:sequence>
+	</xs:complexType-->
+</xs:schema>
\ No newline at end of file

Added: xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsdconfig_
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsdconfig_?view=auto&rev=532896
==============================================================================
--- xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsdconfig_ (added)
+++ xmlbeans/trunk/test/cases/xbean/compile/scomp/schemacompiler/methodsColide_jira205_278.xsdconfig_ Thu Apr 26 15:46:34 2007
@@ -0,0 +1,17 @@
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
+
+    <xb:extension for="methodsColide_jira205_278.PurchaseOrder">
+        <xb:interface name="ext.I1">
+            <xb:staticHandler>ext.H1</xb:staticHandler>
+        </xb:interface>
+    </xb:extension>
+
+
+    <xb:extension for="methodsColide_jira205_278.Customer">
+        <xb:interface name="ext.I2">
+            <xb:staticHandler>ext.H2</xb:staticHandler>
+        </xb:interface>
+    </xb:extension>
+
+</xb:config>
+

Modified: xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java?view=diff&rev=532896&r1=532895&r2=532896
==============================================================================
--- xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java (original)
+++ xmlbeans/trunk/test/src/compile/scomp/detailed/SchemaCompilerTests.java Thu Apr 26 15:46:34 2007
@@ -105,4 +105,68 @@
         String testname = "testEnumerationRedefine3";
         _testCompile(xsdFiles, outputDirName, testname);
     }
+
+    /**
+     * [XMLBEANS-205]:
+     * using static handlers for extension interfaces with same method names
+     */
+    public void testExtensionHandlerMethodNameCollision()
+    {
+        File[] xsdFiles =
+            new File[] { new File(scompTestFilesRoot + "methodsColide_jira205_278.xsd_") };
+        File[] configFiles =
+            new File[] { new File(scompTestFilesRoot + "methodsColide_jira205_278.xsdconfig_") };
+        File[] javaFiles =
+            new File[] { new File(scompTestFilesRoot + "ext" + P + "I1.java"),
+                         new File(scompTestFilesRoot + "ext" + P + "H1.java"),
+                         new File(scompTestFilesRoot + "ext" + P + "I2.java"),
+                         new File(scompTestFilesRoot + "ext" + P + "H2.java")};
+        String outputDirName = "methodsColide_jira205";
+
+        List errors = new ArrayList();
+        SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+        params.setXsdFiles(xsdFiles);
+        params.setConfigFiles(configFiles);
+        params.setJavaFiles(javaFiles);
+        params.setErrorListener(errors);
+        params.setSrcDir(new File(schemaCompOutputDirPath + outputDirName + P + "src"));
+        params.setClassesDir(new File(schemaCompOutputDirPath + outputDirName + P + "classes"));
+
+        SchemaCompiler.compile(params);
+        if (printOptionErrMsgs(errors))
+        {
+            fail("testExtensionHandlerMethodNameCollision(): failure when executing scomp");
+        }
+    }
+
+    /**
+     * [XMLBEANS-278]:
+     * -noext flag for compilation
+     */
+    public void testNoExt()
+    {
+        File[] xsdFiles =
+            new File[] { new File(scompTestFilesRoot + "methodsColide_jira205_278.xsd_") };
+        File[] configFiles =
+            new File[] { new File(scompTestFilesRoot + "methodsColide_jira205_278.xsdconfig_") };
+        String outputDirName = "noExt";
+
+        List errors = new ArrayList();
+        SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+        params.setXsdFiles(xsdFiles);
+        params.setConfigFiles(configFiles);
+        // no java files, if noExt flag doesn't work should fail for not finding the java files  params.setJavaFiles(javaFiles);
+        params.setErrorListener(errors);
+        params.setSrcDir(new File(schemaCompOutputDirPath + outputDirName + P + "src"));
+        params.setClassesDir(new File(schemaCompOutputDirPath + outputDirName + P + "classes"));
+
+        // no extensions
+        params.setNoExt(true);
+
+        SchemaCompiler.compile(params);
+        if (printOptionErrMsgs(errors))
+        {
+            fail("testNoExt(): failure when executing scomp");
+        }
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org