From commitsograham@example.net Wed Sep 01 17:27:16 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 23036 invoked from network); 1 Sep 2004 17:27:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 1 Sep 2004 17:27:16 -0000 Received: (qmail 43192 invoked by uid 500); 1 Sep 2004 17:27:15 -0000 Delivered-To: ograham@example.net Received: (qmail 43147 invoked by uid 500); 1 Sep 2004 17:27:15 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 43134 invoked by uid 500); 1 Sep 2004 17:27:15 -0000 Delivered-To: ograham@example.net Received: (qmail 43129 invoked by uid 99); 1 Sep 2004 17:27:14 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 01 Sep 2004 10:27:13 -0700 Received: (qmail 22976 invoked by uid 1737); 1 Sep 2004 17:27:12 -0000 Date: 1 Sep 2004 17:27:12 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/xmlcursor/detailed ToBookmarkTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/01 10:27:12 Modified: v2/test/cases/xbean/scomp/namespace ElementWC.xsd v2/test/src/scomp/attributes/detailed AttrGroupTest.java LocalAttrForm.java LocalAttrUse.java v2/test/src/scomp/common BaseCase.java v2/test/src/scomp/contentType/complex/detailed ElementOnlyContentTest.java v2/test/src/scomp/contentType/complex/modelGroup/detailed NestSequenceChoiceTest.java v2/test/src/scomp/contentType/simple/detailed UnionType.java v2/test/src/scomp/derivation/detailed BlockTest.java v2/test/src/scomp/derivation/restriction/detailed AttrWCRestriction.java GroupRestrictionTest.java MixedContentRestriction.java v2/test/src/scomp/derivation/restriction/facets/detailed ListRestriction.java v2/test/src/scomp/elements/detailed GlobalEltDefault.java GlobalEltNillable.java NillTest.java v2/test/src/scomp/namespace/detailed ElementWC.java v2/test/src/scomp/substGroup/restriction/detailed Block.java v2/test/src/xmlcursor/detailed ToBookmarkTest.java Added: v2/test/cases/xbean/scomp/redefine AttrRedefineSub.xs AttrRedefineSuper.xsd BaseAttrGroup.xs BaseModelGroup.xs BaseSimple.xs ModelGroupSub.xs ModelGroupSuper.xsd SimpleRedefined.xsd TypeBase.xs TypeRedefine.xsd Log: Contributed by:Yana Kadiyska. Fixing some schema feature tests Revision Changes Path 1.2 +2 -2 xml-xmlbeans/v2/test/cases/xbean/scomp/namespace/ElementWC.xsd Index: ElementWC.xsd =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/xbean/scomp/namespace/ElementWC.xsd,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ElementWC.xsd 16 Aug 2004 17:36:17 -0000 1.1 +++ ElementWC.xsd 1 Sep 2004 17:27:10 -0000 1.2 @@ -55,7 +55,7 @@ <xsd:complexType name="UriListStrictT"> <xsd:sequence> - <xsd:any namespace="http://apache.org http://w3c.org" processContents="strict" /> + <xsd:any namespace="http://xbean/scomp/element/GlobalEltDefault http://w3c.org" processContents="strict" /> </xsd:sequence> </xsd:complexType> @@ -114,7 +114,7 @@ <xsd:element name="LocalSkip" type="LocalSkipT"/> <xsd:element name="LocalStrict" type="LocalStrictT"/> - <xsd:attribute name="LocalAttr" type="xsd:int"/> + <xsd:attribute name="LocalElt" type="xsd:int"/> </xsd:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/AttrRedefineSub.xs Index: AttrRedefineSub.xs =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/AttrGroupRedefine" targetNamespace="http://xbean/scomp/redefine/AttrGroupRedefine" > <xs:redefine schemaLocation="BaseAttrGroup.xs"> <xs:attributeGroup name="AttrGroup"> <xs:attribute name="attr1" type="xs:string"/> </xs:attributeGroup> </xs:redefine> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/AttrRedefineSuper.xsd Index: AttrRedefineSuper.xsd =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/AttrGroupRedefine" targetNamespace="http://xbean/scomp/redefine/AttrGroupRedefine" > <xs:redefine schemaLocation="BaseAttrGroup.xs"> <xs:attributeGroup name="AttrGroup"> <xs:attribute name="attr1" type="xs:string"/> <xs:attribute name="attr2a" type="xs:date"/> <xs:attribute name="attr3" type="xs:int"/> </xs:attributeGroup> </xs:redefine> <xs:element name="AttrGroupElt"> <xs:complexType> <xs:attributeGroup ref="AttrGroup"/> </xs:complexType> </xs:element> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/BaseAttrGroup.xs Index: BaseAttrGroup.xs =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:attributeGroup name="AttrGroup"> <xs:attribute name="attr1" type="xs:string"/> <xs:attribute name="attr2" type="xs:int"/> <xs:attribute name="attr3" type="xs:string"/> </xs:attributeGroup> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/BaseModelGroup.xs Index: BaseModelGroup.xs =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/GroupRedefine" targetNamespace="http://xbean/scomp/redefine/GroupRedefine" xmlns:color="http://xbean/scomp/redefine/SimpleRedefined" > <xs:complexType name="GroupT"> <xs:sequence> <xs:element name="child1" type="color:ColorT" minOccurs="0"/> <xs:element name="child2" type="xs:string"/> <xs:element name="child3" type="xs:int" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/BaseSimple.xs Index: BaseSimple.xs =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:simpleType name="SizeT"> <xs:restriction base="xs:integer"/> </xs:simpleType> <xs:simpleType name="ColorT"> <xs:restriction base="xs:string"> <xs:pattern value="white|green"/> </xs:restriction> </xs:simpleType> <xs:element name="OldSizeElt" type="SizeT"/> <xs:element name="OldColorElt" type="ColorT"/> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/ModelGroupSub.xs Index: ModelGroupSub.xs =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/GroupRedefine" targetNamespace="http://xbean/scomp/redefine/GroupRedefine" > <xs:redefine schemaLocation="BaseModelGroup.xs"> <xs:complexType name="GroupT"> <xs:complexContent> <xs:restriction base="GroupT"> <xs:sequence> <xs:element name="child2" type="xs:string"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="GroupSubElt" type="GroupT"/> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/ModelGroupSuper.xsd Index: ModelGroupSuper.xsd =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/GroupRedefine" targetNamespace="http://xbean/scomp/redefine/GroupRedefine" xmlns:color="http://xbean/scomp/redefine/SimpleRedefined" > <!-- <xs:redefine schemaLocation="ModelGroupSub.xs"> <xs:complexType name="GroupT"> <xs:complexContent> <xs:extension base="GroupT"> <xs:sequence> <xs:element name="child2" type="xs:string"/> <xs:element name="child3" type="color:ColorT"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="GroupSuperElt" type="GroupT"/> --> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/SimpleRedefined.xsd Index: SimpleRedefined.xsd =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/SimpleRedefined" targetNamespace="http://xbean/scomp/redefine/SimpleRedefined" > <xs:redefine schemaLocation="BaseSimple.xs"> <xs:simpleType name="SizeT"> <xs:restriction base="SizeT"> <xs:minInclusive value="3"/> <xs:maxInclusive value="20"/> </xs:restriction> </xs:simpleType> </xs:redefine> <xs:element name="NewSizeElt" type="SizeT"/> </xs:schema> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/TypeBase.xs Index: TypeBase.xs =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/TypeBase" targetNamespace="http://xbean/scomp/redefine/TypeBase" /> 1.1 xml-xmlbeans/v2/test/cases/xbean/scomp/redefine/TypeRedefine.xsd Index: TypeRedefine.xsd =================================================================== <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xbean/scomp/redefine/TypeRedefine" targetNamespace="http://xbean/scomp/redefine/TypeRedefine" /> 1.4 +3 -1 xml-xmlbeans/v2/test/src/scomp/attributes/detailed/AttrGroupTest.java Index: AttrGroupTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/attributes/detailed/AttrGroupTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AttrGroupTest.java 25 Aug 2004 20:58:56 -0000 1.3 +++ AttrGroupTest.java 1 Sep 2004 17:27:11 -0000 1.4 @@ -48,7 +48,9 @@ cur.toNextToken(); cur.insertAttribute(new QName("http://org.apache.sample", "attr", "pre")); - String[] errExpected=new String[]{"cvc-attr"}; + String[] errExpected=new String[]{ + XmlErrorCodes + .ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE}; assertTrue( !doc.validate(validateOptions) ); /* assertTrue( compareErrorCodes(new String[]{ 1.3 +4 -1 xml-xmlbeans/v2/test/src/scomp/attributes/detailed/LocalAttrForm.java Index: LocalAttrForm.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/attributes/detailed/LocalAttrForm.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- LocalAttrForm.java 25 Aug 2004 20:58:57 -0000 1.2 +++ LocalAttrForm.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -19,6 +19,8 @@ import javax.xml.namespace.QName; +import org.apache.xmlbeans.XmlErrorCodes; + /** * @owner: ykadiysk * Date: Jul 14, 2004 @@ -55,7 +57,8 @@ assertTrue( !doc.validate(validateOptions) ); System.out.println(doc.xmlText()); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[] + {XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NO_WILDCARD}; assertTrue(compareErrorCodes(errExpected)); 1.4 +16 -4 xml-xmlbeans/v2/test/src/scomp/attributes/detailed/LocalAttrUse.java Index: LocalAttrUse.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/attributes/detailed/LocalAttrUse.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- LocalAttrUse.java 25 Aug 2004 20:58:58 -0000 1.3 +++ LocalAttrUse.java 1 Sep 2004 17:27:11 -0000 1.4 @@ -17,6 +17,7 @@ import scomp.common.BaseCase; import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlErrorCodes; import xbean.scomp.attribute.localAttrUse.LocalAttrUseDocDocument; import xbean.scomp.attribute.localAttrUse.LocalAttrUseT; @@ -107,7 +108,11 @@ //assertEquals(1, errorList.size()); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + "cvc-attribute", + XmlErrorCodes. + ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE + }; assertTrue(compareErrorCodes(errExpected)); @@ -131,7 +136,9 @@ //attr locally valid for fixed val String[] errExpected = new String[]{ "cvc-attribute", - "cvc-attribute"}; + XmlErrorCodes. + ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE + }; assertTrue(compareErrorCodes(errExpected)); } @@ -147,8 +154,12 @@ assertEquals("newval", testDoc.getAttRequiredDefault()); showErrors(); String[] errExpected = new String[]{ - "cvc-attribute", - "cvc-attribute"}; + XmlErrorCodes. + ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE + , + XmlErrorCodes. + ELEM_COMPLEX_TYPE_LOCALLY_VALID$MISSING_REQUIRED_ATTRIBUTE + }; assertTrue(compareErrorCodes(errExpected)); } @@ -171,6 +182,7 @@ elt.setAttOpt("bla"); assertTrue(!elt.validate(validateOptions)); showErrors(); + //does Kevin have the right code here? doesn't seem so to me? String[] errExpected = new String[]{"cvc-attribute"}; assertTrue(compareErrorCodes(errExpected)); 1.4 +26 -2 xml-xmlbeans/v2/test/src/scomp/common/BaseCase.java Index: BaseCase.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/common/BaseCase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- BaseCase.java 25 Aug 2004 20:58:59 -0000 1.3 +++ BaseCase.java 1 Sep 2004 17:27:11 -0000 1.4 @@ -20,6 +20,7 @@ import org.apache.xmlbeans.XmlErrorCodes; import java.util.ArrayList; +import java.util.Collection; /** * @owner: ykadiysk @@ -59,8 +60,12 @@ //TODO: compare regardless of order public boolean compareErrorCodes(String[] expected) { - // if ( errorList.size() != expected.length) - // return false; + if ( errorList.size() != expected.length){ + System.err.println( + stringOfCodes(expected,errorList)); + + return false; + } StringBuffer errMessage= new StringBuffer(); for (int i = 0; i < errorList.size(); i++) { @@ -71,10 +76,29 @@ if (expected[i] != error.getErrorCode()){ if (errMessage.length() >0) System.err.println(errMessage); + ArrayList exp=new ArrayList(); + + System.err.println( + stringOfCodes(expected,errorList)); return false; } } return true; } + + public String stringOfCodes(String[] errorCodes + ,ArrayList actual_errorCodes){ + StringBuffer res=new StringBuffer(); + res.append("\n Expected codes(from LTGfmt file):\n"); + int i=0; + for (;i < errorCodes.length; i++ ) + res.append( errorCodes[i]+"\t" ); + res.append("\nBut Got: \n"); + for ( i=0 ;i < actual_errorCodes.size(); i++ ) + res.append( actual_errorCodes.get(i)+"\t" ); + + return res.toString(); + + } } 1.4 +3 -1 xml-xmlbeans/v2/test/src/scomp/contentType/complex/detailed/ElementOnlyContentTest.java Index: ElementOnlyContentTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/contentType/complex/detailed/ElementOnlyContentTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ElementOnlyContentTest.java 25 Aug 2004 20:58:59 -0000 1.3 +++ ElementOnlyContentTest.java 1 Sep 2004 17:27:11 -0000 1.4 @@ -21,6 +21,7 @@ import org.apache.xmlbeans.XmlInteger; import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlErrorCodes; import xbean.scomp.contentType.complexTypeTest.EltTypeDocument; import xbean.scomp.contentType.complexTypeTest.ElementT; @@ -89,7 +90,8 @@ System.out.println(testElt.xmlText()); assertTrue(!testElt.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_ONLY_WITH_TEXT}; assertTrue(compareErrorCodes(errExpected)); } 1.3 +1 -1 xml-xmlbeans/v2/test/src/scomp/contentType/complex/modelGroup/detailed/NestSequenceChoiceTest.java Index: NestSequenceChoiceTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/contentType/complex/modelGroup/detailed/NestSequenceChoiceTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NestSequenceChoiceTest.java 25 Aug 2004 20:58:59 -0000 1.2 +++ NestSequenceChoiceTest.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -61,7 +61,7 @@ throw t; } - + //can't have both set elt.setOptchildInt(2); elt.setOptchildStr("boo"); assertTrue(!doc.validate(validateOptions)); 1.3 +6 -2 xml-xmlbeans/v2/test/src/scomp/contentType/simple/detailed/UnionType.java Index: UnionType.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/contentType/simple/detailed/UnionType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- UnionType.java 25 Aug 2004 20:58:59 -0000 1.2 +++ UnionType.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -24,6 +24,8 @@ import java.util.List; import java.util.ArrayList; +import org.apache.xmlbeans.XmlErrorCodes; + /** * @owner: ykadiysk * Date: Aug 3, 2004 @@ -63,7 +65,8 @@ doc.setUnionElt(new Integer(5)); assertTrue(!doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_VALID$UNION}; assertTrue(compareErrorCodes(errExpected)); } @@ -105,7 +108,8 @@ UnionEltDocument doc = UnionEltDocument.Factory.parse(input); assertTrue(!doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_VALID$UNION}; assertTrue(compareErrorCodes(errExpected)); } 1.3 +43 -19 xml-xmlbeans/v2/test/src/scomp/derivation/detailed/BlockTest.java Index: BlockTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/derivation/detailed/BlockTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BlockTest.java 25 Aug 2004 20:58:59 -0000 1.2 +++ BlockTest.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -20,6 +20,7 @@ import scomp.common.BaseCase; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlErrorCodes; /** * @owner: ykadiysk @@ -31,7 +32,9 @@ String restrContentInvalid = "<name>Bobby</name><age>40</age>"; String extContent = "<name>Bobby</name><age>40</age><gender>f</gender>"; - public String getInstance(String elt, String type, boolean ext, + public String getInstance(String elt, + String type, + boolean ext, boolean valid) { StringBuffer sb = new StringBuffer(); sb.append("<ns:" + elt + @@ -81,7 +84,8 @@ doc1 = EltAllBaseDocument.Factory.parse(getInstance("EltAllBase", "restAllT", false, true)); assertTrue(!doc.validate(validateOptions)); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION}; assertTrue(compareErrorCodes(errExpected)); @@ -117,12 +121,18 @@ validate(doc); //subst rest type: should not be possible EltRBaseDocument doc1 = EltRBaseDocument.Factory.parse(getInstance("EltRBase", "restRT", false, false)); - assertTrue(!doc1.validate()); + assertTrue(!doc1.validate(validateOptions)); + String[] errExpected = new String[]{ + XmlErrorCodes + .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION}; + assertTrue(compareErrorCodes(errExpected)); - doc1 = EltRBaseDocument.Factory.parse(getInstance("EltRBase", "restRT", false, true)); + doc1 = EltRBaseDocument.Factory + .parse(getInstance("EltRBase", "restRT", false, true)); - assertTrue(!doc1.validate()); - String[] errExpected = new String[]{"cvc-attribute"}; + assertTrue(!doc1.validate(validateOptions)); + errExpected = new String[]{ + XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION}; assertTrue(compareErrorCodes(errExpected)); } @@ -136,15 +146,20 @@ EltREBaseDocument doc1 = EltREBaseDocument.Factory.parse(getInstance("EltREBase", "extRET", true, true)); assertTrue(!doc.validate(validateOptions)); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION}; assertTrue(compareErrorCodes(errExpected)); //subst rest type: should not be possible //ER - EltERBaseDocument doc2 = EltERBaseDocument.Factory.parse(getInstance("EltERBase", "restERT", false, false)); - assertTrue(!doc.validate(validateOptions)); - errExpected = new String[]{"cvc-attribute"}; + EltERBaseDocument doc2 = EltERBaseDocument.Factory + .parse(getInstance("EltERBase", + "restERT", false, false)); + assertTrue(!doc.validate(validateOptions)); + errExpected = new String[]{ + XmlErrorCodes + .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION}; assertTrue(compareErrorCodes(errExpected)); doc2 = EltERBaseDocument.Factory.parse(getInstance("EltERBase", "restERT", false, true)); @@ -158,7 +173,8 @@ errExpected = new String[]{"cvc-attribute"}; assertTrue(compareErrorCodes(errExpected)); - doc3 = EltREBaseDocument.Factory.parse(getInstance("EltREBase", "restRET", false, true)); + doc3 = EltREBaseDocument.Factory + .parse(getInstance("EltREBase", "restRET", false, true)); assertTrue(!doc.validate(validateOptions)); errExpected = new String[]{"cvc-attribute"}; assertTrue(compareErrorCodes(errExpected)); @@ -171,14 +187,22 @@ * @throws Throwable */ public void testBlockDefault() throws Throwable { - EltDefaultBlockDocument doc = EltDefaultBlockDocument.Factory.parse(getInstanceDefault("EltDefaultBlock", "extNoneT", true, true)); - assertTrue(!doc.validate(validateOptions)); - String[] errExpected = new String[]{"cvc-attribute"}; - assertTrue(compareErrorCodes(errExpected)); - - doc = EltDefaultBlockDocument.Factory.parse(getInstanceDefault("EltDefaultBlock", "restNoneT", false, false)); - assertTrue(!doc.validate(validateOptions)); - errExpected = new String[]{"cvc-attribute"}; + EltDefaultBlockDocument doc = + EltDefaultBlockDocument.Factory + .parse(getInstanceDefault("EltDefaultBlock", "extNoneT", true, true)); + assertTrue(!doc.validate(validateOptions)); + String[] errExpected = new String[]{ + XmlErrorCodes + .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_EXTENSION}; + assertTrue(compareErrorCodes(errExpected)); + + doc = EltDefaultBlockDocument.Factory + .parse(getInstanceDefault("EltDefaultBlock", "restNoneT", false, false)); + assertTrue(!doc.validate(validateOptions)); + errExpected = new String[]{ + XmlErrorCodes + .ELEM_LOCALLY_VALID$XSI_TYPE_BLOCK_RESTRICTION + }; assertTrue(compareErrorCodes(errExpected)); doc = EltDefaultBlockDocument.Factory.parse(getInstanceDefault("EltDefaultBlock", "restNoneT", false, true)); 1.3 +7 -3 xml-xmlbeans/v2/test/src/scomp/derivation/restriction/detailed/AttrWCRestriction.java Index: AttrWCRestriction.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/derivation/restriction/detailed/AttrWCRestriction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AttrWCRestriction.java 25 Aug 2004 20:59:03 -0000 1.2 +++ AttrWCRestriction.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -17,6 +17,7 @@ import scomp.common.BaseCase; import xbean.scomp.derivation.attributeWCRestriction.*; +import org.apache.xmlbeans.XmlErrorCodes; /** * @owner: ykadiysk @@ -80,7 +81,8 @@ Any2LocalDocument.Factory.parse(input); assertTrue (! doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID}; assertTrue(compareErrorCodes(errExpected)); } @@ -99,7 +101,8 @@ List2SubsetDocument.Factory.parse(input); //this is a non-existing NS...strict should complain assertTrue ( !doc.validate(validateOptions)); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID}; assertTrue(compareErrorCodes(errExpected)); @@ -129,7 +132,8 @@ Other2ListDocument.Factory.parse(input); assertTrue (! doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$NOT_WILDCARD_VALID}; assertTrue(compareErrorCodes(errExpected)); } 1.4 +5 -4 xml-xmlbeans/v2/test/src/scomp/derivation/restriction/detailed/GroupRestrictionTest.java Index: GroupRestrictionTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/derivation/restriction/detailed/GroupRestrictionTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- GroupRestrictionTest.java 25 Aug 2004 20:59:06 -0000 1.3 +++ GroupRestrictionTest.java 1 Sep 2004 17:27:11 -0000 1.4 @@ -31,7 +31,7 @@ .newInstance(); RestrictedSequenceT elt = doc.addNewRestrictedSequenceElt(); elt.setChild1(BigInteger.ONE); - elt.addChild2("foobar"); + elt.addChild3(new BigInteger("10")); elt.addChild3(new BigInteger("10")); try { @@ -40,10 +40,11 @@ showErrors(); throw t; } - elt.addChild3(BigInteger.ONE); - assertTrue(!doc.validate()); + elt.addChild2("foobar"); + assertTrue(!doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + "cvc-attribute"}; assertTrue(compareErrorCodes(errExpected)); 1.4 +3 -1 xml-xmlbeans/v2/test/src/scomp/derivation/restriction/detailed/MixedContentRestriction.java Index: MixedContentRestriction.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/derivation/restriction/detailed/MixedContentRestriction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MixedContentRestriction.java 25 Aug 2004 20:59:06 -0000 1.3 +++ MixedContentRestriction.java 1 Sep 2004 17:27:11 -0000 1.4 @@ -20,6 +20,7 @@ import java.math.BigInteger; import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlErrorCodes; /** * @owner: ykadiysk @@ -64,7 +65,8 @@ cur.insertChars("My chars"); assertTrue( !doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_COMPLEX_TYPE_LOCALLY_VALID$ELEMENT_ONLY_WITH_TEXT}; assertTrue(compareErrorCodes(errExpected)); //should be valid w/o the Text there 1.3 +6 -2 xml-xmlbeans/v2/test/src/scomp/derivation/restriction/facets/detailed/ListRestriction.java Index: ListRestriction.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/derivation/restriction/facets/detailed/ListRestriction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ListRestriction.java 25 Aug 2004 20:59:09 -0000 1.2 +++ ListRestriction.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -20,6 +20,8 @@ import java.util.List; import java.util.ArrayList; +import org.apache.xmlbeans.XmlErrorCodes; + /** * @owner: ykadiysk * Date: Aug 4, 2004 @@ -35,7 +37,8 @@ //this should be too short assertTrue(!doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH}; assertTrue(compareErrorCodes(errExpected)); vals.add("lstsmall"); @@ -100,7 +103,8 @@ MaxLengthEltDocument doc = MaxLengthEltDocument.Factory.parse(input); assertTrue(!doc.validate(validateOptions)); showErrors(); - String[] errExpected = new String[]{"cvc-attribute"}; + String[] errExpected = new String[]{ + XmlErrorCodes.DATATYPE_LENGTH_VALID$LIST_LENGTH}; assertTrue(compareErrorCodes(errExpected)); MaxLengthFacet elt = MaxLengthFacet.Factory.newInstance(); 1.3 +15 -4 xml-xmlbeans/v2/test/src/scomp/elements/detailed/GlobalEltDefault.java Index: GlobalEltDefault.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/elements/detailed/GlobalEltDefault.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- GlobalEltDefault.java 25 Aug 2004 20:59:09 -0000 1.2 +++ GlobalEltDefault.java 1 Sep 2004 17:27:11 -0000 1.3 @@ -30,14 +30,25 @@ GlobalEltDefaultStrDocument testDoc=GlobalEltDefaultStrDocument .Factory.newInstance(); assertEquals(null,testDoc.getGlobalEltDefaultStr()); - assertTrue(testDoc.validate()); +try{ + assertTrue(testDoc.validate(validateOptions)); +}catch(Throwable t){ + showErrors(); + throw t; +} } //default value is used - public void testIntType(){ + public void testIntType()throws Throwable{ GlobalEltDefaultIntDocument testDoc - =GlobalEltDefaultIntDocument.Factory.newInstance(); + =GlobalEltDefaultIntDocument.Factory + .newInstance(); assertEquals(0,testDoc.getGlobalEltDefaultInt()); - assertTrue(testDoc.validate()); + try{ + assertTrue(testDoc.validate(validateOptions)); +}catch(Throwable t){ + showErrors(); + throw t; +} } } 1.4 +8 -3 xml-xmlbeans/v2/test/src/scomp/elements/detailed/GlobalEltNillable.java Index: GlobalEltNillable.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/elements/detailed/GlobalEltNillable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- GlobalEltNillable.java 25 Aug 2004 20:59:09 -0000 1.3 +++ GlobalEltNillable.java 1 Sep 2004 17:27:12 -0000 1.4 @@ -18,6 +18,7 @@ import scomp.common.BaseCase; import xbean.scomp.element.globalEltNillable.*; import org.apache.xmlbeans.impl.values.XmlValueNotNillableException; +import org.apache.xmlbeans.XmlErrorCodes; /** * @owner: ykadiysk @@ -36,7 +37,8 @@ " xsi:nil=\"false\"/>"); assertTrue(!testElt.validate(validateOptions)); assertEquals(1, errorList.size()); - String[] errExpected = new String[]{"cvc-elt3.3.4"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE}; assertTrue(compareErrorCodes(errExpected)); @@ -68,7 +70,9 @@ assertTrue(!testElt.validate(validateOptions)); assertEquals(1, errorList.size()); showErrors(); - String[] errExpected = new String[]{"cvc-elt3.3.4"}; + String[] errExpected = + new String[]{ + XmlErrorCodes.ELEM_LOCALLY_VALID$NOT_NILLABLE}; assertTrue(compareErrorCodes(errExpected)); fail("Why is the last setter not throwing an exception?"); @@ -138,7 +142,8 @@ assertEquals(1, errorList.size()); showErrors(); - String[] errExpected = new String[]{"cvc-elt3.3.4"}; + String[] errExpected = new String[]{ + XmlErrorCodes.ELEM_LOCALLY_VALID$NIL_WITH_CONTENT}; assertTrue(compareErrorCodes(errExpected)); testElt = GlobalEltComplexDocument 1.3 +15 -12 xml-xmlbeans/v2/test/src/scomp/elements/detailed/NillTest.java Index: NillTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/elements/detailed/NillTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NillTest.java 16 Aug 2004 22:57:34 -0000 1.2 +++ NillTest.java 1 Sep 2004 17:27:12 -0000 1.3 @@ -26,17 +26,26 @@ * Date: Jul 28, 2004 * Time: 9:08:41 AM */ + +/** this test illustrates somewhat inconsistent behavior + * of nillable: + * + */ public class NillTest extends BaseCase { /** - * Tests exceptions when setting values to null for non-nillable elems + * Tests exceptions when setting values to + * null for non-nillable elems */ public void testNillable() { Contact contact = Contact.Factory.newInstance(); -// if the first name is null, xmlbeans doest not thrown any exceptions... - //eric says this should fail: elt is not nillable + // if the first name is null, xmlbeans doest not thrown any exceptions... + //eric says this should fail: + // elt is not nillable--at least xsi:nil should never be there contact.setFirstName(null); - + assertEquals("<firstName " + + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/>", + contact.xmlText()); GlobalEltNotNillableDocument testElt = GlobalEltNotNillableDocument .Factory.newInstance(); testElt.setGlobalEltNotNillable(null); @@ -48,14 +57,8 @@ } catch (XmlValueNotNillableException e) { } - // try { - // doc.setCityName(null); - testElt.setGlobalEltNotNillable(null); - // fail("Expected XmlValueNotNillableException"); - //} - //catch (XmlValueNotNillableException e) {} - - AddressInfo address = AddressInfo.Factory.newInstance(); + testElt.setGlobalEltNotNillable(null); + AddressInfo address = AddressInfo.Factory.newInstance(); //this can be null address.setGlobalEltNotNillable(null); // ...whereas this optional field cannot be null 1.5 +21 -4 xml-xmlbeans/v2/test/src/scomp/namespace/detailed/ElementWC.java Index: ElementWC.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/namespace/detailed/ElementWC.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ElementWC.java 25 Aug 2004 20:59:09 -0000 1.4 +++ ElementWC.java 1 Sep 2004 17:27:12 -0000 1.5 @@ -18,6 +18,11 @@ import scomp.common.BaseCase; import xbean.scomp.namespace.elementWC.*; +import javax.xml.namespace.QName; + +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlString; + /** * @owner: ykadiysk * Date: Aug 5, 2004 @@ -78,6 +83,11 @@ if (!doc.validate(validateOptions)) showErrors(); assertTrue(doc.validate(validateOptions)); + XmlObject[] arr=doc.getAnyStrict() + .selectChildren(new QName( + "http://xbean/scomp/element/GlobalEltDefault", + "GlobalEltDefaultStr","elt")); + assertEquals(arr[0].schemaType(),XmlString.type); } public void testAnyStrictIllegal() throws Throwable { @@ -206,10 +216,10 @@ public void testListStrictLegal() throws Throwable { ListStrictDocument doc = ListStrictDocument.Factory .parse("<foo:ListStrict " + - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + - "xmlns:foo=\"http://xbean/scomp/namespace/ElementWC\"" + + "xmlns:foo=\"http://xbean/scomp/namespace/ElementWC\"" + " xmlns:elt=\"http://xbean/scomp/element/GlobalEltDefault\">" + - " <elt:child/></foo:ListStrict>"); + " <elt:GlobalEltDefaultInt/>" + + "</foo:ListStrict>"); if (!doc.validate(validateOptions)) { showErrors(); fail("testFailed"); @@ -239,6 +249,8 @@ if (!doc.validate(validateOptions)) showErrors(); assertTrue(doc.validate(validateOptions)); + XmlObject[] arr=doc.getTargetLax().selectChildren("","child"); + assertEquals(arr[0].schemaType(),XmlObject.type); } public void testTargetLaxIllegal() throws Throwable { @@ -281,8 +293,13 @@ TargetStrictDocument doc = TargetStrictDocument.Factory .parse("<foo:TargetStrict " + " xmlns:foo=\"http://xbean/scomp/namespace/ElementWC\">" + - " <foo:child/></foo:TargetStrict>"); + " <foo:LocalElt/></foo:TargetStrict>"); + try{ assertTrue(doc.validate(validateOptions)); + }catch(Throwable t){ + showErrors(); + throw t; + } } public void testTargetStrictIllegal() throws Throwable { 1.4 +2 -1 xml-xmlbeans/v2/test/src/scomp/substGroup/restriction/detailed/Block.java Index: Block.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/substGroup/restriction/detailed/Block.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Block.java 25 Aug 2004 20:59:12 -0000 1.3 +++ Block.java 1 Sep 2004 17:27:12 -0000 1.4 @@ -26,7 +26,8 @@ */ public class Block extends BaseCase { /** - * TODO: verify that w/ respect to substitution groups block all + * TODO: verify that w/ respect to substitution + * groups block all * and block substitution are the same thing; * * @throws Throwable 1.4 +4 -2 xml-xmlbeans/v2/test/src/xmlcursor/detailed/ToBookmarkTest.java Index: ToBookmarkTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/xmlcursor/detailed/ToBookmarkTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ToBookmarkTest.java 1 Jul 2004 00:01:29 -0000 1.3 +++ ToBookmarkTest.java 1 Sep 2004 17:27:12 -0000 1.4 @@ -229,8 +229,10 @@ toNextTokenOfType(m_xc, TokenType.TEXT); xc1.toCursor(m_xc); xc1.toNextChar(1); - xc1.setBookmark(_theBookmark); // set an Bookmark at the '1' - xc1.toNextChar(2); // move xc1 to the '3' + // set a Bookmark at the '1' + xc1.setBookmark(_theBookmark); + // move xc1 to the '3' + xc1.toNextChar(2); try { assertEquals("34", xc1.getTextValue()); assertEquals(2, m_xc.copyChars(2, xc1)); --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 01 22:49:34 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 43323 invoked from network); 1 Sep 2004 22:49:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 1 Sep 2004 22:49:34 -0000 Received: (qmail 59834 invoked by uid 500); 1 Sep 2004 22:49:34 -0000 Delivered-To: ograham@example.net Received: (qmail 59808 invoked by uid 500); 1 Sep 2004 22:49:34 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 59786 invoked by uid 500); 1 Sep 2004 22:49:33 -0000 Delivered-To: ograham@example.net Received: (qmail 59782 invoked by uid 99); 1 Sep 2004 22:49:33 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 01 Sep 2004 15:49:33 -0700 Received: (qmail 43307 invoked by uid 1737); 1 Sep 2004 22:49:32 -0000 Date: 1 Sep 2004 22:49:32 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/misc/checkin ErrorCodeTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/01 15:49:32 Modified: v2/test/src/misc/checkin ErrorCodeTest.java Log: fixing so it will compile under jdk1.5 Revision Changes Path 1.2 +3 -3 xml-xmlbeans/v2/test/src/misc/checkin/ErrorCodeTest.java Index: ErrorCodeTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/misc/checkin/ErrorCodeTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ErrorCodeTest.java 1 Sep 2004 01:14:52 -0000 1.1 +++ ErrorCodeTest.java 1 Sep 2004 22:49:32 -0000 1.2 @@ -57,9 +57,9 @@ Properties messages = readMessages(); // each message key should have an error code value - Enumeration enum = messages.keys(); - while (enum.hasMoreElements()) { - String key = (String) enum.nextElement(); + Enumeration e = messages.keys(); + while (e.hasMoreElements()) { + String key = (String) e.nextElement(); // these properties are known not to have an error code if (key.equals("message.missing.resource") || key.equals("message.pattern.invalid")) --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Tue Sep 07 17:57:20 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 25209 invoked from network); 7 Sep 2004 17:57:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 7 Sep 2004 17:57:20 -0000 Received: (qmail 90781 invoked by uid 500); 7 Sep 2004 17:57:17 -0000 Delivered-To: ograham@example.net Received: (qmail 90681 invoked by uid 500); 7 Sep 2004 17:57:17 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 90530 invoked by uid 500); 7 Sep 2004 17:57:15 -0000 Delivered-To: ograham@example.net Received: (qmail 90412 invoked by uid 99); 7 Sep 2004 17:57:14 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 07 Sep 2004 10:57:13 -0700 Received: (qmail 25109 invoked by uid 1737); 7 Sep 2004 17:57:11 -0000 Date: 7 Sep 2004 17:57:11 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/scomp/redefine/detailed AttrGroupRedefine.java GroupRedefine.java SimpleRedefine.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/07 10:57:11 Modified: v2/test/cases/xbean/scomp/contentType ComplexTypeTest.xsd v2/test/src/scomp/contentType/complex/detailed MixedContentTest.java Added: v2/test/src/scomp/redefine/detailed AttrGroupRedefine.java GroupRedefine.java SimpleRedefine.java Log: Contributed by:Yana Kadiyska. Last Schema feature tests Revision Changes Path 1.2 +14 -0 xml-xmlbeans/v2/test/cases/xbean/scomp/contentType/ComplexTypeTest.xsd Index: ComplexTypeTest.xsd =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/xbean/scomp/contentType/ComplexTypeTest.xsd,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ComplexTypeTest.xsd 16 Aug 2004 17:36:11 -0000 1.1 +++ ComplexTypeTest.xsd 7 Sep 2004 17:57:11 -0000 1.2 @@ -19,6 +19,12 @@ <xsd:element name="child3" type="xsd:integer"/> </xsd:sequence> </xsd:complexType> + + + + + + <xsd:complexType name="emptyT"> <xsd:attribute name="emptyAttr" type="xsd:string"/> </xsd:complexType> @@ -30,4 +36,12 @@ <xsd:element name="MixedType" type="mixedT"/> <xsd:element name="EmptyType" type="emptyT"/> <xsd:element name="EmptyMixedType" type="emptyT"/> + + <xsd:element name="MixedFixedElt" fixed="abc"> + <xsd:complexType mixed="true"> + <xsd:sequence> + <xsd:element name="a" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> </xsd:schema> 1.3 +19 -0 xml-xmlbeans/v2/test/src/scomp/contentType/complex/detailed/MixedContentTest.java Index: MixedContentTest.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/scomp/contentType/complex/detailed/MixedContentTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MixedContentTest.java 25 Aug 2004 20:58:59 -0000 1.2 +++ MixedContentTest.java 7 Sep 2004 17:57:11 -0000 1.3 @@ -17,11 +17,14 @@ import junit.framework.TestCase; import xbean.scomp.contentType.complexTypeTest.MixedTypeDocument; import xbean.scomp.contentType.complexTypeTest.MixedT; +import xbean.scomp.contentType.complexTypeTest.MixedFixedEltDocument; import java.math.BigInteger; import org.apache.xmlbeans.XmlInteger; import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlErrorCodes; +import org.apache.xmlbeans.XmlException; import scomp.common.BaseCase; /** @@ -150,6 +153,22 @@ "Random mixed content1<child2>5</child2>" + "<child3>1</child3></xml-fragment>",testElt.xmlText() ); + + } + + + public void testMixedFixed() throws XmlException{ + MixedFixedEltDocument doc= + MixedFixedEltDocument.Factory + .parse("<pre:MixedFixedElt " + + " xmlns:pre=\"http://xbean/scomp/contentType/ComplexTypeTest\">" + + "<a/>abc</pre:MixedFixedElt>"); + + assertTrue (! doc.validate(validateOptions)); + showErrors(); + String[] expected=new String[] + {XmlErrorCodes.ELEM_LOCALLY_VALID}; + assertTrue(compareErrorCodes(expected)); } public void setUp() { 1.1 xml-xmlbeans/v2/test/src/scomp/redefine/detailed/AttrGroupRedefine.java Index: AttrGroupRedefine.java =================================================================== package scomp.redefine.detailed; import scomp.common.BaseCase; import xbean.scomp.redefine.attrGroupRedefine.AttrGroupEltDocument; import java.lang.reflect.Method; public class AttrGroupRedefine extends BaseCase{ /** * test that fields from the old type def are not * visible anymore */ public void testCodeGeneration(){ AttrGroupEltDocument doc=AttrGroupEltDocument.Factory.newInstance(); AttrGroupEltDocument.AttrGroupElt elt=doc.addNewAttrGroupElt(); try{ elt.getClass().getDeclaredField("attr2"); fail("field should be redefined"); }catch(NoSuchFieldException e){} try{ elt.getClass().getDeclaredMethod("getAttr1",null); elt.getClass().getDeclaredMethod("getAttr2A",null); Method m=elt.getClass().getDeclaredMethod("getAttr3A",null); assertEquals(m.getReturnType(),Class.forName("java.lang.Integer.TYPE") ); }catch(NoSuchMethodException e){ fail("Fields not redefined"); } catch (ClassNotFoundException e1){} } } 1.1 xml-xmlbeans/v2/test/src/scomp/redefine/detailed/GroupRedefine.java Index: GroupRedefine.java =================================================================== package scomp.redefine.detailed; /** * @author ykadiysk * Date: Aug 24, 2004 */ public class GroupRedefine { /* public void testCodeGeneration(){ GroupSuperEltDocument doc=GroupSuperEltDocument.Factory.newInstance(); try{ elt.getClass().getDeclaredField("attr2"); fail("field should be redefined"); }catch(NoSuchFieldException e){} try{ elt.getClass().getDeclaredMethod("getAttr1",null); elt.getClass().getDeclaredMethod("getAttr2A",null); Method m=elt.getClass().getDeclaredMethod("getAttr3A",null); assertEquals(m.getReturnType(),Class.forName("java.lang.Integer.TYPE") ); }catch(NoSuchMethodException e){ fail("Fields not redefined"); } catch (ClassNotFoundException e1){} } */ } 1.1 xml-xmlbeans/v2/test/src/scomp/redefine/detailed/SimpleRedefine.java Index: SimpleRedefine.java =================================================================== package scomp.redefine.detailed; import xbean.scomp.redefine.simpleRedefined.NewSizeEltDocument; import xbean.scomp.redefine.simpleRedefined.OldColorEltDocument; import xbean.scomp.redefine.simpleRedefined.OldSizeEltDocument; import scomp.common.BaseCase; /** * @author ykadiysk * Date: Aug 24, 2004 */ public class SimpleRedefine extends BaseCase { /** * test that fields from the old type def are not * visible anymore: only valid range for sizeT should be 3-20 */ public void testCodeGeneration() throws Throwable{ NewSizeEltDocument doc=NewSizeEltDocument.Factory.newInstance(); OldColorEltDocument doc1=OldColorEltDocument.Factory.newInstance(); OldSizeEltDocument doc2=OldSizeEltDocument.Factory.newInstance(); doc.setNewSizeElt(3); try{ assertTrue(doc.validate(validateOptions)); }catch(Throwable t){ showErrors(); throw t; } doc.setNewSizeElt(21); assertTrue( !doc.validate(validateOptions)); showErrors(); clearErrors(); doc2.setOldSizeElt(21); assertTrue( !doc.validate(validateOptions)); showErrors(); clearErrors(); doc1.setOldColorElt("white"); try{ assertTrue(doc1.validate(validateOptions)); }catch(Throwable t){ showErrors(); throw t; } } } --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Tue Sep 07 22:03:31 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 45005 invoked from network); 7 Sep 2004 22:03:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 7 Sep 2004 22:03:31 -0000 Received: (qmail 63997 invoked by uid 500); 7 Sep 2004 22:02:42 -0000 Delivered-To: ograham@example.net Received: (qmail 63923 invoked by uid 500); 7 Sep 2004 22:02:41 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 63854 invoked by uid 500); 7 Sep 2004 22:02:40 -0000 Delivered-To: ograham@example.net Received: (qmail 63848 invoked by uid 99); 7 Sep 2004 22:02:40 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 07 Sep 2004 15:02:39 -0700 Received: (qmail 44701 invoked by uid 1735); 7 Sep 2004 22:02:38 -0000 Date: 7 Sep 2004 22:02:38 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/util Element.java TypeSystemHolder.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N cezar 2004/09/07 15:02:38 Modified: v2/src/tools/org/apache/xmlbeans/impl/inst2xsd RussianDollStrategy.java SalamiSliceStrategy.java VenetianBlindStrategy.java v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/util Element.java TypeSystemHolder.java Log: Inst2xsd: support for xsi:nil and qname fix. checkintest: passes Revision Changes Path 1.4 +16 -7 xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java Index: RussianDollStrategy.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/RussianDollStrategy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- RussianDollStrategy.java 26 Aug 2004 21:10:34 -0000 1.3 +++ RussianDollStrategy.java 7 Sep 2004 22:02:37 -0000 1.4 @@ -90,7 +90,7 @@ Element element = new Element(); element.setName(xc.getName()); element.setGlobal(false); - + Type elemType = Type.createUnnamedType(Type.SIMPLE_TYPE_SIMPLE_CONTENT); //assume simple, set later element.setType(elemType); @@ -106,10 +106,12 @@ { case XmlCursor.TokenType.INT_ATTR: // todo check for xsi:type - // ignore xsi:type and xsi:nil atributes + // ignore xsi:... attributes other than xsi:nil QName attName = xc.getName(); - if (!_xsiNil.equals(attName) && !_xsiType.equals(attName)) + if (!_xsiNil.getNamespaceURI().equals(attName.getNamespaceURI())) attributes.add(processAttribute(xc, options, element.getName().getNamespaceURI(), typeSystemHolder)); + else if (_xsiNil.equals(attName)) + element.setNillable(true); break; @@ -139,10 +141,10 @@ break; case XmlCursor.TokenType.INT_ENDDOC: - throw new IllegalStateException(); + break loop; case XmlCursor.TokenType.INT_NONE: - throw new IllegalStateException(); + break loop; case XmlCursor.TokenType.INT_STARTDOC: throw new IllegalStateException(); @@ -264,6 +266,12 @@ referencedElem.setName(child.getName()); referencedElem.setType(child.getType()); + if (child.isNillable()) + { + referencedElem.setNillable(true); + child.setNillable(false); + } + referencedElem = addGlobalElement(referencedElem, typeSystemHolder, options); child.setRef(referencedElem); // clears child's type @@ -457,12 +465,13 @@ } // check for QName - if (lexicalValue.indexOf(':')>=0 && lexicalValue.indexOf(':')==lexicalValue.lastIndexOf(':')) + int idx = lexicalValue.indexOf(':'); + if (idx>=0 && idx==lexicalValue.lastIndexOf(':') && idx+1<lexicalValue.length()) { PrefixResolver prefixResolver = new PrefixResolver() { public String getNamespaceForPrefix(String prefix) - { return xc.prefixForNamespace(prefix); } + { return xc.namespaceForPrefix(prefix); } }; XmlQNameImpl.validateLexical(lexicalValue, _validationContext, prefixResolver); 1.3 +6 -0 xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/SalamiSliceStrategy.java Index: SalamiSliceStrategy.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/SalamiSliceStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SalamiSliceStrategy.java 14 Aug 2004 02:02:681-540-7529.2 +++ SalamiSliceStrategy.java 7 Sep 2004 22:02:37 -0000 1.3 @@ -34,6 +34,12 @@ referencedElem.setName(child.getName()); referencedElem.setType(child.getType()); + if (child.isNillable()) + { + referencedElem.setNillable(true); + child.setNillable(false); + } + referencedElem = addGlobalElement(referencedElem, typeSystemHolder, options); child.setRef(referencedElem); // clears child's type 1.3 +23 -24 xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/VenetianBlindStrategy.java Index: VenetianBlindStrategy.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/VenetianBlindStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- VenetianBlindStrategy.java 14 Aug 2004 02:02:681-540-7529.2 +++ VenetianBlindStrategy.java 7 Sep 2004 22:02:37 -0000 1.3 @@ -17,7 +17,6 @@ import org.apache.xmlbeans.impl.inst2xsd.util.Element; import org.apache.xmlbeans.impl.inst2xsd.util.TypeSystemHolder; import org.apache.xmlbeans.impl.inst2xsd.util.Type; -import org.apache.xmlbeans.impl.inst2xsd.util.Attribute; import javax.xml.namespace.QName; @@ -91,27 +90,27 @@ return true; } - private boolean typeIsReferencedInside(Type entity, Type container) - { - for (int i = 0; i < container.getElements().size(); i++) - { - Element element = (Element) container.getElements().get(i); - if (entity==element.getType()) - return true; - - if (typeIsReferencedInside(entity, element.getType())) - return true; - } - - for (int i = 0; i < container.getAttributes().size(); i++) - { - Attribute attribute = (Attribute) container.getAttributes().get(i); - if (entity==attribute.getType()) - return true; - - if (typeIsReferencedInside(entity, attribute.getType())) - return true; - } - return false; - } +// private boolean typeIsReferencedInside(Type entity, Type container) +// { +// for (int i = 0; i < container.getElements().size(); i++) +// { +// Element element = (Element) container.getElements().get(i); +// if (entity==element.getType()) +// return true; +// +// if (typeIsReferencedInside(entity, element.getType())) +// return true; +// } +// +// for (int i = 0; i < container.getAttributes().size(); i++) +// { +// Attribute attribute = (Attribute) container.getAttributes().get(i); +// if (entity==attribute.getType()) +// return true; +// +// if (typeIsReferencedInside(entity, attribute.getType())) +// return true; +// } +// return false; +// } } 1.3 +12 -0 xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/util/Element.java Index: Element.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/util/Element.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Element.java 14 Aug 2004 02:02:32 -0000 1.2 +++ Element.java 7 Sep 2004 22:02:37 -0000 1.3 @@ -27,6 +27,7 @@ private int _minOccurs = 1; private int _maxOccurs = 1; public static final int UNBOUNDED = -1; + private boolean _isNillable = false; private Type _type = null; private String _comment = null; @@ -89,6 +90,16 @@ _maxOccurs = maxOccurs; } + public boolean isNillable() + { + return _isNillable; + } + + public void setNillable(boolean isNillable) + { + _isNillable = isNillable; + } + public Type getType() { return isRef() ? getRef().getType() : _type; @@ -118,6 +129,7 @@ ", _isGlobal = " + _isGlobal + ", _minOccurs = " + _minOccurs + ", _maxOccurs = " + _maxOccurs + + ", _isNillable = " + _isNillable + ", _comment = " + _comment + ",\n _type = " + ( _type==null ? "null" : (_type.isGlobal() ? _type.getName().toString() : _type.toString())) + 1.3 +7 -0 xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/util/TypeSystemHolder.java Index: TypeSystemHolder.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/src/tools/org/apache/xmlbeans/impl/inst2xsd/util/TypeSystemHolder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TypeSystemHolder.java 14 Aug 2004 02:02:32 -0000 1.2 +++ TypeSystemHolder.java 7 Sep 2004 22:02:37 -0000 1.3 @@ -163,6 +163,9 @@ org.w3.x2001.xmlSchema.TopLevelElement topLevelElem = sch.addNewElement(); topLevelElem.setName(globalElement.getName().getLocalPart()); + if (globalElement.isNillable()) + topLevelElem.setNillable(globalElement.isNillable()); + fillUpElementDocumentation(topLevelElem, globalElement.getComment()); Type elemType = globalElement.getType(); @@ -181,6 +184,7 @@ else { localSElement.setRef(element.getName()); + assert !element.isNillable(); } if (element.getMaxOccurs()==Element.UNBOUNDED) @@ -191,6 +195,9 @@ { localSElement.setMinOccurs(new BigInteger("" + element.getMinOccurs())); } + + if (element.isNillable()) + localSElement.setNillable(element.isNillable()); } private void fillUpTypeOnElement(Type elemType, org.w3.x2001.xmlSchema.Element parentSElement, String tns) --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 08 20:47:38 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 55638 invoked from network); 8 Sep 2004 20:47:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 8 Sep 2004 20:47:38 -0000 Received: (qmail 36664 invoked by uid 500); 8 Sep 2004 20:47:37 -0000 Delivered-To: ograham@example.net Received: (qmail 36633 invoked by uid 500); 8 Sep 2004 20:47:37 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 36619 invoked by uid 500); 8 Sep 2004 20:47:37 -0000 Delivered-To: ograham@example.net Received: (qmail 36616 invoked by uid 99); 8 Sep 2004 20:47:36 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 13:47:36 -0700 Received: (qmail 55585 invoked by uid 1737); 8 Sep 2004 20:47:35 -0000 Date: 8 Sep 2004 20:47:35 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/common - New directory X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/08 13:47:35 xml-xmlbeans/v2/test/src/compile/scomp/common - New directory --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 08 20:47:47 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 55825 invoked from network); 8 Sep 2004 20:47:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 8 Sep 2004 20:47:46 -0000 Received: (qmail 36806 invoked by uid 500); 8 Sep 2004 20:47:46 -0000 Delivered-To: ograham@example.net Received: (qmail 36772 invoked by uid 500); 8 Sep 2004 20:47:46 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 36742 invoked by uid 500); 8 Sep 2004 20:47:46 -0000 Delivered-To: ograham@example.net Received: (qmail 36727 invoked by uid 99); 8 Sep 2004 20:47:45 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 13:47:45 -0700 Received: (qmail 55794 invoked by uid 1737); 8 Sep 2004 20:47:44 -0000 Date: 8 Sep 2004 20:47:44 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/incr - New directory X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/08 13:47:44 xml-xmlbeans/v2/test/src/compile/scomp/incr - New directory --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 08 20:48:17 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 56519 invoked from network); 8 Sep 2004 20:48:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 8 Sep 2004 20:48:16 -0000 Received: (qmail 37497 invoked by uid 500); 8 Sep 2004 20:48:16 -0000 Delivered-To: ograham@example.net Received: (qmail 37453 invoked by uid 500); 8 Sep 2004 20:48:16 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 37439 invoked by uid 500); 8 Sep 2004 20:48:16 -0000 Delivered-To: ograham@example.net Received: (qmail 37435 invoked by uid 99); 8 Sep 2004 20:48:16 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 13:48:16 -0700 Received: (qmail 56468 invoked by uid 1737); 8 Sep 2004 20:48:14 -0000 Date: 8 Sep 2004 20:48:14 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile - New directory X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/08 13:48:14 xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile - New directory --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 08 20:48:27 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 56864 invoked from network); 8 Sep 2004 20:48:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 8 Sep 2004 20:48:27 -0000 Received: (qmail 38053 invoked by uid 500); 8 Sep 2004 20:48:26 -0000 Delivered-To: ograham@example.net Received: (qmail 38003 invoked by uid 500); 8 Sep 2004 20:48:26 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 37990 invoked by uid 500); 8 Sep 2004 20:48:26 -0000 Delivered-To: ograham@example.net Received: (qmail 37987 invoked by uid 99); 8 Sep 2004 20:48:25 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 13:48:25 -0700 Received: (qmail 56804 invoked by uid 1737); 8 Sep 2004 20:48:24 -0000 Date: 8 Sep 2004 20:48:24 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile/checkin - New directory X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/08 13:48:24 xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile/checkin - New directory --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 08 20:48:35 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 57046 invoked from network); 8 Sep 2004 20:48:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 8 Sep 2004 20:48:34 -0000 Received: (qmail 38185 invoked by uid 500); 8 Sep 2004 20:48:34 -0000 Delivered-To: ograham@example.net Received: (qmail 38156 invoked by uid 500); 8 Sep 2004 20:48:34 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 38142 invoked by uid 500); 8 Sep 2004 20:48:34 -0000 Delivered-To: ograham@example.net Received: (qmail 38139 invoked by uid 99); 8 Sep 2004 20:48:34 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 13:48:34 -0700 Received: (qmail 57021 invoked by uid 1737); 8 Sep 2004 20:48:33 -0000 Date: 8 Sep 2004 20:48:33 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile/detailed - New directory X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/08 13:48:33 xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile/detailed - New directory --------------------------------------------------------------------- To unsubscribe, e-mail: ograham@example.net For additional commands, e-mail: ograham@example.net From commitsograham@example.net Wed Sep 08 20:51:23 2004 Return-Path: <commitsograham@example.net> Delivered-To: ograham@example.net Received: (qmail 60033 invoked from network); 8 Sep 2004 20:51:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur-2.apache.org with SMTP; 8 Sep 2004 20:51:22 -0000 Received: (qmail 39638 invoked by uid 500); 8 Sep 2004 20:50:41 -0000 Delivered-To: ograham@example.net Received: (qmail 39580 invoked by uid 500); 8 Sep 2004 20:50:41 -0000 Mailing-List: contact ograham@example.net; run by ezmlm Precedence: bulk List-Post: <mailto:ograham@example.net> List-Help: <mailto:ograham@example.net> List-Unsubscribe: <mailto:ograham@example.net> List-Subscribe: <mailto:ograham@example.net> Reply-To: ograham@example.net Delivered-To: mailing list ograham@example.net Received: (qmail 39558 invoked by uid 500); 8 Sep 2004 20:50:41 -0000 Delivered-To: ograham@example.net Received: (qmail 39550 invoked by uid 99); 8 Sep 2004 20:50:40 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 13:50:39 -0700 Received: (qmail 59349 invoked by uid 1737); 8 Sep 2004 20:50:37 -0000 Date: 8 Sep 2004 20:50:37 -0000 Message-ID: <ograham@example.net> From: ograham@example.net To: ograham@example.net Subject: cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile/detailed IncrCompilationTests.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N daveremy 2004/09/08 13:50:37 Modified: v2/test/src/compile/scomp/checkin CompilationTests.java Added: v2/test/src/compile/scomp/common CompileCommon.java CompileTestBase.java v2/test/src/compile/scomp/incr/schemaCompile/detailed IncrCompilationTests.java Log: Contributed By: Jacob Danner Added some detailed tests for radu's incremental compilation checkin from a few weeks ago. Revision Changes Path 1.3 +23 -0 xml-xmlbeans/v2/test/src/compile/scomp/checkin/CompilationTests.java Index: CompilationTests.java =================================================================== RCS file: /home/cvs/xml-xmlbeans/v2/test/src/compile/scomp/checkin/CompilationTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CompilationTests.java 7 Aug 2004 01:33:32 -0000 1.2 +++ CompilationTests.java 8 Sep 2004 20:50:37 -0000 1.3 @@ -111,6 +111,14 @@ SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem(); system = XmlBeans.compileXsd(schemas, builtin, options); Assert.assertNotNull("Compilation failed during inititial compile.", system); + System.out.println("-= Initial Compile =-"); + for (int i = 0; i < system.globalTypes().length; i++) { + System.out.println("[" + i + "]-" + system.globalTypes()[i].getName()); + } + + for (int i = 0; i < system.globalElements().length; i++) { + System.out.println("[" + i + "]=" + system.globalElements()[i].getName()); + } // Incremental compile String url = schemas[n - 2].documentProperties().getSourceName(); @@ -121,14 +129,28 @@ system = XmlBeans.compileXsd(system, schemas1, builtin, options); Assert.assertNotNull("Compilation failed during incremental compile.", system); SchemaCodeGenerator.saveTypeSystem(system, outincr, null, null, null); + System.out.println("-= Incremental Compile =-"); + for (int i = 0; i < system.globalTypes().length; i++) { + System.out.println("[" + i + "]-" + system.globalTypes()[i].getName()); + } + for (int i = 0; i < system.globalElements().length; i++) { + System.out.println("[" + i + "]=" + system.globalElements()[i].getName()); + } // Now compile non-incrementally for the purpose of comparing the result errors.clear(); schemas[n-2] = schemas1[0]; system = XmlBeans.compileXsd(schemas, builtin, options); Assert.assertNotNull("Compilation failed during reference compile.", system); SchemaCodeGenerator.saveTypeSystem(system, out, null, null, null); + System.out.println("-= Sanity Compile =-"); + for (int i = 0; i < system.globalTypes().length; i++) { + System.out.println("[" + i + "]-" + system.globalTypes()[i].getName()); + } + for (int i = 0; i < system.globalElements().length; i++) { + System.out.println("[" + i + "]=" + system.globalElements()[i].getName()); + } // Compare the results String oldPropValue = System.getProperty("xmlbeans.diff.diffIndex"); System.setProperty("xmlbeans.diff.diffIndex", "false"); @@ -142,6 +164,7 @@ message.write(((String) errors.get(i)) + "\n"); Assert.fail("Differences encountered:" + message); } + throw new Exception("AHHH"); } public void testSchemaBookmarks() throws Throwable 1.1 xml-xmlbeans/v2/test/src/compile/scomp/common/CompileCommon.java Index: CompileCommon.java =================================================================== /* 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.common; import org.apache.xmlbeans.XmlError; import java.io.File; import java.io.IOException; import java.util.List; /** * @author jacobd * Date: Aug 4, 2004 */ public class CompileCommon { public static final String P = File.separator; public static File fwroot = getRootFile(); public static File caseroot = new File(fwroot, "test" + P + "cases"); //location of files under "cases folder" public static String fileLocation = P + "xbean" + P + "compile" + P + "scomp" + P; public static File outputroot = new File(fwroot, "build" + P + "test" + P + "output"); public static File getRootFile() throws IllegalStateException { try { return new File(System.getProperty("xbean.rootdir")).getCanonicalFile(); } catch (IOException e) { throw new IllegalStateException(e.toString()); } } public static File xbeanCase(String str) { return (new File(caseroot.getPath() + fileLocation, str)); } public static File xbeanOutput(String str) { File result = (new File(outputroot, str)); File parentdir = result.getParentFile(); parentdir.mkdirs(); return result; } public static void deltree(File dir) { if (dir.exists()) { if (dir.isDirectory()) { String[] list = dir.list(); for (int i = 0; i < list.length; i++) deltree(new File(dir, list[i])); } if (!dir.delete()) System.out.println("Could not delete " + dir); //throw new IllegalStateException("Could not delete " + dir); } } public static void listErrors(List errors) { for (int i = 0; i < errors.size(); i++) { XmlError error = (XmlError) errors.get(i); if (error.getSeverity() == XmlError.SEVERITY_ERROR) System.out.println(error.toString()); } } public static boolean isJDK14() { return System.getProperty("java.version").startsWith("1.4"); } } 1.1 xml-xmlbeans/v2/test/src/compile/scomp/common/CompileTestBase.java Index: CompileTestBase.java =================================================================== /* 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.common; import junit.framework.TestCase; import junit.framework.Assert; import org.apache.xmlbeans.impl.tool.SchemaCompiler; import org.apache.xmlbeans.impl.tool.Diff; import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator; import org.apache.xmlbeans.*; import org.w3.x2001.xmlSchema.SchemaDocument; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.io.StringWriter; import java.util.List; import java.util.ArrayList; /** * @author jacobd * Date: Aug 5, 2004 */ public class CompileTestBase extends TestCase { public static final String P = File.separator; public static String outputDir = "compile" + P + "scomp" + P + "incr"; public static String outPath = P + outputDir + P + "out"; public static String sanityPath = P + outputDir + P + "sanity"; public static String incrPath = P + outputDir + P + "outincr"; public SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem(); public File out; public File outincr; public File sanity; public List errors; public XmlOptions xm; public CompileTestBase(String name) { super(name); out = CompileCommon.xbeanOutput(outPath); sanity = CompileCommon.xbeanOutput(sanityPath); outincr = CompileCommon.xbeanOutput(incrPath); errors = new ArrayList(); xm = new XmlOptions(); xm.setErrorListener(errors); xm.setSavePrettyPrint(); } protected SchemaCompiler.Parameters getCompilerParams() { SchemaCompiler.Parameters params = new SchemaCompiler.Parameters(); params.setDownload(true); params.setVerbose(true); return params; } protected SchemaCompiler.Parameters getIncrCompilerParams() { SchemaCompiler.Parameters params = getCompilerParams(); params.setIncrementalSrcGen(true); return params; } protected boolean runCompiler(File[] schemas, String srcDir, String classesDir, String outputDir, SchemaCompiler.Parameters params) { File srcdir = CompileCommon.xbeanOutput(srcDir); File classesdir = CompileCommon.xbeanOutput(classesDir); File outputjar = CompileCommon.xbeanOutput(outputDir); params.setXsdFiles(schemas); params.setSrcDir(srcdir); params.setClassesDir(classesdir); params.setOutputJar(outputjar); return SchemaCompiler.compile(params); } public void log(SchemaTypeSystem sts) { System.out.println("SchemaTypes: " + sts); } public void log(Object[] arr) { for (int i = 0; i < arr.length; i++) System.out.print(arr[i].toString()); } /** * compares type systems and populates error list based on differences in files * * @param out * @param outincr * @param errors */ public void compareandPopErrors(File outDir, File outIncrDir, List errors) { // Compare the results String oldPropValue = System.getProperty("xmlbeans.diff.diffIndex"); System.setProperty("xmlbeans.diff.diffIndex", "false"); errors.clear(); Diff.dirsAsTypeSystems(outDir, outIncrDir, errors); System.setProperty("xmlbeans.diff.diffIndex", oldPropValue == null ? "true" : oldPropValue); } /** * compares type systems and populates error list based on * default out and outincr directories * * @param out * @param outincr * @param errors */ public void compareandPopErrors(List errors) { // Compare the results String oldPropValue = System.getProperty("xmlbeans.diff.diffIndex"); System.setProperty("xmlbeans.diff.diffIndex", "false"); errors.clear(); Diff.dirsAsTypeSystems(out, outincr, errors); System.setProperty("xmlbeans.diff.diffIndex", oldPropValue == null ? "true" : oldPropValue); } /** * take the type system that gets created in compileSchemas() */ public SchemaTypeSystem incrCompileXsd(SchemaTypeSystem system, XmlObject[] schemas, SchemaTypeLoader typepath, XmlOptions options) throws XmlException, IOException { SchemaTypeSystem sts; sts = XmlBeans.compileXsd(system, schemas, builtin, options); Assert.assertNotNull("Compilation failed during Incremental Compile.", sts); SchemaCodeGenerator.saveTypeSystem(sts, outincr, null, null, null); return sts; } /** * Original Compilation to directory specified */ public SchemaTypeSystem compileSchemas(XmlObject[] schemas, SchemaTypeLoader typepath, XmlOptions options, File outDir) throws XmlException, IOException { SchemaTypeSystem system; SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem(); system = XmlBeans.compileXsd(schemas, builtin, options); Assert.assertNotNull("Compilation failed during compile.", system); SchemaCodeGenerator.saveTypeSystem(system, outDir, null, null, null); return system; } //original compile to get base type system public SchemaTypeSystem compileSchemas(XmlObject[] schemas, SchemaTypeLoader typepath, XmlOptions options) throws XmlException, IOException { SchemaTypeSystem system; SchemaTypeSystem builtin = XmlBeans.getBuiltinTypeSystem(); system = XmlBeans.compileXsd(schemas, builtin, options); Assert.assertNotNull("Compilation failed during compile.", system); SchemaCodeGenerator.saveTypeSystem(system, out, null, null, null); return system; } public void handleErrors(List errors) { if (errors.size() > 0) { StringWriter message = new StringWriter(); for (int i = 0; i < errors.size(); i++) message.write(((String) errors.get(i)) + "\n"); Assert.fail("\nDifferences encountered:\n" + message); } } public String getBaseSchema(String namespace, String elTypeName, String elType, String attrTypeName, String attrType) { return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<xs:schema " + "attributeFormDefault=\"unqualified\" elementFormDefault=\"qualified\" " + "targetNamespace=\"http://" + namespace + "\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" >" + "<xs:element name=\"" + elTypeName + "\" type=\"bas:aType\" xmlns:bas=\"http://" + namespace + "\" />" + "<xs:complexType name=\"aType\">" + "<xs:simpleContent>" + "<xs:extension base=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" >" + "<xs:attribute type=\"xs:" + attrType + "\" name=\"" + attrTypeName + "\" />" + "</xs:extension>" + "</xs:simpleContent>" + "</xs:complexType>" + "</xs:schema>"; } public SchemaDocument.Schema[] getSchema(XmlObject schemaObj) throws XmlException { SchemaDocument.Schema[] schemas = new SchemaDocument.Schema[1]; schemas[0] = SchemaDocument.Factory.parse(schemaObj.xmlText()).getSchema(); return schemas; } public SchemaDocument.Schema[] getSchema(XmlObject[] schemaObj) throws XmlException { SchemaDocument.Schema[] schemas = new SchemaDocument.Schema[schemaObj.length]; for (int i = 0; i < schemaObj.length; i++) schemas[i] = SchemaDocument.Factory.parse(schemaObj[i].xmlText()).getSchema(); return schemas; } public void echoSts(SchemaTypeSystem base, SchemaTypeSystem incr) { System.out.println("-= Base =-"); log(base, "base"); System.out.println("-= Incr =-"); log(incr, "incr"); } public void log(SchemaTypeSystem base, String msg) { for (int i = 0; i < base.globalTypes().length; i++) { System.out.println(msg + " [" + i + "]-" + base.globalTypes()[i].getName()); } } public void findElementbyQName(SchemaTypeSystem sts, QName[] lookup) throws Exception { for (int i = 0; i < lookup.length; i++) { if (sts.findElement(lookup[i]) == null) throw new Exception("Element was expected but not found\n" + lookup[i]); } } public static String[] invalidSchemas = { "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" + " <xs:complexType name='base' final='extension'/>\n" + " <xs:complexType name='ext'>\n" + " <xs:complexContent>\n" + " <xs:extension base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" + " <xs:complexType name='base' final='#all'/>\n" + " <xs:complexType name='ext'>\n" + " <xs:complexContent>\n" + " <xs:extension base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='#all'>\n" + " <xs:complexType name='base'/>\n" + " <xs:complexType name='rest'>\n" + " <xs:complexContent>\n" + " <xs:restriction base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='restriction'>\n" + " <xs:complexType name='base'/>\n" + " <xs:complexType name='rest'>\n" + " <xs:complexContent>\n" + " <xs:restriction base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", }; public static String[] validSchemas = { "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" + " <xs:complexType name='base' final='extension'/>\n" + " <xs:complexType name='rest'>\n" + " <xs:complexContent>\n" + " <xs:restriction base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" + " <xs:complexType name='base' final='restriction'/>\n" + " <xs:complexType name='ext'>\n" + " <xs:complexContent>\n" + " <xs:extension base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='restriction'>\n" + " <xs:complexType name='base'/>\n" + " <xs:complexType name='ext'>\n" + " <xs:complexContent>\n" + " <xs:extension base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' finalDefault='extension'>\n" + " <xs:complexType name='base'/>\n" + " <xs:complexType name='rest'>\n" + " <xs:complexContent>\n" + " <xs:restriction base='base'/>\n" + " </xs:complexContent>\n" + " </xs:complexType>\n" + "</xs:schema>\n", }; } 1.1 xml-xmlbeans/v2/test/src/compile/scomp/incr/schemaCompile/detailed/IncrCompilationTests.java Index: IncrCompilationTests.java =================================================================== /* 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.incr.schemaCompile.detailed; import junit.framework.TestCase; import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestSuite; import org.apache.xmlbeans.impl.common.QNameHelper; import org.apache.xmlbeans.impl.tool.SchemaCompiler; import org.apache.xmlbeans.impl.tool.CodeGenUtil; import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator; import org.apache.xmlbeans.impl.tool.Diff; import org.w3.x2001.xmlSchema.SchemaDocument; import org.w3.x2001.xmlSchema.TopLevelComplexType; import org.apache.xmlbeans.*; import java.io.File; import java.io.StringWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Arrays; import java.util.Collections; import tools.util.TestRunUtil; import compile.scomp.common.CompileCommon; import compile.scomp.common.CompileTestBase; import javax.xml.namespace.QName; /** * @author jacobd * Date: Aug 2, 2004 */ public class IncrCompilationTests extends CompileTestBase { public IncrCompilationTests(String name) { super(name); } public static Test suite() { return new TestSuite(IncrCompilationTests.class); } public void setUp() throws IOException { CompileCommon.deltree(CompileCommon.xbeanOutput(outputDir)); out = CompileCommon.xbeanOutput(outPath); sanity = CompileCommon.xbeanOutput(sanityPath); outincr = CompileCommon.xbeanOutput(incrPath); errors = new ArrayList(); xm = new XmlOptions(); xm.setErrorListener(errors); xm.setSavePrettyPrint(); } public void tearDown() throws IOException { if (errors.size() > 0) errors.clear(); } public void test_dupetype_diffns() throws Exception { XmlObject obj1 = XmlObject.Factory.parse(getBaseSchema("baz", "elName", "string", "attrName", "string")); XmlObject obj2 = XmlObject.Factory.parse(getBaseSchema("bar", "elName", "string", "attrName", "string")); XmlObject[] schemas = new XmlObject[]{obj1}; XmlObject[] schemas2 = new XmlObject[]{obj2}; schemas[0].documentProperties().setSourceName("obj1"); schemas2[0].documentProperties().setSourceName("obj2"); SchemaTypeSystem base = compileSchemas(schemas, builtin, xm); SchemaTypeSystem incr; try { incr = incrCompileXsd(base, schemas2, builtin, xm); } catch (XmlException xmlEx) { throw new Exception(xmlEx.getError().toString()); } if (base.findElement(new QName("http://baz", "elName")) == null) throw new Exception("BASE: Baz elName was not found"); if (incr.findElement(new QName("http://baz", "elName")) == null) throw new Exception("INCR: Baz elName was not found"); for (int i = 0; i < incr.globalElements().length; i++) { System.out.println("[" + i + "]-" + incr.globalElements()[i].getName()); } for (int i = 0; i < base.globalElements().length; i++) { System.out.println("[" + i + "]-" + base.globalElements()[i].getName()); } if (incr.findElement(new QName("http://bar", "elName")) == null) throw new Exception("INCR: Bar elName was not found"); compareandPopErrors(out, outincr, errors); handleErrors(errors); } public void test_dupens_difftypename() throws Exception { XmlObject obj1 = XmlObject.Factory.parse(getBaseSchema("baz", "elName", "string", "attrName", "string")); XmlObject obj2 = XmlObject.Factory.parse(getBaseSchema("baz", "elName2", "string", "attrName2", "string")); XmlObject[] schemas = new XmlObject[]{obj1}; XmlObject[] schemas2 = new XmlObject[]{obj2}; schemas[0].documentProperties().setSourceName("obj1"); schemas2[0].documentProperties().setSourceName("obj2"); SchemaTypeSystem base = compileSchemas(schemas, builtin, xm); SchemaTypeSystem incr = incrCompileXsd(base, schemas2, builtin, xm); echoSts(base, incr); QName[] baseTypes = new QName[]{new QName("http://baz", "elName")}; QName[] incrTypes = new QName[]{new QName("http://baz", "elName"), new QName("http://baz", "elName2")}; findElementbyQName(base, baseTypes); findElementbyQName(incr, incrTypes); compareandPopErrors(out, outincr, errors); handleErrors(errors); } /** * This test should not change sts since xmlobject is same * @throws Exception */ public void test_dupens_dupetypename() throws Exception { XmlObject obj1 = XmlObject.Factory.parse(getBaseSchema("baz", "elName", "string", "attrName", "string")); XmlObject obj2 = XmlObject.Factory.parse(getBaseSchema("baz", "elName", "string", "attrName", "string")); XmlObject[] schemas = new XmlObject[]{obj1}; XmlObject[] schemas2 = new XmlObject[]{obj2}; schemas[0].documentProperties().setSourceName("obj1"); schemas2[0].documentProperties().setSourceName("obj2"); SchemaTypeSystem base = compileSchemas(schemas, builtin, xm); SchemaTypeSystem incr = incrCompileXsd(base, schemas2, builtin, xm); echoSts(base, incr); QName[] baseTypes = new QName[]{new QName("http://baz", "elName")}; QName[] incrTypes = new QName[]{new QName("http://baz", "elName")}; findElementbyQName(base, baseTypes); findElementbyQName(incr, incrTypes); Assert.assertEquals(base, incr); compareandPopErrors(out, outincr, errors); handleErrors(errors); } public void test_dupens_attrnamechange() throws Exception { //XmlObject.Factory.parse(getBaseSchema("baz","elName", "elType", "attrName","attrType")); XmlObject obj1 = XmlObject.Factory.parse(getBaseSchema("baz", "elName", "string", "attrName", "string"));
{'source': 'Apache Software Foundation Public Mail Archives'}