You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2012/08/21 17:47:20 UTC
svn commit: r1375617 - in
/xerces/java/branches/xml-schema-1.1-dev/tests/schema/config:
SurrogatePairLengthTest.java surrogate.xml surrogate.xsd
Author: mrglavas
Date: Tue Aug 21 15:47:19 2012
New Revision: 1375617
URL: http://svn.apache.org/viewvc?rev=1375617&view=rev
Log:
Adding tests for the org.apache.xerces.impl.dv.xs.useCodePointCountForStringLength system property.
Added:
xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java (with props)
xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml (with props)
xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd (with props)
Added: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java?rev=1375617&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java (added)
+++ xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java Tue Aug 21 15:47:19 2012
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 schema.config;
+
+import junit.framework.Assert;
+
+import org.apache.xerces.dom.PSVIElementNSImpl;
+import org.apache.xerces.xs.ItemPSVI;
+
+/**
+ * @version $Id$
+ */
+public class SurrogatePairLengthTest extends BaseTest {
+
+ // Can only test when the property is set
+ static {
+ System.setProperty("org.apache.xerces.impl.dv.xs.useCodePointCountForStringLength", "true");
+ }
+
+ private static final String LENGTH_ERROR = "cvc-length-valid";
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(SurrogatePairLengthTest.class);
+ }
+
+ protected String getXMLDocument() {
+ return "surrogate.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "surrogate.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { LENGTH_ERROR };
+ }
+
+ public SurrogatePairLengthTest(String name) {
+ super(name);
+ }
+
+ // Can only test when the property is set
+ public void testSetTrue() {
+ try {
+ validateDocument();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Validation failed: " + e.getMessage());
+ }
+
+ checkValidResult();
+ }
+
+ private void checkValidResult() {
+ assertNoError(LENGTH_ERROR);
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("root", fRootNode.getElementDeclaration().getName());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("e1", child.getElementDeclaration().getName());
+ assertTypeName("length", child.getTypeDefinition().getName());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("e2", child.getElementDeclaration().getName());
+ assertTypeName("length", child.getTypeDefinition().getName());
+ }
+}
Propchange: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/SurrogatePairLengthTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml?rev=1375617&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml (added)
+++ xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml Tue Aug 21 15:47:19 2012
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <e1>𐀀t</e1>
+ <e2 xsi:type="length">𐀀t</e2>
+</root>
\ No newline at end of file
Propchange: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd?rev=1375617&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd Tue Aug 21 15:47:19 2012
@@ -0,0 +1,15 @@
+<xs:schema xmlns:xs ="http://www.w3.org/2001/XMLSchema">
+ <xs:simpleType name="length">
+ <xs:restriction base="xs:string">
+ <xs:length value="3"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="root">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="e1" type="length"/>
+ <xs:element name="e2" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Propchange: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/branches/xml-schema-1.1-dev/tests/schema/config/surrogate.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org