Author: fanningpj
Date: Sun Feb 21 21:48:26 2021
New Revision: 1886772

URL: http://svn.apache.org/viewvc?rev=1886772&view=rev
Log:
change line endings

Modified:
    xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java
    xmlbeans/trunk/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java
    
xmlbeans/trunk/src/test/java/compile/scomp/detailed/XmlBeanCompilationTests.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression1_50Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression201_250Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression251_300Test.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression50_100Test.java
    
xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionSchemaCompilerTest.java
    xmlbeans/trunk/src/test/java/misc/detailed/JiraRegressionTest101_150.java

Modified: 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java?rev=1886772&r1=1886771&r2=1886772&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java 
(original)
+++ xmlbeans/trunk/src/test/java/compile/scomp/detailed/DetailedCompTests.java 
Sun Feb 21 21:48:26 2021
@@ -1,282 +1,282 @@
-/*   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package compile.scomp.detailed;
-
-import compile.scomp.common.CompileCommon;
-import org.apache.xmlbeans.*;
-import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
-import org.junit.Test;
-
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import static org.junit.Assert.*;
-
-
-public class DetailedCompTests {
-    /**
-     * This test requires laxDoc.xsd to be compiled and
-     * on the classpath ahead of time, otherwise documentation
-     * element processing would not occur
-     * @throws Exception
-     */
-    @Test
-    public void testLaxDocProcessing() throws Exception {
-        QName q = new QName("urn:lax.Doc.Compilation", "ItemRequest");
-        ArrayList err = new ArrayList();
-        XmlOptions xm_opt = new XmlOptions().setErrorListener(err);
-        xm_opt.setSavePrettyPrint();
-
-        XmlObject xObj = XmlObject.Factory.parse(
-                new File(CompileCommon.fileLocation+"/detailed/laxDoc.xsd"));
-        XmlObject[] schemas = new XmlObject[]{xObj};
-
-
-        // ensure exception is thrown when
-        // xmloptions flag is not set
-        boolean valDocEx = false;
-        try{
-            SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null,
-                schemas, null, XmlBeans.getBuiltinTypeSystem(), null, xm_opt);
-            assertNotNull("STS was null", sts);
-        }catch(XmlException xmlEx){
-            valDocEx = true;
-            System.err.println("Expected Error: "+xmlEx.getMessage());
-        } catch(Exception e){
-            throw e;
-        }
-
-        //check exception was thrown
-        if(!valDocEx)
-            throw new Exception("Documentation processing " +
-                    "should have thrown and error");
-        // validate error code
-        valDocEx = false;
-        for (Iterator iterator = err.iterator(); iterator.hasNext();) {
-            XmlError xErr = (XmlError)iterator.next();
-            //System.out.println("ERROR: '"+ xErr+"'");
-            //any one of these are possible
-            if(xErr.getErrorCode().compareTo("cvc-complex-type.4") == 0 ||
-                    xErr.getErrorCode().compareTo("cvc-complex-type.2.3") == 0 
||
-                    xErr.getErrorCode().compareTo("cvc-complex-type.2.4c") == 
0)
-                valDocEx = true;
-        }
-
-        if (!valDocEx)
-            throw new Exception("Expected Error code did not validate");
-
-        //reset errors
-        err.clear();
-
-        //ensure no exception when error
-        xm_opt = xm_opt.setCompileNoValidation();
-        try {
-            SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null,
-                    schemas, null, XmlBeans.getBuiltinTypeSystem(), null,
-                    xm_opt);
-
-            if(!err.isEmpty())
-                throw new Exception("Error listener should be empty");
-
-            for (Iterator iterator = err.iterator(); iterator.hasNext();) {
-                System.out.println(iterator.next());
-            }
-
-            SchemaGlobalElement sge = sts.findElement(q);
-            System.out.println("QName: " + sge.getName());
-            System.out.println("Type: " + sge.getType());
-
-
-        } catch (Exception e) {
-            throw e;
-        }
-
-    }
-
-    private static final String schema_begin = "<xs:schema 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\";>\n";
-    private static final String root_decl    = "<xs:element name=\"root\">\n  
<xs:complexType>\n";
-    private static final String att_decl     = "    <xs:attribute name=\"att\" 
type=\"simpleNotType\"/>\n";
-    private static final String root_end     = "  
</xs:complexType>\n</xs:element>\n";
-    private static final String schema_end   = "</xs:schema>\n";
-
-    private static final String notation1    = "    <xs:attribute name=\"att\" 
type=\"xs:NOTATION\"/>\n";
-    private static final String notation2    = "<xs:simpleType 
name=\"simpleNotType\">\n" +
-                                               "  <xs:restriction 
base=\"xs:NOTATION\">\n" +
-                                               "    <xs:pattern 
value=\"ns:.*\"/>\n" +
-                                               "  
</xs:restriction>\n</xs:simpleType>\n";
-    private static final String notation3    = "    <xs:sequence>\n      " +
-                                               "<xs:element name=\"elem\" 
type=\"xs:ID\"/>\n" +
-                                               "    </xs:sequence>\n";
-    private static final String notation4    = " 
targetNamespace=\"scomp.detailed.CompilationTests\" " +
-                                               
"xmlns=\"scomp.detailed.CompilationTests\">\n";
-    private static final String simpleTypeDef= "<xs:simpleType 
name=\"simpleNotType\">\n" +
-                                               "  <xs:restriction 
base=\"enumDef\">\n";
-    private static final String notation6    = "    <xs:pattern 
value=\"ns:.*\"/>\n";
-    private static final String notation5    = "    <xs:length 
value=\"6\"/>\n";
-    private static final String enumDef      = "  
</xs:restriction>\n</xs:simpleType>\n" +
-                                               "<xs:simpleType 
name=\"enumDef\">\n" +
-                                               "  <xs:restriction 
base=\"xs:NOTATION\" xmlns:ns=\"namespace.notation\">\n" +
-                                               "    <xs:enumeration 
value=\"ns:app1\"/>\n" +
-                                               "    <xs:enumeration 
value=\"ns:app2\"/>\n" +
-                                               "  
</xs:restriction>\n</xs:simpleType>\n";
-
-    private static final String doc_begin    = "<root 
xmlns:ns=\"namespace.notation\" " +
-                                               
"xmlns:app=\"namespace.notation\" att=\"";
-    private static final String doc_end      = "\"/>";
-    private static final String notation7    = "ns1:app1";
-    private static final String notation8    = "ns:app";
-    private static final String notation9    = "app:app1";
-    private static final String notation10   = "ns:app1";
-
-    /**
-     * This tests usage of the xs:NOTATION type
-     */
-    @Test
-    public void testNotation() throws Exception
-    {
-        String schema;
-        String xml;
-        SchemaTypeSystem typeSystem;
-        XmlObject[] parsedSchema = new XmlObject[1];
-        XmlObject parsedDoc;
-        XmlOptions opts = new XmlOptions();
-        ArrayList errors = new ArrayList();
-        opts.setErrorListener(errors);
-        opts.setCompilePartialTypesystem();
-
-        // 1. Negative test - Error if xs:NOTATION used directly
-        schema = schema_begin + root_decl + notation1 + root_end + schema_end;
-//        System.out.println(schema);
-        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
-        errors.clear();
-        XmlBeans.compileXsd(parsedSchema, null, opts);
-        assertTrue("Expected error: NOTATION type cannot be used directly", 
errors.size() == 1);
-        assertEquals("Expected error: NOTATION type cannot be used directly",
-            XmlErrorCodes.ATTR_NOTATION_TYPE_FORBIDDEN, 
((XmlError)errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_ERROR, 
((XmlError)errors.get(0)).getSeverity());
-
-        // 2. Negative test - Error if xs:NOTATION restricted without 
enumeration
-        schema = schema_begin + root_decl + att_decl + root_end + notation2 + 
schema_end;
-//        System.out.println(schema);
-        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
-        errors.clear();
-        XmlBeans.compileXsd(parsedSchema, null, opts);
-        assertTrue("Expected error: restriction of NOTATION must use 
enumeration facet", errors.size() == 1);
-        assertEquals("Expected error: restriction of NOTATION must use 
enumeration facet",
-            XmlErrorCodes.DATATYPE_ENUM_NOTATION, 
((XmlError)errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_ERROR, 
((XmlError)errors.get(0)).getSeverity());
-
-        // 3. Warning if xs:NOTATION used as type of an element
-        final String correctTypes = simpleTypeDef + notation6 + enumDef;
-        schema = schema_begin + root_decl + notation3 + root_end + 
correctTypes + schema_end;
-//        System.out.println(schema);
-        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
-        errors.clear();
-        XmlBeans.compileXsd(parsedSchema, null, opts);
-        assertTrue("Expected warning: NOTATION-derived type should not be used 
on elements", errors.size() == 1);
-        assertEquals("Expected warning: NOTATION-derived type should not be 
used on elements",
-            XmlErrorCodes.ELEM_COMPATIBILITY_TYPE, 
((XmlError)errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_WARNING, 
((XmlError)errors.get(0)).getSeverity());
-
-        // 4. Warning if xs:NOTATION is used in a Schema with target namespace
-        schema = schema_begin.substring(0, schema_begin.length() - 2) + 
notation4 + root_decl +
-            att_decl + root_end + correctTypes + schema_end;
-//        System.out.println(schema);
-        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
-        errors.clear();
-        XmlBeans.compileXsd(parsedSchema, null, opts);
-        assertTrue("Expected warning: NOTATION-derived type should not be used 
in a Schema with target namespace", errors.size() == 1);
-        assertEquals("Expected warning: NOTATION-derived type should not be 
used in a Schema with target namespace",
-            XmlErrorCodes.ATTR_COMPATIBILITY_TARGETNS, 
((XmlError)errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_WARNING, 
((XmlError)errors.get(0)).getSeverity());
-
-        // 5. Warning - Deprecation of minLength, maxLength and length facets
-        schema = schema_begin + root_decl + att_decl + root_end + 
simpleTypeDef + notation5 +
-            enumDef + schema_end;
-//        System.out.println(schema);
-        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
-        errors.clear();
-        XmlBeans.compileXsd(parsedSchema, null, opts);
-        assertTrue("Expected warning: length facet cannot be used on a type 
derived from NOTATION", errors.size() == 1);
-        assertEquals("Expected warning: length facet cannot be used on a type 
derived from NOTATION",
-            XmlErrorCodes.FACETS_DEPRECATED_NOTATION, 
((XmlError)errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_WARNING, 
((XmlError)errors.get(0)).getSeverity());
-
-        // 6. Positive test - Test restriction via enumeration, then same as 2
-        schema = schema_begin + root_decl + att_decl + root_end + correctTypes 
+ schema_end;
-//        System.out.println(schema);
-        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
-        errors.clear();
-        typeSystem = XmlBeans.compileXsd(parsedSchema, null, opts);
-        assertTrue("Expected no errors or warnings", errors.size() == 0);
-        SchemaType docType = typeSystem.findDocumentType(new QName("", 
"root"));
-        SchemaType type = docType.getElementProperty(new QName("", 
"root")).getType().
-            getAttributeProperty(new QName("", "att")).getType();
-        assertEquals(type.getPrimitiveType().getBuiltinTypeCode(), 
SchemaType.BTC_NOTATION);
-
-        SchemaTypeLoader loader = XmlBeans.typeLoaderUnion(new 
SchemaTypeLoader[] {typeSystem,
-            XmlBeans.getBuiltinTypeSystem()});
-
-        // 7. Validation negative - Test error if QName has bad prefix
-        xml = doc_begin + notation7 + doc_end;
-        parsedDoc = loader.parse(xml, null, opts);
-        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
-        errors.clear();
-        parsedDoc.validate(opts);
-        // Both "prefix not found" and "pattern doesn't match" errors
-        assertTrue("Expected validation errors", errors.size() == 2);
-        // Unfortunately, can't get the error code because it is logged via an 
intermediate exception
-        assertTrue("Expected prefix not found error", ((XmlError) 
errors.get(0)).getMessage().
-            indexOf("Invalid QName") >= 0);
-        assertEquals(XmlError.SEVERITY_ERROR, ((XmlError) 
errors.get(0)).getSeverity());
-//        System.out.println(xml);
-
-        // 8. Validation negative - Test error if QName has correct prefix but 
not in enumeration
-        xml = doc_begin + notation8 + doc_end;
-        parsedDoc = loader.parse(xml, null, opts);
-        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
-        errors.clear();
-        parsedDoc.validate(opts);
-        assertTrue("Expected validation errors", errors.size() == 1);
-        assertEquals("Expected prefix not found error", 
XmlErrorCodes.DATATYPE_ENUM_VALID,
-            ((XmlError) errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_ERROR, ((XmlError) 
errors.get(0)).getSeverity());
-//        System.out.println(xml);
-
-        // 9. Validation negative - Test error if QName doesn't match the 
extra facet
-        xml = doc_begin + notation9 + doc_end;
-        parsedDoc = loader.parse(xml, null, opts);
-        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
-        errors.clear();
-        parsedDoc.validate(opts);
-        assertTrue("Expected validation errors", errors.size() == 1);
-        assertEquals("Expected prefix not found error", 
XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID,
-            ((XmlError) errors.get(0)).getErrorCode());
-        assertEquals(XmlError.SEVERITY_ERROR, ((XmlError) 
errors.get(0)).getSeverity());
-//        System.out.println(xml);
-
-        // 10. Validation positive - Test that validation can be performed 
correctly
-        xml = doc_begin + notation10 + doc_end;
-        parsedDoc = loader.parse(xml, null, opts);
-        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
-        errors.clear();
-        parsedDoc.validate(opts);
-        assertTrue("Expected no validation errors", errors.size() == 0);
-//        System.out.println(xml);
-    }
-}
+/*   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package compile.scomp.detailed;
+
+import compile.scomp.common.CompileCommon;
+import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
+import org.junit.Test;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import static org.junit.Assert.*;
+
+
+public class DetailedCompTests {
+    /**
+     * This test requires laxDoc.xsd to be compiled and
+     * on the classpath ahead of time, otherwise documentation
+     * element processing would not occur
+     * @throws Exception
+     */
+    @Test
+    public void testLaxDocProcessing() throws Exception {
+        QName q = new QName("urn:lax.Doc.Compilation", "ItemRequest");
+        ArrayList err = new ArrayList();
+        XmlOptions xm_opt = new XmlOptions().setErrorListener(err);
+        xm_opt.setSavePrettyPrint();
+
+        XmlObject xObj = XmlObject.Factory.parse(
+                new File(CompileCommon.fileLocation+"/detailed/laxDoc.xsd"));
+        XmlObject[] schemas = new XmlObject[]{xObj};
+
+
+        // ensure exception is thrown when
+        // xmloptions flag is not set
+        boolean valDocEx = false;
+        try{
+            SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null,
+                schemas, null, XmlBeans.getBuiltinTypeSystem(), null, xm_opt);
+            assertNotNull("STS was null", sts);
+        }catch(XmlException xmlEx){
+            valDocEx = true;
+            System.err.println("Expected Error: "+xmlEx.getMessage());
+        } catch(Exception e){
+            throw e;
+        }
+
+        //check exception was thrown
+        if(!valDocEx)
+            throw new Exception("Documentation processing " +
+                    "should have thrown and error");
+        // validate error code
+        valDocEx = false;
+        for (Iterator iterator = err.iterator(); iterator.hasNext();) {
+            XmlError xErr = (XmlError)iterator.next();
+            //System.out.println("ERROR: '"+ xErr+"'");
+            //any one of these are possible
+            if(xErr.getErrorCode().compareTo("cvc-complex-type.4") == 0 ||
+                    xErr.getErrorCode().compareTo("cvc-complex-type.2.3") == 0 
||
+                    xErr.getErrorCode().compareTo("cvc-complex-type.2.4c") == 
0)
+                valDocEx = true;
+        }
+
+        if (!valDocEx)
+            throw new Exception("Expected Error code did not validate");
+
+        //reset errors
+        err.clear();
+
+        //ensure no exception when error
+        xm_opt = xm_opt.setCompileNoValidation();
+        try {
+            SchemaTypeSystem sts = XmlBeans.compileXmlBeans(null, null,
+                    schemas, null, XmlBeans.getBuiltinTypeSystem(), null,
+                    xm_opt);
+
+            if(!err.isEmpty())
+                throw new Exception("Error listener should be empty");
+
+            for (Iterator iterator = err.iterator(); iterator.hasNext();) {
+                System.out.println(iterator.next());
+            }
+
+            SchemaGlobalElement sge = sts.findElement(q);
+            System.out.println("QName: " + sge.getName());
+            System.out.println("Type: " + sge.getType());
+
+
+        } catch (Exception e) {
+            throw e;
+        }
+
+    }
+
+    private static final String schema_begin = "<xs:schema 
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\";>\n";
+    private static final String root_decl    = "<xs:element name=\"root\">\n  
<xs:complexType>\n";
+    private static final String att_decl     = "    <xs:attribute name=\"att\" 
type=\"simpleNotType\"/>\n";
+    private static final String root_end     = "  
</xs:complexType>\n</xs:element>\n";
+    private static final String schema_end   = "</xs:schema>\n";
+
+    private static final String notation1    = "    <xs:attribute name=\"att\" 
type=\"xs:NOTATION\"/>\n";
+    private static final String notation2    = "<xs:simpleType 
name=\"simpleNotType\">\n" +
+                                               "  <xs:restriction 
base=\"xs:NOTATION\">\n" +
+                                               "    <xs:pattern 
value=\"ns:.*\"/>\n" +
+                                               "  
</xs:restriction>\n</xs:simpleType>\n";
+    private static final String notation3    = "    <xs:sequence>\n      " +
+                                               "<xs:element name=\"elem\" 
type=\"xs:ID\"/>\n" +
+                                               "    </xs:sequence>\n";
+    private static final String notation4    = " 
targetNamespace=\"scomp.detailed.CompilationTests\" " +
+                                               
"xmlns=\"scomp.detailed.CompilationTests\">\n";
+    private static final String simpleTypeDef= "<xs:simpleType 
name=\"simpleNotType\">\n" +
+                                               "  <xs:restriction 
base=\"enumDef\">\n";
+    private static final String notation6    = "    <xs:pattern 
value=\"ns:.*\"/>\n";
+    private static final String notation5    = "    <xs:length 
value=\"6\"/>\n";
+    private static final String enumDef      = "  
</xs:restriction>\n</xs:simpleType>\n" +
+                                               "<xs:simpleType 
name=\"enumDef\">\n" +
+                                               "  <xs:restriction 
base=\"xs:NOTATION\" xmlns:ns=\"namespace.notation\">\n" +
+                                               "    <xs:enumeration 
value=\"ns:app1\"/>\n" +
+                                               "    <xs:enumeration 
value=\"ns:app2\"/>\n" +
+                                               "  
</xs:restriction>\n</xs:simpleType>\n";
+
+    private static final String doc_begin    = "<root 
xmlns:ns=\"namespace.notation\" " +
+                                               
"xmlns:app=\"namespace.notation\" att=\"";
+    private static final String doc_end      = "\"/>";
+    private static final String notation7    = "ns1:app1";
+    private static final String notation8    = "ns:app";
+    private static final String notation9    = "app:app1";
+    private static final String notation10   = "ns:app1";
+
+    /**
+     * This tests usage of the xs:NOTATION type
+     */
+    @Test
+    public void testNotation() throws Exception
+    {
+        String schema;
+        String xml;
+        SchemaTypeSystem typeSystem;
+        XmlObject[] parsedSchema = new XmlObject[1];
+        XmlObject parsedDoc;
+        XmlOptions opts = new XmlOptions();
+        ArrayList errors = new ArrayList();
+        opts.setErrorListener(errors);
+        opts.setCompilePartialTypesystem();
+
+        // 1. Negative test - Error if xs:NOTATION used directly
+        schema = schema_begin + root_decl + notation1 + root_end + schema_end;
+//        System.out.println(schema);
+        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+        errors.clear();
+        XmlBeans.compileXsd(parsedSchema, null, opts);
+        assertTrue("Expected error: NOTATION type cannot be used directly", 
errors.size() == 1);
+        assertEquals("Expected error: NOTATION type cannot be used directly",
+            XmlErrorCodes.ATTR_NOTATION_TYPE_FORBIDDEN, 
((XmlError)errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_ERROR, 
((XmlError)errors.get(0)).getSeverity());
+
+        // 2. Negative test - Error if xs:NOTATION restricted without 
enumeration
+        schema = schema_begin + root_decl + att_decl + root_end + notation2 + 
schema_end;
+//        System.out.println(schema);
+        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+        errors.clear();
+        XmlBeans.compileXsd(parsedSchema, null, opts);
+        assertTrue("Expected error: restriction of NOTATION must use 
enumeration facet", errors.size() == 1);
+        assertEquals("Expected error: restriction of NOTATION must use 
enumeration facet",
+            XmlErrorCodes.DATATYPE_ENUM_NOTATION, 
((XmlError)errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_ERROR, 
((XmlError)errors.get(0)).getSeverity());
+
+        // 3. Warning if xs:NOTATION used as type of an element
+        final String correctTypes = simpleTypeDef + notation6 + enumDef;
+        schema = schema_begin + root_decl + notation3 + root_end + 
correctTypes + schema_end;
+//        System.out.println(schema);
+        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+        errors.clear();
+        XmlBeans.compileXsd(parsedSchema, null, opts);
+        assertTrue("Expected warning: NOTATION-derived type should not be used 
on elements", errors.size() == 1);
+        assertEquals("Expected warning: NOTATION-derived type should not be 
used on elements",
+            XmlErrorCodes.ELEM_COMPATIBILITY_TYPE, 
((XmlError)errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_WARNING, 
((XmlError)errors.get(0)).getSeverity());
+
+        // 4. Warning if xs:NOTATION is used in a Schema with target namespace
+        schema = schema_begin.substring(0, schema_begin.length() - 2) + 
notation4 + root_decl +
+            att_decl + root_end + correctTypes + schema_end;
+//        System.out.println(schema);
+        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+        errors.clear();
+        XmlBeans.compileXsd(parsedSchema, null, opts);
+        assertTrue("Expected warning: NOTATION-derived type should not be used 
in a Schema with target namespace", errors.size() == 1);
+        assertEquals("Expected warning: NOTATION-derived type should not be 
used in a Schema with target namespace",
+            XmlErrorCodes.ATTR_COMPATIBILITY_TARGETNS, 
((XmlError)errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_WARNING, 
((XmlError)errors.get(0)).getSeverity());
+
+        // 5. Warning - Deprecation of minLength, maxLength and length facets
+        schema = schema_begin + root_decl + att_decl + root_end + 
simpleTypeDef + notation5 +
+            enumDef + schema_end;
+//        System.out.println(schema);
+        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+        errors.clear();
+        XmlBeans.compileXsd(parsedSchema, null, opts);
+        assertTrue("Expected warning: length facet cannot be used on a type 
derived from NOTATION", errors.size() == 1);
+        assertEquals("Expected warning: length facet cannot be used on a type 
derived from NOTATION",
+            XmlErrorCodes.FACETS_DEPRECATED_NOTATION, 
((XmlError)errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_WARNING, 
((XmlError)errors.get(0)).getSeverity());
+
+        // 6. Positive test - Test restriction via enumeration, then same as 2
+        schema = schema_begin + root_decl + att_decl + root_end + correctTypes 
+ schema_end;
+//        System.out.println(schema);
+        parsedSchema[0] = SchemaDocument.Factory.parse(schema);
+        errors.clear();
+        typeSystem = XmlBeans.compileXsd(parsedSchema, null, opts);
+        assertTrue("Expected no errors or warnings", errors.size() == 0);
+        SchemaType docType = typeSystem.findDocumentType(new QName("", 
"root"));
+        SchemaType type = docType.getElementProperty(new QName("", 
"root")).getType().
+            getAttributeProperty(new QName("", "att")).getType();
+        assertEquals(type.getPrimitiveType().getBuiltinTypeCode(), 
SchemaType.BTC_NOTATION);
+
+        SchemaTypeLoader loader = XmlBeans.typeLoaderUnion(new 
SchemaTypeLoader[] {typeSystem,
+            XmlBeans.getBuiltinTypeSystem()});
+
+        // 7. Validation negative - Test error if QName has bad prefix
+        xml = doc_begin + notation7 + doc_end;
+        parsedDoc = loader.parse(xml, null, opts);
+        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
+        errors.clear();
+        parsedDoc.validate(opts);
+        // Both "prefix not found" and "pattern doesn't match" errors
+        assertTrue("Expected validation errors", errors.size() == 2);
+        // Unfortunately, can't get the error code because it is logged via an 
intermediate exception
+        assertTrue("Expected prefix not found error", ((XmlError) 
errors.get(0)).getMessage().
+            indexOf("Invalid QName") >= 0);
+        assertEquals(XmlError.SEVERITY_ERROR, ((XmlError) 
errors.get(0)).getSeverity());
+//        System.out.println(xml);
+
+        // 8. Validation negative - Test error if QName has correct prefix but 
not in enumeration
+        xml = doc_begin + notation8 + doc_end;
+        parsedDoc = loader.parse(xml, null, opts);
+        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
+        errors.clear();
+        parsedDoc.validate(opts);
+        assertTrue("Expected validation errors", errors.size() == 1);
+        assertEquals("Expected prefix not found error", 
XmlErrorCodes.DATATYPE_ENUM_VALID,
+            ((XmlError) errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_ERROR, ((XmlError) 
errors.get(0)).getSeverity());
+//        System.out.println(xml);
+
+        // 9. Validation negative - Test error if QName doesn't match the 
extra facet
+        xml = doc_begin + notation9 + doc_end;
+        parsedDoc = loader.parse(xml, null, opts);
+        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
+        errors.clear();
+        parsedDoc.validate(opts);
+        assertTrue("Expected validation errors", errors.size() == 1);
+        assertEquals("Expected prefix not found error", 
XmlErrorCodes.DATATYPE_VALID$PATTERN_VALID,
+            ((XmlError) errors.get(0)).getErrorCode());
+        assertEquals(XmlError.SEVERITY_ERROR, ((XmlError) 
errors.get(0)).getSeverity());
+//        System.out.println(xml);
+
+        // 10. Validation positive - Test that validation can be performed 
correctly
+        xml = doc_begin + notation10 + doc_end;
+        parsedDoc = loader.parse(xml, null, opts);
+        assertEquals("Did not find the root element in the Schema", docType, 
parsedDoc.schemaType());
+        errors.clear();
+        parsedDoc.validate(opts);
+        assertTrue("Expected no validation errors", errors.size() == 0);
+//        System.out.println(xml);
+    }
+}

Modified: 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java?rev=1886772&r1=1886771&r2=1886772&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java 
(original)
+++ 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/SchemaCompilerTests.java 
Sun Feb 21 21:48:26 2021
@@ -1,176 +1,176 @@
-/*   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package compile.scomp.detailed;
-
-import common.Common;
-import org.apache.xmlbeans.impl.tool.Parameters;
-import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.fail;
-
-/**
- * This class contains tests that need to invoke the SchemaCompiler class 
which is
- * equivalent to using scomp from the command line and capture errors
- *
- * The tests need to be run with cmd line param that points to the test case 
root directory and xmlbeans root
- * ex: -Dcases.location=D:\svnnew\xmlbeans\trunk\test\cases 
-Dxbean.rootdir=D:\svnnew\xmlbeans\trunk
- */
-public class SchemaCompilerTests extends Common
-{
-    public static String scompTestFilesRoot = XBEAN_CASE_ROOT + P + "compile" 
+ P + "scomp" + P + "schemacompiler" + P;
-    public static String schemaCompOutputDirPath = OUTPUTROOT + P + "compile" 
+ P + "scomp" + P;
-
-    private void _testCompile(File[] xsdFiles,
-                              String outputDirName,
-                              String testName)
-    {
-        List errors = new ArrayList();
-        Parameters params = new Parameters();
-        params.setXsdFiles(xsdFiles);
-        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(testName + "(): failure when executing scomp");
-        }
-    }
-
-    @Test
-    public void testUnionRedefine()
-    {
-        File[] xsdFiles =
-            new File[] { new File(scompTestFilesRoot + "union_initial.xsd"),
-                         new File(scompTestFilesRoot + "union_redefine.xsd") };
-        String outputDirName = "unionred";
-        String testname = "testUnionRedefine";
-        _testCompile(xsdFiles, outputDirName, testname);
-    }
-
-    /** This tests a bug where compilation of a schema redefining a type
-        involving an enumeration fails.
-     */
-    @Test
-    public void testEnumerationRedefine1()
-    {
-        File[] xsdFiles =
-            new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
-                         new File(scompTestFilesRoot + "enum1_redefine.xsd_") 
};
-        String outputDirName = "enumRedef1";
-        String testname = "testEnumerationRedefine1";
-        _testCompile(xsdFiles, outputDirName, testname);
-    }
-
-    /** This tests a bug where compilation of a schema redefining a type
-        involving an enumeration fails.
-     */
-    @Test
-    public void testEnumerationRedefine2()
-    {
-        File[] xsdFiles =
-            new File[] { new File(scompTestFilesRoot + "enum2.xsd_"),
-                         new File(scompTestFilesRoot + "enum2_redefine.xsd_") 
};
-        String outputDirName = "enumRedef2";
-        String testname = "testEnumerationRedefine2";
-        _testCompile(xsdFiles, outputDirName, testname);
-    }
-
-    /** This tests a bug where compilation of a schema redefining a type
-        involving an enumeration fails.
-     */
-    @Test
-    public void testEnumerationRedefine3()
-    {
-        File[] xsdFiles =
-            new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
-                         new File(scompTestFilesRoot + "enum3.xsd_"),
-                         new File(scompTestFilesRoot + "enum3_redefine.xsd_") 
};
-        String outputDirName = "enumRedef3";
-        String testname = "testEnumerationRedefine3";
-        _testCompile(xsdFiles, outputDirName, testname);
-    }
-
-    /**
-     * [XMLBEANS-205]:
-     * using static handlers for extension interfaces with same method names
-     */
-    @Test
-    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();
-        Parameters params = new 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
-     */
-    @Test
-    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();
-        Parameters params = new 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");
-        }
-    }
-}
+/*   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package compile.scomp.detailed;
+
+import common.Common;
+import org.apache.xmlbeans.impl.tool.Parameters;
+import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.fail;
+
+/**
+ * This class contains tests that need to invoke the SchemaCompiler class 
which is
+ * equivalent to using scomp from the command line and capture errors
+ *
+ * The tests need to be run with cmd line param that points to the test case 
root directory and xmlbeans root
+ * ex: -Dcases.location=D:\svnnew\xmlbeans\trunk\test\cases 
-Dxbean.rootdir=D:\svnnew\xmlbeans\trunk
+ */
+public class SchemaCompilerTests extends Common
+{
+    public static String scompTestFilesRoot = XBEAN_CASE_ROOT + P + "compile" 
+ P + "scomp" + P + "schemacompiler" + P;
+    public static String schemaCompOutputDirPath = OUTPUTROOT + P + "compile" 
+ P + "scomp" + P;
+
+    private void _testCompile(File[] xsdFiles,
+                              String outputDirName,
+                              String testName)
+    {
+        List errors = new ArrayList();
+        Parameters params = new Parameters();
+        params.setXsdFiles(xsdFiles);
+        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(testName + "(): failure when executing scomp");
+        }
+    }
+
+    @Test
+    public void testUnionRedefine()
+    {
+        File[] xsdFiles =
+            new File[] { new File(scompTestFilesRoot + "union_initial.xsd"),
+                         new File(scompTestFilesRoot + "union_redefine.xsd") };
+        String outputDirName = "unionred";
+        String testname = "testUnionRedefine";
+        _testCompile(xsdFiles, outputDirName, testname);
+    }
+
+    /** This tests a bug where compilation of a schema redefining a type
+        involving an enumeration fails.
+     */
+    @Test
+    public void testEnumerationRedefine1()
+    {
+        File[] xsdFiles =
+            new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
+                         new File(scompTestFilesRoot + "enum1_redefine.xsd_") 
};
+        String outputDirName = "enumRedef1";
+        String testname = "testEnumerationRedefine1";
+        _testCompile(xsdFiles, outputDirName, testname);
+    }
+
+    /** This tests a bug where compilation of a schema redefining a type
+        involving an enumeration fails.
+     */
+    @Test
+    public void testEnumerationRedefine2()
+    {
+        File[] xsdFiles =
+            new File[] { new File(scompTestFilesRoot + "enum2.xsd_"),
+                         new File(scompTestFilesRoot + "enum2_redefine.xsd_") 
};
+        String outputDirName = "enumRedef2";
+        String testname = "testEnumerationRedefine2";
+        _testCompile(xsdFiles, outputDirName, testname);
+    }
+
+    /** This tests a bug where compilation of a schema redefining a type
+        involving an enumeration fails.
+     */
+    @Test
+    public void testEnumerationRedefine3()
+    {
+        File[] xsdFiles =
+            new File[] { new File(scompTestFilesRoot + "enum1.xsd_"),
+                         new File(scompTestFilesRoot + "enum3.xsd_"),
+                         new File(scompTestFilesRoot + "enum3_redefine.xsd_") 
};
+        String outputDirName = "enumRedef3";
+        String testname = "testEnumerationRedefine3";
+        _testCompile(xsdFiles, outputDirName, testname);
+    }
+
+    /**
+     * [XMLBEANS-205]:
+     * using static handlers for extension interfaces with same method names
+     */
+    @Test
+    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();
+        Parameters params = new 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
+     */
+    @Test
+    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();
+        Parameters params = new 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");
+        }
+    }
+}

Modified: 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/XmlBeanCompilationTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/compile/scomp/detailed/XmlBeanCompilationTests.java?rev=1886772&r1=1886771&r2=1886772&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/XmlBeanCompilationTests.java
 (original)
+++ 
xmlbeans/trunk/src/test/java/compile/scomp/detailed/XmlBeanCompilationTests.java
 Sun Feb 21 21:48:26 2021
@@ -1,310 +1,310 @@
-/*   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package compile.scomp.detailed;
-
-import compile.scomp.common.CompileTestBase;
-import compile.scomp.common.mockobj.TestBindingConfig;
-import compile.scomp.common.mockobj.TestFiler;
-import org.apache.xmlbeans.*;
-import org.apache.xmlbeans.impl.xb.xmlconfig.ConfigDocument;
-import org.junit.After;
-import org.junit.Test;
-
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
-
-/**
- * Ensure that several compilation mechanisms all generate
- * the same schematypesystem
- */
-public class XmlBeanCompilationTests extends CompileTestBase {
-    private final List<XmlError> xm_errors = new ArrayList<>();
-    private final XmlOptions xm_opts = new XmlOptions();
-
-    public XmlBeanCompilationTests() {
-        xm_opts.setErrorListener(xm_errors);
-        xm_opts.setSavePrettyPrint();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        if (xm_errors.size() > 0) {
-            xm_errors.clear();
-        }
-    }
-
-    /**
-     * Filer != null for BindingConfig to be used
-     */
-    @Test
-    public void test_bindingconfig_extension_compilation() throws Exception {
-        TestFiler f = new TestFiler();
-        //initialize all of the values
-        String extCaseDir = XBEAN_CASE_ROOT + P + "extensions" + P;
-        String extSrcDir = getRootFile() + P +
-                           "src" + P + "test" + P + "java" + P + "xmlobject" + 
P + "extensions" + P;
-        File[] cPath = CompileTestBase.getClassPath();
-        String dir = extCaseDir + P + "interfaceFeature" + P + "averageCase";
-        String dir2 = extCaseDir + P + "prePostFeature" + P +
-                      "ValueRestriction";
-
-        ConfigDocument.Config bConf = ConfigDocument.Factory.parse(
-            new File(dir + P + "po.xsdconfig"))
-            .getConfig();
-        ConfigDocument.Config cConf = ConfigDocument.Factory.parse(
-            new File(dir2 + P + "company.xsdconfig"))
-            .getConfig();
-
-        String simpleConfig = "<xb:config " +
-                              
"xmlns:xb=\"http://xml.apache.org/xmlbeans/2004/02/xbean/config\"\n"; +
-                              " 
xmlns:ep=\"http://xbean.interface_feature/averageCase/PurchaseOrder\";>\n" +
-                              "<xb:namespace 
uri=\"http://xbean.interface_feature/averageCase/PurchaseOrder\";>\n" +
-                              "<xb:package>com.easypo</xb:package>\n" +
-                              "</xb:namespace></xb:config>";
-        ConfigDocument.Config confDoc = 
ConfigDocument.Factory.parse(simpleConfig).getConfig();
-        ConfigDocument.Config[] confs = new ConfigDocument.Config[]{bConf, 
confDoc, cConf};
-
-        String fooHandlerPath = extSrcDir + P + "interfaceFeature" + P +
-                                "averageCase" + P + "existing" + P + 
"FooHandler.java";
-        String iFooPath = extSrcDir + P + "interfaceFeature" + P +
-                          "averageCase" + P + "existing" + P + "IFoo.java";
-        String iSetterPath = extSrcDir + P + "prePostFeature" + P +
-                             "ValueRestriction" + P + "existing" + P + 
"ISetter.java";
-        String setterHandlerPath = extSrcDir + P + "prePostFeature" + P +
-                                   "ValueRestriction" + P + "existing" + P + 
"SetterHandler.java";
-
-
-        File[] fList = new File[]{new File(fooHandlerPath), new File(iFooPath),
-            new File(iSetterPath),
-            new File(setterHandlerPath)};
-
-        //use created BindingConfig
-        TestBindingConfig bind = new TestBindingConfig(confs, fList, cPath);
-
-        //set XSDs
-        XmlObject obj1 = XmlObject.Factory.parse(new File(dir + P + "po.xsd"));
-        XmlObject obj2 = XmlObject.Factory.parse(
-            new File(dir2 + P + "company.xsd"));
-        XmlObject[] schemas = new XmlObject[]{obj1, obj2};
-
-        //filer must be present on this method
-        SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans("apiCompile", null,
-            schemas, bind, XmlBeans.getBuiltinTypeSystem(), f, xm_opts);
-
-        if (!bind.isIslookupPrefixForNamespace()) {
-            throw new Exception("isIslookupPrefixForNamespace not invoked");
-        }
-        if (!bind.isIslookupPackageForNamespace()) {
-            throw new Exception("isIslookupPackageForNamespace not invoked");
-        }
-        if (!bind.isIslookupSuffixForNamespace()) {
-            throw new Exception("isIslookupSuffixForNamespace not invoked");
-        }
-        if (!bind.isIslookupJavanameForQName()) {
-            throw new Exception("isIslookupJavanameForQName not invoked");
-        }
-        if (!bind.isIsgetInterfaceExtensionsString()) {
-            throw new Exception("isIsgetInterfaceExtensionsString not 
invoked");
-        }
-        if (!bind.isIsgetInterfaceExtensions()) {
-            throw new Exception("isIsgetInterfaceExtensions not invoked");
-        }
-        if (!bind.isIsgetPrePostExtensions()) {
-            throw new Exception("isIsgetPrePostExtensions not invoked");
-        }
-        if (!bind.isIsgetPrePostExtensionsString()) {
-            throw new Exception("isIsgetPrePostExtensionsString not invoked");
-        }
-    }
-
-    /**
-     * Verify basic incremental compilation
-     * and compilation with partial SOM usages
-     */
-    @Test
-    public void test_incrCompile() throws Exception {
-        XmlObject obj1 = XmlObject.Factory.parse(forXsd);
-        obj1.documentProperties().setSourceName("OBJ1");
-        XmlObject[] schemas = new XmlObject[]{obj1};
-        QName sts1 = new QName("http://baz";, "elName");
-
-        XmlObject obj2 = XmlObject.Factory.parse(incrXsd);
-        obj2.documentProperties().setSourceName("OBJ2");
-        XmlObject[] schemas2 = new XmlObject[]{obj2};
-        QName sts2 = new QName("http://bar";, "elName");
-
-        XmlObject obj3 = XmlObject.Factory.parse(errXsd);
-        obj3.documentProperties().setSourceName("OBJ3");
-        XmlObject[] schemas3 = new XmlObject[]{obj3};
-        QName sts3 = new QName("http://bar";, "elErrName");
-
-        SchemaTypeSystem sts;
-        ArrayList err = new ArrayList();
-        XmlOptions opt = new XmlOptions().setErrorListener(err);
-        opt.setCompilePartialTypesystem();
-
-        //BASIC COMPILATION
-        sts = XmlBeans.compileXmlBeans(null,
-            null, schemas, null,
-            XmlBeans.getBuiltinTypeSystem(), null, opt);
-
-        assertTrue("Errors should have been empty", err.isEmpty());
-        // find element in the type System
-        if (!findGlobalElement(sts.globalElements(), sts1)) {
-            throw new Exception(
-                "Could Not find Type from first Type System: " + sts1);
-        }
-
-        //SIMPLE INCR COMPILATION
-        sts = XmlBeans.compileXmlBeans(null,
-            sts, schemas2, null,
-            XmlBeans.getBuiltinTypeSystem(), null, opt);
-        assertTrue("Errors should have been empty", err.isEmpty());
-        // find element in the type System
-
-        if (!findGlobalElement(sts.globalElements(), sts1)) {
-            throw new Exception("Could Not find Type from first Type System: " 
+
-                                sts1);
-        }
-
-        if (!findGlobalElement(sts.globalElements(), sts2)) {
-            throw new Exception("Could Not find Type from 2nd Type System: " +
-                                sts2);
-        }
-
-        System.out.println("Building over Existing");
-        //BUILDING OFF BASE SIMPLE INCR COMPILATION
-        sts = XmlBeans.compileXmlBeans(null,
-            sts, schemas2, null,
-            sts, null, opt);
-        assertTrue("Errors should have been empty", err.isEmpty());
-        // find element in the type System
-
-        if (!findGlobalElement(sts.globalElements(), sts1)) {
-            throw new Exception("Could Not find Type from first Type System: " 
+
-                                sts1);
-        }
-
-        if (!findGlobalElement(sts.globalElements(), sts2)) {
-            throw new Exception("Could Not find Type from 2nd Type System: " +
-                                sts2);
-        }
-
-        //INCR COMPILATION WITH RECOVERABLE ERROR
-        err.clear();
-        SchemaTypeSystem b = XmlBeans.compileXmlBeans(null,
-            sts, schemas3, null,
-            XmlBeans.getBuiltinTypeSystem(), null, opt);
-        // find element in the type System
-        if (!findGlobalElement(b.globalElements(), sts1)) {
-            throw new Exception("Could Not find Type from first Type System: " 
+
-                                sts1);
-        }
-
-        if (!findGlobalElement(b.globalElements(), sts2)) {
-            throw new Exception("Could Not find Type from 2nd Type System: " +
-                                sts2);
-        }
-
-        if (!findGlobalElement(b.globalElements(), sts3)) {
-            throw new Exception("Could Not find Type from 3rd Type System: " +
-                                sts3);
-        }
-
-        printSTS(b);
-
-        //INSPECT ERRORS
-        boolean psom_expError = false;
-        // print out the recovered xm_errors
-        if (!err.isEmpty()) {
-            System.out.println(
-                "Schema invalid: partial schema type system recovered");
-            for (Iterator i = err.iterator(); i.hasNext(); ) {
-                XmlError xErr = (XmlError) i.next();
-                System.out.println(xErr);
-                //compare to the expected xm_errors
-                if ((xErr.getErrorCode().compareTo("src-resolve") == 0) &&
-                    (xErr.getMessage().compareTo(
-                        "type 'bType@http://baz' not found.") ==
-                     0)) {
-                    psom_expError = true;
-                }
-            }
-        }
-        if (!psom_expError) {
-            throw new Exception("Error Code was not as Expected");
-        }
-
-
-    }
-
-/*
-    @Test
-    public void test_diff_compilationMethods() throws IOException,
-        XmlException, Exception {
-
-
-        //initialize the schema compiler
-        SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
-        params.setXsdFiles(new File[]{scompFile});
-        params.setSrcDir(scompDirFile);
-        params.setClassesDir(scompDirFile);
-
-        //save out schema for use in scomp later
-        XmlObject obj1 = XmlObject.Factory.parse(forXsd);
-        obj1.save(scompFile);
-
-        //scomp saved out schema
-        SchemaCompiler.compile(params);
-
-        //use new api to get typesystem
-        XmlObject[] schemas = new XmlObject[]{obj1};
-        SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans("apiCompile", null,
-            schemas, null, XmlBeans.getBuiltinTypeSystem(), null, xm_opts);
-
-        //use alternative api to get typesystem
-        SchemaTypeSystem altSts = XmlBeans.compileXsd(schemas,
-            XmlBeans.getBuiltinTypeSystem(), null);
-
-        //save out sts for diff later
-        SchemaCodeGenerator.saveTypeSystem(apiSts, apiDirFile, null, null,
-            null);
-        SchemaCodeGenerator.saveTypeSystem(altSts, baseDirFile, null, null,
-            null);
-
-        //diff new api to old api
-        xm_errors = null;
-        xm_errors = new ArrayList();
-        Diff.dirsAsTypeSystems(apiDirFile, baseDirFile, xm_errors);
-        if (xm_errors.size() >= 1)
-            throw new Exception("API STS ERRORS: " + xm_errors.toString());
-
-        //diff scomp sts to new api
-        xm_errors = null;
-        xm_errors = new ArrayList();
-        Diff.dirsAsTypeSystems(apiDirFile, scompDirFile, xm_errors);
-        if (xm_errors.size() >= 1)
-            throw new Exception("API SCOMP ERRORS: " + xm_errors.toString());
-    }
-*/
-
-}
+/*   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package compile.scomp.detailed;
+
+import compile.scomp.common.CompileTestBase;
+import compile.scomp.common.mockobj.TestBindingConfig;
+import compile.scomp.common.mockobj.TestFiler;
+import org.apache.xmlbeans.*;
+import org.apache.xmlbeans.impl.xb.xmlconfig.ConfigDocument;
+import org.junit.After;
+import org.junit.Test;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Ensure that several compilation mechanisms all generate
+ * the same schematypesystem
+ */
+public class XmlBeanCompilationTests extends CompileTestBase {
+    private final List<XmlError> xm_errors = new ArrayList<>();
+    private final XmlOptions xm_opts = new XmlOptions();
+
+    public XmlBeanCompilationTests() {
+        xm_opts.setErrorListener(xm_errors);
+        xm_opts.setSavePrettyPrint();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (xm_errors.size() > 0) {
+            xm_errors.clear();
+        }
+    }
+
+    /**
+     * Filer != null for BindingConfig to be used
+     */
+    @Test
+    public void test_bindingconfig_extension_compilation() throws Exception {
+        TestFiler f = new TestFiler();
+        //initialize all of the values
+        String extCaseDir = XBEAN_CASE_ROOT + P + "extensions" + P;
+        String extSrcDir = getRootFile() + P +
+                           "src" + P + "test" + P + "java" + P + "xmlobject" + 
P + "extensions" + P;
+        File[] cPath = CompileTestBase.getClassPath();
+        String dir = extCaseDir + P + "interfaceFeature" + P + "averageCase";
+        String dir2 = extCaseDir + P + "prePostFeature" + P +
+                      "ValueRestriction";
+
+        ConfigDocument.Config bConf = ConfigDocument.Factory.parse(
+            new File(dir + P + "po.xsdconfig"))
+            .getConfig();
+        ConfigDocument.Config cConf = ConfigDocument.Factory.parse(
+            new File(dir2 + P + "company.xsdconfig"))
+            .getConfig();
+
+        String simpleConfig = "<xb:config " +
+                              
"xmlns:xb=\"http://xml.apache.org/xmlbeans/2004/02/xbean/config\"\n"; +
+                              " 
xmlns:ep=\"http://xbean.interface_feature/averageCase/PurchaseOrder\";>\n" +
+                              "<xb:namespace 
uri=\"http://xbean.interface_feature/averageCase/PurchaseOrder\";>\n" +
+                              "<xb:package>com.easypo</xb:package>\n" +
+                              "</xb:namespace></xb:config>";
+        ConfigDocument.Config confDoc = 
ConfigDocument.Factory.parse(simpleConfig).getConfig();
+        ConfigDocument.Config[] confs = new ConfigDocument.Config[]{bConf, 
confDoc, cConf};
+
+        String fooHandlerPath = extSrcDir + P + "interfaceFeature" + P +
+                                "averageCase" + P + "existing" + P + 
"FooHandler.java";
+        String iFooPath = extSrcDir + P + "interfaceFeature" + P +
+                          "averageCase" + P + "existing" + P + "IFoo.java";
+        String iSetterPath = extSrcDir + P + "prePostFeature" + P +
+                             "ValueRestriction" + P + "existing" + P + 
"ISetter.java";
+        String setterHandlerPath = extSrcDir + P + "prePostFeature" + P +
+                                   "ValueRestriction" + P + "existing" + P + 
"SetterHandler.java";
+
+
+        File[] fList = new File[]{new File(fooHandlerPath), new File(iFooPath),
+            new File(iSetterPath),
+            new File(setterHandlerPath)};
+
+        //use created BindingConfig
+        TestBindingConfig bind = new TestBindingConfig(confs, fList, cPath);
+
+        //set XSDs
+        XmlObject obj1 = XmlObject.Factory.parse(new File(dir + P + "po.xsd"));
+        XmlObject obj2 = XmlObject.Factory.parse(
+            new File(dir2 + P + "company.xsd"));
+        XmlObject[] schemas = new XmlObject[]{obj1, obj2};
+
+        //filer must be present on this method
+        SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans("apiCompile", null,
+            schemas, bind, XmlBeans.getBuiltinTypeSystem(), f, xm_opts);
+
+        if (!bind.isIslookupPrefixForNamespace()) {
+            throw new Exception("isIslookupPrefixForNamespace not invoked");
+        }
+        if (!bind.isIslookupPackageForNamespace()) {
+            throw new Exception("isIslookupPackageForNamespace not invoked");
+        }
+        if (!bind.isIslookupSuffixForNamespace()) {
+            throw new Exception("isIslookupSuffixForNamespace not invoked");
+        }
+        if (!bind.isIslookupJavanameForQName()) {
+            throw new Exception("isIslookupJavanameForQName not invoked");
+        }
+        if (!bind.isIsgetInterfaceExtensionsString()) {
+            throw new Exception("isIsgetInterfaceExtensionsString not 
invoked");
+        }
+        if (!bind.isIsgetInterfaceExtensions()) {
+            throw new Exception("isIsgetInterfaceExtensions not invoked");
+        }
+        if (!bind.isIsgetPrePostExtensions()) {
+            throw new Exception("isIsgetPrePostExtensions not invoked");
+        }
+        if (!bind.isIsgetPrePostExtensionsString()) {
+            throw new Exception("isIsgetPrePostExtensionsString not invoked");
+        }
+    }
+
+    /**
+     * Verify basic incremental compilation
+     * and compilation with partial SOM usages
+     */
+    @Test
+    public void test_incrCompile() throws Exception {
+        XmlObject obj1 = XmlObject.Factory.parse(forXsd);
+        obj1.documentProperties().setSourceName("OBJ1");
+        XmlObject[] schemas = new XmlObject[]{obj1};
+        QName sts1 = new QName("http://baz";, "elName");
+
+        XmlObject obj2 = XmlObject.Factory.parse(incrXsd);
+        obj2.documentProperties().setSourceName("OBJ2");
+        XmlObject[] schemas2 = new XmlObject[]{obj2};
+        QName sts2 = new QName("http://bar";, "elName");
+
+        XmlObject obj3 = XmlObject.Factory.parse(errXsd);
+        obj3.documentProperties().setSourceName("OBJ3");
+        XmlObject[] schemas3 = new XmlObject[]{obj3};
+        QName sts3 = new QName("http://bar";, "elErrName");
+
+        SchemaTypeSystem sts;
+        ArrayList err = new ArrayList();
+        XmlOptions opt = new XmlOptions().setErrorListener(err);
+        opt.setCompilePartialTypesystem();
+
+        //BASIC COMPILATION
+        sts = XmlBeans.compileXmlBeans(null,
+            null, schemas, null,
+            XmlBeans.getBuiltinTypeSystem(), null, opt);
+
+        assertTrue("Errors should have been empty", err.isEmpty());
+        // find element in the type System
+        if (!findGlobalElement(sts.globalElements(), sts1)) {
+            throw new Exception(
+                "Could Not find Type from first Type System: " + sts1);
+        }
+
+        //SIMPLE INCR COMPILATION
+        sts = XmlBeans.compileXmlBeans(null,
+            sts, schemas2, null,
+            XmlBeans.getBuiltinTypeSystem(), null, opt);
+        assertTrue("Errors should have been empty", err.isEmpty());
+        // find element in the type System
+
+        if (!findGlobalElement(sts.globalElements(), sts1)) {
+            throw new Exception("Could Not find Type from first Type System: " 
+
+                                sts1);
+        }
+
+        if (!findGlobalElement(sts.globalElements(), sts2)) {
+            throw new Exception("Could Not find Type from 2nd Type System: " +
+                                sts2);
+        }
+
+        System.out.println("Building over Existing");
+        //BUILDING OFF BASE SIMPLE INCR COMPILATION
+        sts = XmlBeans.compileXmlBeans(null,
+            sts, schemas2, null,
+            sts, null, opt);
+        assertTrue("Errors should have been empty", err.isEmpty());
+        // find element in the type System
+
+        if (!findGlobalElement(sts.globalElements(), sts1)) {
+            throw new Exception("Could Not find Type from first Type System: " 
+
+                                sts1);
+        }
+
+        if (!findGlobalElement(sts.globalElements(), sts2)) {
+            throw new Exception("Could Not find Type from 2nd Type System: " +
+                                sts2);
+        }
+
+        //INCR COMPILATION WITH RECOVERABLE ERROR
+        err.clear();
+        SchemaTypeSystem b = XmlBeans.compileXmlBeans(null,
+            sts, schemas3, null,
+            XmlBeans.getBuiltinTypeSystem(), null, opt);
+        // find element in the type System
+        if (!findGlobalElement(b.globalElements(), sts1)) {
+            throw new Exception("Could Not find Type from first Type System: " 
+
+                                sts1);
+        }
+
+        if (!findGlobalElement(b.globalElements(), sts2)) {
+            throw new Exception("Could Not find Type from 2nd Type System: " +
+                                sts2);
+        }
+
+        if (!findGlobalElement(b.globalElements(), sts3)) {
+            throw new Exception("Could Not find Type from 3rd Type System: " +
+                                sts3);
+        }
+
+        printSTS(b);
+
+        //INSPECT ERRORS
+        boolean psom_expError = false;
+        // print out the recovered xm_errors
+        if (!err.isEmpty()) {
+            System.out.println(
+                "Schema invalid: partial schema type system recovered");
+            for (Iterator i = err.iterator(); i.hasNext(); ) {
+                XmlError xErr = (XmlError) i.next();
+                System.out.println(xErr);
+                //compare to the expected xm_errors
+                if ((xErr.getErrorCode().compareTo("src-resolve") == 0) &&
+                    (xErr.getMessage().compareTo(
+                        "type 'bType@http://baz' not found.") ==
+                     0)) {
+                    psom_expError = true;
+                }
+            }
+        }
+        if (!psom_expError) {
+            throw new Exception("Error Code was not as Expected");
+        }
+
+
+    }
+
+/*
+    @Test
+    public void test_diff_compilationMethods() throws IOException,
+        XmlException, Exception {
+
+
+        //initialize the schema compiler
+        SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+        params.setXsdFiles(new File[]{scompFile});
+        params.setSrcDir(scompDirFile);
+        params.setClassesDir(scompDirFile);
+
+        //save out schema for use in scomp later
+        XmlObject obj1 = XmlObject.Factory.parse(forXsd);
+        obj1.save(scompFile);
+
+        //scomp saved out schema
+        SchemaCompiler.compile(params);
+
+        //use new api to get typesystem
+        XmlObject[] schemas = new XmlObject[]{obj1};
+        SchemaTypeSystem apiSts = XmlBeans.compileXmlBeans("apiCompile", null,
+            schemas, null, XmlBeans.getBuiltinTypeSystem(), null, xm_opts);
+
+        //use alternative api to get typesystem
+        SchemaTypeSystem altSts = XmlBeans.compileXsd(schemas,
+            XmlBeans.getBuiltinTypeSystem(), null);
+
+        //save out sts for diff later
+        SchemaCodeGenerator.saveTypeSystem(apiSts, apiDirFile, null, null,
+            null);
+        SchemaCodeGenerator.saveTypeSystem(altSts, baseDirFile, null, null,
+            null);
+
+        //diff new api to old api
+        xm_errors = null;
+        xm_errors = new ArrayList();
+        Diff.dirsAsTypeSystems(apiDirFile, baseDirFile, xm_errors);
+        if (xm_errors.size() >= 1)
+            throw new Exception("API STS ERRORS: " + xm_errors.toString());
+
+        //diff scomp sts to new api
+        xm_errors = null;
+        xm_errors = new ArrayList();
+        Diff.dirsAsTypeSystems(apiDirFile, scompDirFile, xm_errors);
+        if (xm_errors.size() >= 1)
+            throw new Exception("API SCOMP ERRORS: " + xm_errors.toString());
+    }
+*/
+
+}

Modified: 
xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java?rev=1886772&r1=1886771&r2=1886772&view=diff
==============================================================================
--- xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java 
(original)
+++ xmlbeans/trunk/src/test/java/misc/detailed/JiraRegression151_200Test.java 
Sun Feb 21 21:48:26 2021
@@ -1,129 +1,129 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package misc.detailed;
-
-import misc.common.JiraTestBase;
-import net.eads.space.scoexml.test.TestExponentDocument;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.impl.tool.Parameters;
-import org.apache.xmlbeans.impl.tool.SchemaCompiler;
-import org.junit.Test;
-
-import java.io.File;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-/**
- *
- */
-public class JiraRegression151_200Test extends JiraTestBase
-{
-
-    /**
-     * [XMLBEANS-175]   Validation of decimal in exponential representation 
fails
-     * @throws Exception
-     */
-    @Test
-    public void test_jira_xmlbeans175() throws Exception{
-
-        TestExponentDocument.TestExponent exponent = 
TestExponentDocument.TestExponent.Factory.newInstance();
-        exponent.setDecimal(new BigDecimal("1E1"));
-
-        ArrayList errors = new ArrayList();
-        XmlOptions validationOptions = new XmlOptions();
-        validationOptions.setErrorListener(errors);
-        exponent.validate(validationOptions);
-
-        for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
-            System.out.println("Validation Error:" + iterator.next());
-        }
-
-        // fails, IMHO should not!
-        assertEquals(0, errors.size());
-        /* note: the following uses JDK 1.5 API, not supported in 1.4
-        // workaround
-        exponent.setDecimal(new BigDecimal(new 
BigDecimal("1E1").toPlainString()));
-        errors.removeAll(errors);
-        exponent.validate(validationOptions);
-        assertEquals(0, errors.size());
-        */
-    }
-
-    /**
-     * [XMLBEANS-179]   Saving xml with '&' and '<' characters in attribute 
values throws an ArrayIndexOutOfBoundsException
-     */
-    @Test
-    public void test_jira_xmlbeans179() throws Exception{
-        String xmlWithIssues = "<Net id=\"dbid:66754220\" name=\"3&lt;.3V\" 
type=\"POWER\"/>";
-
-        XmlObject xobj = XmlObject.Factory.parse(xmlWithIssues);
-        File outFile = new File(schemaCompOutputDirPath + P + 
"jira_xmlbeans179.xml");
-        assertNotNull(outFile);
-
-        if(outFile.exists())
-            outFile.delete();
-
-        xobj.save(outFile);
-    }
-
-    /*
-    * [XMLBEANS-184]: NPE when running scomp without nopvr option
-    */
-    @Test
-    public void test_jira_xmlbeans184() throws Exception {
-        List errors = new ArrayList();
-
-        // compile with nopvr, goes thro fine
-        Parameters params = new Parameters();
-        params.setXsdFiles(new File[]{new File(scompTestFilesRoot + 
"xmlbeans_184_vdx_data_V1.04.xsd_")});
-        params.setErrorListener(errors);
-        params.setSrcDir(schemaCompSrcDir);
-        params.setClassesDir(schemaCompClassesDir);
-        params.setNoPvr(true);
-
-        try {
-            SchemaCompiler.compile(params);
-        } catch (NullPointerException npe) {
-            npe.printStackTrace();
-            fail("NPE when executing scomp");
-        }
-
-        if (printOptionErrMsgs(errors)) {
-            fail("test_jira_xmlbeans184() : Errors found when executing 
scomp");
-        }
-
-        // now compile without the pvr option and NPE is thrown
-        params.setNoPvr(false);
-        try {
-            SchemaCompiler.compile(params);
-        } catch (NullPointerException npe) {
-            npe.printStackTrace();
-            fail("NPE when executing scomp");
-        }
-
-        if (printOptionErrMsgs(errors)) {
-            fail("test_jira_xmlbeans184() : Errors found when executing scomp 
");
-        }
-
-    }
-
-
-}
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package misc.detailed;
+
+import misc.common.JiraTestBase;
+import net.eads.space.scoexml.test.TestExponentDocument;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.apache.xmlbeans.impl.tool.Parameters;
+import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.junit.Test;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class JiraRegression151_200Test extends JiraTestBase
+{
+
+    /**
+     * [XMLBEANS-175]   Validation of decimal in exponential representation 
fails
+     * @throws Exception
+     */
+    @Test
+    public void test_jira_xmlbeans175() throws Exception{
+
+        TestExponentDocument.TestExponent exponent = 
TestExponentDocument.TestExponent.Factory.newInstance();
+        exponent.setDecimal(new BigDecimal("1E1"));
+
+        ArrayList errors = new ArrayList();
+        XmlOptions validationOptions = new XmlOptions();
+        validationOptions.setErrorListener(errors);
+        exponent.validate(validationOptions);
+
+        for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
+            System.out.println("Validation Error:" + iterator.next());
+        }
+
+        // fails, IMHO should not!
+        assertEquals(0, errors.size());
+        /* note: the following uses JDK 1.5 API, not supported in 1.4
+        // workaround
+        exponent.setDecimal(new BigDecimal(new 
BigDecimal("1E1").toPlainString()));
+        errors.removeAll(errors);
+        exponent.validate(validationOptions);
+        assertEquals(0, errors.size());
+        */
+    }
+
+    /**
+     * [XMLBEANS-179]   Saving xml with '&' and '<' characters in attribute 
values throws an ArrayIndexOutOfBoundsException
+     */
+    @Test
+    public void test_jira_xmlbeans179() throws Exception{
+        String xmlWithIssues = "<Net id=\"dbid:66754220\" name=\"3&lt;.3V\" 
type=\"POWER\"/>";
+
+        XmlObject xobj = XmlObject.Factory.parse(xmlWithIssues);
+        File outFile = new File(schemaCompOutputDirPath + P + 
"jira_xmlbeans179.xml");
+        assertNotNull(outFile);
+
+        if(outFile.exists())
+            outFile.delete();
+
+        xobj.save(outFile);
+    }
+
+    /*
+    * [XMLBEANS-184]: NPE when running scomp without nopvr option
+    */
+    @Test
+    public void test_jira_xmlbeans184() throws Exception {
+        List errors = new ArrayList();
+
+        // compile with nopvr, goes thro fine
+        Parameters params = new Parameters();
+        params.setXsdFiles(new File[]{new File(scompTestFilesRoot + 
"xmlbeans_184_vdx_data_V1.04.xsd_")});
+        params.setErrorListener(errors);
+        params.setSrcDir(schemaCompSrcDir);
+        params.setClassesDir(schemaCompClassesDir);
+        params.setNoPvr(true);
+
+        try {
+            SchemaCompiler.compile(params);
+        } catch (NullPointerException npe) {
+            npe.printStackTrace();
+            fail("NPE when executing scomp");
+        }
+
+        if (printOptionErrMsgs(errors)) {
+            fail("test_jira_xmlbeans184() : Errors found when executing 
scomp");
+        }
+
+        // now compile without the pvr option and NPE is thrown
+        params.setNoPvr(false);
+        try {
+            SchemaCompiler.compile(params);
+        } catch (NullPointerException npe) {
+            npe.printStackTrace();
+            fail("NPE when executing scomp");
+        }
+
+        if (printOptionErrMsgs(errors)) {
+            fail("test_jira_xmlbeans184() : Errors found when executing scomp 
");
+        }
+
+    }
+
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to