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 2006/02/22 07:06:51 UTC
svn commit: r379699 [1/6] - /xerces/java/trunk/tests/schema/annotations/
Author: mrglavas
Date: Tue Feb 21 22:06:48 2006
New Revision: 379699
URL: http://svn.apache.org/viewcvs?rev=379699&view=rev
Log:
Miscellaneous clean-up and update of SVN properties.
Modified:
xerces/java/trunk/tests/schema/annotations/AllTests.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/TestCase.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeUseAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeUseAnnotationsTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeUseAnnotationsTest02.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSAttributeUseAnnotationsTest03.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSElementAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSElementTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSFacetAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSFacetTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSModelGroupAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSModelGroupDefinitionAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSModelGroupDefinitionTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSModelGroupTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSNotationAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSNotationAnnotationsTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSParticleAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSParticleTest01.xsd (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSWildcardAnnotationsTest.java (contents, props changed)
xerces/java/trunk/tests/schema/annotations/XSWildcardTest01.xsd (contents, props changed)
Modified: xerces/java/trunk/tests/schema/annotations/AllTests.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/AllTests.java?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/AllTests.java (original)
+++ xerces/java/trunk/tests/schema/annotations/AllTests.java Tue Feb 21 22:06:48 2006
@@ -1,48 +1,50 @@
-/*
- * Copyright 2006 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 schema.annotations;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * All XSModel Tests
- *
- * @version $Id: $
- */
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(AllTests.suite());
- }
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for Schema Annotations");
- //$JUnit-BEGIN$
- suite.addTestSuite(XSAttributeGroupAnnotationsTest.class);
- suite.addTestSuite(XSNotationAnnotationsTest.class);
- suite.addTestSuite(XSElementAnnotationsTest.class);
- suite.addTestSuite(XSAttributeUseAnnotationsTest.class);
- suite.addTestSuite(XSAttributeAnnotationsTest.class);
- suite.addTestSuite(XSFacetAnnotationsTest.class);
- suite.addTestSuite(XSModelGroupDefinitionAnnotationsTest.class);
- suite.addTestSuite(XSModelGroupAnnotationsTest.class);
- suite.addTestSuite(XSParticleAnnotationsTest.class);
- suite.addTestSuite(XSWildcardAnnotationsTest.class);
- //$JUnit-END$
- return suite;
- }
-
-}
+/*
+ * Copyright 2006 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 schema.annotations;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * All XSModel Tests
+ *
+ * @author Neil Delima, IBM
+ * @version $Id$
+ */
+public class AllTests {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AllTests.suite());
+ }
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for Schema Annotations");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(XSAttributeGroupAnnotationsTest.class);
+ suite.addTestSuite(XSNotationAnnotationsTest.class);
+ suite.addTestSuite(XSElementAnnotationsTest.class);
+ suite.addTestSuite(XSAttributeUseAnnotationsTest.class);
+ suite.addTestSuite(XSAttributeAnnotationsTest.class);
+ suite.addTestSuite(XSFacetAnnotationsTest.class);
+ suite.addTestSuite(XSModelGroupDefinitionAnnotationsTest.class);
+ suite.addTestSuite(XSModelGroupAnnotationsTest.class);
+ suite.addTestSuite(XSParticleAnnotationsTest.class);
+ suite.addTestSuite(XSWildcardAnnotationsTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Propchange: xerces/java/trunk/tests/schema/annotations/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/AllTests.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/TestCase.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/TestCase.java?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/TestCase.java (original)
+++ xerces/java/trunk/tests/schema/annotations/TestCase.java Tue Feb 21 22:06:48 2006
@@ -1,64 +1,83 @@
-package schema.annotations;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URL;
-
-public class TestCase extends junit.framework.TestCase {
-
- public TestCase() {
- }
-
- public TestCase(String test) {
- super(test);
- }
-
- /**
- *
- */
- protected String getResourceURL(String path) {
- // build the location URL of the document
- String packageDir = this.getClass().getPackage().getName().replace('.',
- File.separatorChar);
- String documentPath = packageDir + "/" + path;
- URL url = ClassLoader.getSystemResource(documentPath);
- if (url == null) {
- fail ("Couldn't find xml file for test: " + documentPath);
- }
- // = getClass().getClassLoader().getResource(path);
-
- // System.out.println(url.toExternalForm());
- return url.toExternalForm();
- }
-
- /**
- *
- */
- protected String trim(String toTrim) {
- String replaced = toTrim.replace('\t', ' ');
- replaced = replaced.replace('\n', ' ');
- replaced = replaced.trim();
-
- int i = 0, j = 0;
- char[] src = replaced.toCharArray();
- char[] dest = new char[src.length];
-
- while (i < src.length) {
- if (src [i] != ' ' ) {
- dest[j] = src [i];
- j++;
- }
- i++;
- }
- return String.copyValueOf(dest,0,j-1);
- }
-
- /**
- *
- * @param args
- */
- public static void main(String args[]) {
- junit.textui.TestRunner.run(TestCase.class);
- }
-
-}
+/*
+ * Copyright 2006 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 schema.annotations;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author Neil Delima, IBM
+ * @version $Id$
+ */
+public class TestCase extends junit.framework.TestCase {
+
+ public TestCase() {
+ }
+
+ public TestCase(String test) {
+ super(test);
+ }
+
+ /**
+ *
+ */
+ protected String getResourceURL(String path) {
+ // build the location URL of the document
+ String packageDir = this.getClass().getPackage().getName().replace('.',
+ File.separatorChar);
+ String documentPath = packageDir + "/" + path;
+ URL url = ClassLoader.getSystemResource(documentPath);
+ if (url == null) {
+ fail ("Couldn't find xml file for test: " + documentPath);
+ }
+ // = getClass().getClassLoader().getResource(path);
+
+ // System.out.println(url.toExternalForm());
+ return url.toExternalForm();
+ }
+
+ /**
+ *
+ */
+ protected String trim(String toTrim) {
+ String replaced = toTrim.replace('\t', ' ');
+ replaced = replaced.replace('\n', ' ');
+ replaced = replaced.trim();
+
+ int i = 0, j = 0;
+ char[] src = replaced.toCharArray();
+ char[] dest = new char[src.length];
+
+ while (i < src.length) {
+ if (src [i] != ' ' ) {
+ dest[j] = src [i];
+ j++;
+ }
+ i++;
+ }
+ return String.copyValueOf(dest,0,j-1);
+ }
+
+ /**
+ *
+ * @param args
+ */
+ public static void main(String args[]) {
+ junit.textui.TestRunner.run(TestCase.class);
+ }
+
+}
Propchange: xerces/java/trunk/tests/schema/annotations/TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/TestCase.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java Tue Feb 21 22:06:48 2006
@@ -1,262 +1,263 @@
-/*
- * Copyright 2006 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 schema.annotations;
-
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSImplementation;
-import org.apache.xerces.xs.XSLoader;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSObjectList;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.Document;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-
-/**
- * Tests methods getAnnotation and getAnnotations on XSAttributeDeclaration
- * XSModel components.
- *
- * @version $Id: $
- */
-public class XSAttributeAnnotationsTest extends TestCase {
-
- /**
- * Members that are initialized by setUp() and cleaned up by tearDown().
- * <p>
- *
- * Note that setUp() and tearDown() are called for <em>each</em> test.
- * Different tests do <em>not</em> share the same instance member.
- */
- private XSLoader fSchemaLoader;
-
- private DOMConfiguration fConfig;
-
- /**
- * This method is called before every test case method, to set up the test
- * fixture.
- */
- protected void setUp() {
- try {
- // get DOM Implementation using DOM Registry
- System.setProperty(DOMImplementationRegistry.PROPERTY,
- "org.apache.xerces.dom.DOMXSImplementationSourceImpl");
- DOMImplementationRegistry registry = DOMImplementationRegistry
- .newInstance();
-
- XSImplementation impl = (XSImplementation) registry
- .getDOMImplementation("XS-Loader");
-
- fSchemaLoader = impl.createXSLoader(null);
-
- fConfig = fSchemaLoader.getConfig();
-
- // set validation feature
- fConfig.setParameter("validate", Boolean.TRUE);
-
- } catch (Exception e) {
- fail("Expecting a NullPointerException");
- System.err.println("SETUP FAILED: XSAttributeAnnotationsTest");
- }
- }
-
- /**
- * This method is called before every test case method, to tears down the
- * test fixture.
- */
- protected void tearDown() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.FALSE);
- }
-
- /**
- * Test #1.
- */
- public void testNoAnnotation() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest01.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSAnnotation annotation = attr.getAnnotation();
-
- assertNull(annotation);
- }
-
- /**
- * Test #2.
- */
- public void testNoAnnotations() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest01.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSObjectList annotations = attr.getAnnotations();
-
- assertEquals(0, annotations.getLength());
- }
-
- /**
- * Test #3.
- */
- public void testAnnotation() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest02.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSAnnotation annotation = attr.getAnnotation();
-
- String expectedResult = "<annotation id=\"ANNOT1\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeAnnotationsTest\" >"
- + "<appinfo source=\"None\">"
- + "<!-- No Appinfo -->"
- + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
- + "</annotation>";
-
- String actual = annotation.getAnnotationString();
-
- assertEquals(trim(expectedResult), trim(actual));
- }
-
- /**
- * Test #4.
- */
- public void testAnnotations() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest02.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSObjectList annotations = attr.getAnnotations();
-
- String expectedResult = "<annotation id=\"ANNOT1\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeAnnotationsTest\" >"
- + "<appinfo source=\"None\">"
- + "<!-- No Appinfo -->"
- + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
- + "</annotation>";
-
- for (int i = 0; i < annotations.getLength(); i++) {
- XSAnnotation annotation = (XSAnnotation) annotations.item(i);
- String actual = annotation.getAnnotationString();
- assertEquals(trim(expectedResult), trim(actual));
- }
-
- attr = model.getAttributeDeclaration("attr2",
- "XSAttributeAnnotationsTest");
- annotations = attr.getAnnotations();
-
- expectedResult = "<annotation id=\"ANNOT2\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeAnnotationsTest\" >" + "</annotation>";
-
- for (int i = 0; i < annotations.getLength(); i++) {
- XSAnnotation annotation = (XSAnnotation) annotations.item(i);
- String actual = annotation.getAnnotationString();
- assertEquals(trim(expectedResult), trim(actual));
- }
- }
-
- /**
- * Test #5.
- */
- public void testSyntheticAnnotation() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.TRUE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSAnnotation annotation = attr.getAnnotation();
-
- assertNotNull("Synthetic Annotation Null", annotation);
- }
-
- /**
- * Test #6.
- */
- public void testSyntheticAnnotation6() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.TRUE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSObjectList annotations = attr.getAnnotations();
-
- assertEquals("Synthetic Annotation Empty", 1, annotations.getLength());
- }
-
- /**
- * Test #7
- */
- public void testNoSyntheticAnnotation() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.FALSE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
- "XSAttributeAnnotationsTest");
- XSAnnotation annotation = attr.getAnnotation();
-
- assertNull("Synthetic Annotation Not Null", annotation);
- }
-
- /**
- * Test #8
- */
- public void testSyntheticAnnotationsAbsent() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.TRUE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
-
- XSAttributeDeclaration attr = model.getAttributeDeclaration("attr1",
- "XSAttributeAnnotationsTest");
- XSObjectList annotations = attr.getAnnotations();
-
- assertEquals("Synthetic Annotation Empty", 0, annotations.getLength());
- }
-
- /**
- *
- * @param args
- */
- public static void main(String args[]) {
- junit.textui.TestRunner.run(XSAttributeAnnotationsTest.class);
- }
-
-}
+/*
+ * Copyright 2006 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 schema.annotations;
+
+import org.apache.xerces.xs.XSAnnotation;
+import org.apache.xerces.xs.XSAttributeDeclaration;
+import org.apache.xerces.xs.XSImplementation;
+import org.apache.xerces.xs.XSLoader;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSObjectList;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+
+/**
+ * Tests methods getAnnotation and getAnnotations on XSAttributeDeclaration
+ * XSModel components.
+ *
+ * @author Neil Delima, IBM
+ * @version $Id$
+ */
+public class XSAttributeAnnotationsTest extends TestCase {
+
+ /**
+ * Members that are initialized by setUp() and cleaned up by tearDown().
+ * <p>
+ *
+ * Note that setUp() and tearDown() are called for <em>each</em> test.
+ * Different tests do <em>not</em> share the same instance member.
+ */
+ private XSLoader fSchemaLoader;
+
+ private DOMConfiguration fConfig;
+
+ /**
+ * This method is called before every test case method, to set up the test
+ * fixture.
+ */
+ protected void setUp() {
+ try {
+ // get DOM Implementation using DOM Registry
+ System.setProperty(DOMImplementationRegistry.PROPERTY,
+ "org.apache.xerces.dom.DOMXSImplementationSourceImpl");
+ DOMImplementationRegistry registry = DOMImplementationRegistry
+ .newInstance();
+
+ XSImplementation impl = (XSImplementation) registry
+ .getDOMImplementation("XS-Loader");
+
+ fSchemaLoader = impl.createXSLoader(null);
+
+ fConfig = fSchemaLoader.getConfig();
+
+ // set validation feature
+ fConfig.setParameter("validate", Boolean.TRUE);
+
+ } catch (Exception e) {
+ fail("Expecting a NullPointerException");
+ System.err.println("SETUP FAILED: XSAttributeAnnotationsTest");
+ }
+ }
+
+ /**
+ * This method is called before every test case method, to tears down the
+ * test fixture.
+ */
+ protected void tearDown() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.FALSE);
+ }
+
+ /**
+ * Test #1.
+ */
+ public void testNoAnnotation() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest01.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSAnnotation annotation = attr.getAnnotation();
+
+ assertNull(annotation);
+ }
+
+ /**
+ * Test #2.
+ */
+ public void testNoAnnotations() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest01.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSObjectList annotations = attr.getAnnotations();
+
+ assertEquals(0, annotations.getLength());
+ }
+
+ /**
+ * Test #3.
+ */
+ public void testAnnotation() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest02.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSAnnotation annotation = attr.getAnnotation();
+
+ String expectedResult = "<annotation id=\"ANNOT1\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeAnnotationsTest\" >"
+ + "<appinfo source=\"None\">"
+ + "<!-- No Appinfo -->"
+ + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
+ + "</annotation>";
+
+ String actual = annotation.getAnnotationString();
+
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+
+ /**
+ * Test #4.
+ */
+ public void testAnnotations() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest02.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSObjectList annotations = attr.getAnnotations();
+
+ String expectedResult = "<annotation id=\"ANNOT1\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeAnnotationsTest\" >"
+ + "<appinfo source=\"None\">"
+ + "<!-- No Appinfo -->"
+ + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
+ + "</annotation>";
+
+ for (int i = 0; i < annotations.getLength(); i++) {
+ XSAnnotation annotation = (XSAnnotation) annotations.item(i);
+ String actual = annotation.getAnnotationString();
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+
+ attr = model.getAttributeDeclaration("attr2",
+ "XSAttributeAnnotationsTest");
+ annotations = attr.getAnnotations();
+
+ expectedResult = "<annotation id=\"ANNOT2\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeAnnotationsTest\" >" + "</annotation>";
+
+ for (int i = 0; i < annotations.getLength(); i++) {
+ XSAnnotation annotation = (XSAnnotation) annotations.item(i);
+ String actual = annotation.getAnnotationString();
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+ }
+
+ /**
+ * Test #5.
+ */
+ public void testSyntheticAnnotation() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.TRUE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSAnnotation annotation = attr.getAnnotation();
+
+ assertNotNull("Synthetic Annotation Null", annotation);
+ }
+
+ /**
+ * Test #6.
+ */
+ public void testSyntheticAnnotation6() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.TRUE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSObjectList annotations = attr.getAnnotations();
+
+ assertEquals("Synthetic Annotation Empty", 1, annotations.getLength());
+ }
+
+ /**
+ * Test #7
+ */
+ public void testNoSyntheticAnnotation() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.FALSE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr",
+ "XSAttributeAnnotationsTest");
+ XSAnnotation annotation = attr.getAnnotation();
+
+ assertNull("Synthetic Annotation Not Null", annotation);
+ }
+
+ /**
+ * Test #8
+ */
+ public void testSyntheticAnnotationsAbsent() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.TRUE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeAnnotationsTest03.xsd"));
+
+ XSAttributeDeclaration attr = model.getAttributeDeclaration("attr1",
+ "XSAttributeAnnotationsTest");
+ XSObjectList annotations = attr.getAnnotations();
+
+ assertEquals("Synthetic Annotation Empty", 0, annotations.getLength());
+ }
+
+ /**
+ *
+ * @param args
+ */
+ public static void main(String args[]) {
+ junit.textui.TestRunner.run(XSAttributeAnnotationsTest.class);
+ }
+
+}
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd Tue Feb 21 22:06:48 2006
@@ -1,17 +1,17 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeAnnotationsTest"
- xmlns:sv="XSAttributeAnnotationsTest">
-
- <attribute name="attr" type="string">
- </attribute>
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeAnnotationsTest"
+ xmlns:sv="XSAttributeAnnotationsTest">
+
+ <attribute name="attr" type="string">
+ </attribute>
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest01.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd Tue Feb 21 22:06:48 2006
@@ -1,39 +1,39 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeAnnotationsTest"
- xmlns:sv="XSAttributeAnnotationsTest">
-
- <attribute name="attrx" type="string">
- <annotation id="ANNOTX">
- <appinfo source="None">
- <!-- No Appinfo -->
- </appinfo>
- <documentation>
- <expected>ANNOT1 should be seen<child>blah</child><faa><naa>kaa</naa></faa></expected>
- </documentation>
- </annotation>
- </attribute>
-
- <attribute name="attr" type="string">
- <annotation id="ANNOT1">
- <appinfo source="None">
- <!-- No Appinfo -->
- </appinfo>
- <documentation>ANNOT1 should be seen</documentation>
- </annotation>
- </attribute>
-
- <attribute name="attr2" type="string">
- <annotation id="ANNOT2">
- </annotation>
- </attribute>
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeAnnotationsTest"
+ xmlns:sv="XSAttributeAnnotationsTest">
+
+ <attribute name="attrx" type="string">
+ <annotation id="ANNOTX">
+ <appinfo source="None">
+ <!-- No Appinfo -->
+ </appinfo>
+ <documentation>
+ <expected>ANNOT1 should be seen<child>blah</child><faa><naa>kaa</naa></faa></expected>
+ </documentation>
+ </annotation>
+ </attribute>
+
+ <attribute name="attr" type="string">
+ <annotation id="ANNOT1">
+ <appinfo source="None">
+ <!-- No Appinfo -->
+ </appinfo>
+ <documentation>ANNOT1 should be seen</documentation>
+ </annotation>
+ </attribute>
+
+ <attribute name="attr2" type="string">
+ <annotation id="ANNOT2">
+ </annotation>
+ </attribute>
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest02.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd Tue Feb 21 22:06:48 2006
@@ -1,21 +1,21 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeAnnotationsTest"
- xmlns:sv="XSAttributeAnnotationsTest">
-
- <attribute name="attr" type="string" sa:synth="ANNOT"
- xmlns:sa="SyntheticAnnotationsNS">
- </attribute>
-
- <attribute name="attr1" type="string">
- </attribute>
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeAnnotationsTest"
+ xmlns:sv="XSAttributeAnnotationsTest">
+
+ <attribute name="attr" type="string" sa:synth="ANNOT"
+ xmlns:sa="SyntheticAnnotationsNS">
+ </attribute>
+
+ <attribute name="attr1" type="string">
+ </attribute>
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeAnnotationsTest03.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java Tue Feb 21 22:06:48 2006
@@ -1,283 +1,284 @@
-/*
- * Copyright 2006 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 schema.annotations;
-
-import org.apache.xerces.xs.XSAnnotation;
-import org.apache.xerces.xs.XSAttributeGroupDefinition;
-import org.apache.xerces.xs.XSImplementation;
-import org.apache.xerces.xs.XSLoader;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSObjectList;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-
-/**
- * Tests methods getAnnotation and getAnnotations of XSAttributeGroupDefinition
- * XSModel components
- *
- * @version $Id: $
- */
-public class XSAttributeGroupAnnotationsTest extends TestCase {
-
- /**
- * Members that are initialized by setUp() and cleaned up by tearDown().
- * <p>
- *
- * Note that setUp() and tearDown() are called for <em>each</em> test.
- * Different tests do <em>not</em> share the same instance member.
- */
- private XSLoader fSchemaLoader;
-
- private DOMConfiguration fConfig;
-
- /**
- * This method is called before every test case method, to set up the test
- * fixture.
- */
- protected void setUp() {
- try {
- // get DOM Implementation using DOM Registry
- System.setProperty(DOMImplementationRegistry.PROPERTY,
- "org.apache.xerces.dom.DOMXSImplementationSourceImpl");
- DOMImplementationRegistry registry = DOMImplementationRegistry
- .newInstance();
-
- XSImplementation impl = (XSImplementation) registry
- .getDOMImplementation("XS-Loader");
-
- fSchemaLoader = impl.createXSLoader(null);
-
- fConfig = fSchemaLoader.getConfig();
-
- // set validation feature
- fConfig.setParameter("validate", Boolean.TRUE);
-
- } catch (Exception e) {
- fail("Expecting a NullPointerException");
- System.err.println("SETUP FAILED: XSAttributeGroupAnnotationsTest");
- }
- }
-
- /**
- * This method is called before every test case method, to tears down the
- * test fixture.
- */
- protected void tearDown() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.FALSE);
- }
-
- /**
- * Test #1.
- */
- public void testNoAnnotation() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest01.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSAnnotation annotation = AG.getAnnotation();
-
- assertNull(annotation);
- }
-
- /**
- * Test #2.
- */
- public void testNoAnnotations() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest01.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSObjectList annotations = AG.getAnnotations();
-
- assertEquals(0, annotations.getLength());
- }
-
- /**
- * Test #3.
- */
- public void testAnnotation() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest02.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSAnnotation annotation = AG.getAnnotation();
-
- String expectedResult = "<annotation id=\"ANNOT1\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
- + "<appinfo source=\"None\">"
- + "<!-- No Appinfo -->"
- + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
- + "</annotation>";
-
- String actual = annotation.getAnnotationString();
-
- assertEquals(trim(expectedResult), trim(actual));
- }
-
- /**
- * Test #4.
- */
- public void testAnnotations() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest02.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSObjectList annotations = AG.getAnnotations();
-
- String expectedResult = "<annotation id=\"ANNOT1\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
- + "<appinfo source=\"None\">"
- + "<!-- No Appinfo -->"
- + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
- + "</annotation>";
-
- for (int i = 0; i < annotations.getLength(); i++) {
- XSAnnotation annotation = (XSAnnotation) annotations.item(i);
- String actual = annotation.getAnnotationString();
- assertEquals(trim(expectedResult), trim(actual));
- }
-
- AG = model.getAttributeGroup("AG2", "XSAttributeGroupAnnotationsTest");
- annotations = AG.getAnnotations();
-
- expectedResult = "<annotation id=\"ANNOT2\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
- + "</annotation>";
-
- for (int i = 0; i < annotations.getLength(); i++) {
- XSAnnotation annotation = (XSAnnotation) annotations.item(i);
- String actual = annotation.getAnnotationString();
- assertEquals(trim(expectedResult), trim(actual));
- }
- }
-
- /**
- * Test #5.
- */
- public void testSyntheticAnnotation() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.TRUE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSAnnotation annotation = AG.getAnnotation();
-
- assertNotNull("Synthetic Annotation Null", annotation);
- }
-
- /**
- * Test #6.
- */
- public void testSyntheticAnnotation6() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.TRUE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSObjectList annotations = AG.getAnnotations();
-
- assertEquals("Synthetic Annotation Empty", 1, annotations.getLength());
- }
-
- /**
- * Test #7
- */
- public void testNoSyntheticAnnotation() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.FALSE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
- XSAnnotation annotation = AG.getAnnotation();
-
- assertNull("Synthetic Annotation Not Null", annotation);
- }
-
- /**
- * Test #8
- */
- public void testSyntheticAnnotationsAbsent() {
- fConfig
- .setParameter(
- "http://apache.org/xml/features/generate-synthetic-annotations",
- Boolean.TRUE);
-
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG1",
- "XSAttributeGroupAnnotationsTest");
- XSObjectList annotations = AG.getAnnotations();
-
- assertEquals("Synthetic Annotation Empty", 0, annotations.getLength());
- }
-
- /**
- * Test #9.
- */
- public void testAnnotationsInGroup() {
- XSModel model = fSchemaLoader
- .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest04.xsd"));
-
- XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
- "XSAttributeGroupAnnotationsTest");
-
- XSObjectList annotations = AG.getAnnotations();
-
- String expectedResult = "<annotation id=\"ANNOT1\" "
- + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
- + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
- + "<appinfo source=\"None\">"
- + "<!-- No Appinfo -->"
- + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
- + "</annotation>";
-
- for (int i = 0; i < annotations.getLength(); i++) {
- XSAnnotation annotation = (XSAnnotation) annotations.item(i);
- String actual = annotation.getAnnotationString();
- assertEquals(trim(expectedResult), trim(actual));
- }
- }
-
- public static void main(String args[]) {
- junit.textui.TestRunner.run(XSAttributeGroupAnnotationsTest.class);
- }
-}
+/*
+ * Copyright 2006 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 schema.annotations;
+
+import org.apache.xerces.xs.XSAnnotation;
+import org.apache.xerces.xs.XSAttributeGroupDefinition;
+import org.apache.xerces.xs.XSImplementation;
+import org.apache.xerces.xs.XSLoader;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSObjectList;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+
+/**
+ * Tests methods getAnnotation and getAnnotations of XSAttributeGroupDefinition
+ * XSModel components
+ *
+ * @author Neil Delima, IBM
+ * @version $Id$
+ */
+public class XSAttributeGroupAnnotationsTest extends TestCase {
+
+ /**
+ * Members that are initialized by setUp() and cleaned up by tearDown().
+ * <p>
+ *
+ * Note that setUp() and tearDown() are called for <em>each</em> test.
+ * Different tests do <em>not</em> share the same instance member.
+ */
+ private XSLoader fSchemaLoader;
+
+ private DOMConfiguration fConfig;
+
+ /**
+ * This method is called before every test case method, to set up the test
+ * fixture.
+ */
+ protected void setUp() {
+ try {
+ // get DOM Implementation using DOM Registry
+ System.setProperty(DOMImplementationRegistry.PROPERTY,
+ "org.apache.xerces.dom.DOMXSImplementationSourceImpl");
+ DOMImplementationRegistry registry = DOMImplementationRegistry
+ .newInstance();
+
+ XSImplementation impl = (XSImplementation) registry
+ .getDOMImplementation("XS-Loader");
+
+ fSchemaLoader = impl.createXSLoader(null);
+
+ fConfig = fSchemaLoader.getConfig();
+
+ // set validation feature
+ fConfig.setParameter("validate", Boolean.TRUE);
+
+ } catch (Exception e) {
+ fail("Expecting a NullPointerException");
+ System.err.println("SETUP FAILED: XSAttributeGroupAnnotationsTest");
+ }
+ }
+
+ /**
+ * This method is called before every test case method, to tears down the
+ * test fixture.
+ */
+ protected void tearDown() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.FALSE);
+ }
+
+ /**
+ * Test #1.
+ */
+ public void testNoAnnotation() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest01.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSAnnotation annotation = AG.getAnnotation();
+
+ assertNull(annotation);
+ }
+
+ /**
+ * Test #2.
+ */
+ public void testNoAnnotations() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest01.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSObjectList annotations = AG.getAnnotations();
+
+ assertEquals(0, annotations.getLength());
+ }
+
+ /**
+ * Test #3.
+ */
+ public void testAnnotation() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest02.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSAnnotation annotation = AG.getAnnotation();
+
+ String expectedResult = "<annotation id=\"ANNOT1\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
+ + "<appinfo source=\"None\">"
+ + "<!-- No Appinfo -->"
+ + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
+ + "</annotation>";
+
+ String actual = annotation.getAnnotationString();
+
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+
+ /**
+ * Test #4.
+ */
+ public void testAnnotations() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest02.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSObjectList annotations = AG.getAnnotations();
+
+ String expectedResult = "<annotation id=\"ANNOT1\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
+ + "<appinfo source=\"None\">"
+ + "<!-- No Appinfo -->"
+ + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
+ + "</annotation>";
+
+ for (int i = 0; i < annotations.getLength(); i++) {
+ XSAnnotation annotation = (XSAnnotation) annotations.item(i);
+ String actual = annotation.getAnnotationString();
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+
+ AG = model.getAttributeGroup("AG2", "XSAttributeGroupAnnotationsTest");
+ annotations = AG.getAnnotations();
+
+ expectedResult = "<annotation id=\"ANNOT2\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
+ + "</annotation>";
+
+ for (int i = 0; i < annotations.getLength(); i++) {
+ XSAnnotation annotation = (XSAnnotation) annotations.item(i);
+ String actual = annotation.getAnnotationString();
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+ }
+
+ /**
+ * Test #5.
+ */
+ public void testSyntheticAnnotation() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.TRUE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSAnnotation annotation = AG.getAnnotation();
+
+ assertNotNull("Synthetic Annotation Null", annotation);
+ }
+
+ /**
+ * Test #6.
+ */
+ public void testSyntheticAnnotation6() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.TRUE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSObjectList annotations = AG.getAnnotations();
+
+ assertEquals("Synthetic Annotation Empty", 1, annotations.getLength());
+ }
+
+ /**
+ * Test #7
+ */
+ public void testNoSyntheticAnnotation() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.FALSE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+ XSAnnotation annotation = AG.getAnnotation();
+
+ assertNull("Synthetic Annotation Not Null", annotation);
+ }
+
+ /**
+ * Test #8
+ */
+ public void testSyntheticAnnotationsAbsent() {
+ fConfig
+ .setParameter(
+ "http://apache.org/xml/features/generate-synthetic-annotations",
+ Boolean.TRUE);
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest03.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG1",
+ "XSAttributeGroupAnnotationsTest");
+ XSObjectList annotations = AG.getAnnotations();
+
+ assertEquals("Synthetic Annotation Empty", 0, annotations.getLength());
+ }
+
+ /**
+ * Test #9.
+ */
+ public void testAnnotationsInGroup() {
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSAttributeGroupAnnotationsTest04.xsd"));
+
+ XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
+ "XSAttributeGroupAnnotationsTest");
+
+ XSObjectList annotations = AG.getAnnotations();
+
+ String expectedResult = "<annotation id=\"ANNOT1\" "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSAttributeGroupAnnotationsTest\" >"
+ + "<appinfo source=\"None\">"
+ + "<!-- No Appinfo -->"
+ + "</appinfo><documentation>ANNOT1 should be seen</documentation>"
+ + "</annotation>";
+
+ for (int i = 0; i < annotations.getLength(); i++) {
+ XSAnnotation annotation = (XSAnnotation) annotations.item(i);
+ String actual = annotation.getAnnotationString();
+ assertEquals(trim(expectedResult), trim(actual));
+ }
+ }
+
+ public static void main(String args[]) {
+ junit.textui.TestRunner.run(XSAttributeGroupAnnotationsTest.class);
+ }
+}
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd Tue Feb 21 22:06:48 2006
@@ -1,18 +1,18 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeGroupAnnotationsTest"
- xmlns:sv="XSAttributeGroupAnnotationsTest">
-
- <attributeGroup name="AG">
-
- </attributeGroup>
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeGroupAnnotationsTest"
+ xmlns:sv="XSAttributeGroupAnnotationsTest">
+
+ <attributeGroup name="AG">
+
+ </attributeGroup>
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest01.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd Tue Feb 21 22:06:48 2006
@@ -1,28 +1,28 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeGroupAnnotationsTest"
- xmlns:sv="XSAttributeGroupAnnotationsTest">
-
- <attributeGroup name="AG">
- <annotation id="ANNOT1">
- <appinfo source="None">
- <!-- No Appinfo -->
- </appinfo>
- <documentation>ANNOT1 should be seen</documentation>
- </annotation>
- </attributeGroup>
-
- <attributeGroup name="AG2" >
- <annotation id="ANNOT2">
- </annotation>
- </attributeGroup >
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeGroupAnnotationsTest"
+ xmlns:sv="XSAttributeGroupAnnotationsTest">
+
+ <attributeGroup name="AG">
+ <annotation id="ANNOT1">
+ <appinfo source="None">
+ <!-- No Appinfo -->
+ </appinfo>
+ <documentation>ANNOT1 should be seen</documentation>
+ </annotation>
+ </attributeGroup>
+
+ <attributeGroup name="AG2" >
+ <annotation id="ANNOT2">
+ </annotation>
+ </attributeGroup >
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest02.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd Tue Feb 21 22:06:48 2006
@@ -1,21 +1,21 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeGroupAnnotationsTest"
- xmlns:sv="XSAttributeGroupAnnotationsTest">
-
- <attributeGroup name="AG" sa:synth="ANNOT"
- xmlns:sa="SyntheticAnnotationsNS">
- </attributeGroup >
-
- <attributeGroup name="AG1" >
- </attributeGroup >
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeGroupAnnotationsTest"
+ xmlns:sv="XSAttributeGroupAnnotationsTest">
+
+ <attributeGroup name="AG" sa:synth="ANNOT"
+ xmlns:sa="SyntheticAnnotationsNS">
+ </attributeGroup >
+
+ <attributeGroup name="AG1" >
+ </attributeGroup >
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest03.xsd
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.xsd?rev=379699&r1=379698&r2=379699&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.xsd Tue Feb 21 22:06:48 2006
@@ -1,42 +1,42 @@
-<?xml version="1.0"?>
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="XSAttributeGroupAnnotationsTest"
- xmlns:sv="XSAttributeGroupAnnotationsTest">
-
- <attributeGroup name="AG">
- <annotation id="ANNOT1">
- <appinfo source="None">
- <!-- No Appinfo -->
- </appinfo>
- <documentation>ANNOT1 should be seen</documentation>
- </annotation>
- <attribute name="attr" type="string">
- <annotation id="ANNOT2">
- <appinfo source="None">
- <!-- No Appinfo -->
- </appinfo>
- <documentation>ANNOT2 should be seen</documentation>
- </annotation>
- </attribute>
- </attributeGroup>
-
- <element name="root">
- <complexType>
- <sequence>
- <element name="elString" type="string" />
- </sequence>
- <attributeGroup ref="sv:AG">
-
- <!-- THESE ANNOTATIONS ARE LOST -->
- <annotation id="ANNOT3">
- <appinfo source="None">
- <!-- No Appinfo -->
- </appinfo>
- <documentation>ANNOT3 will be lost.</documentation>
- </annotation>
-
- </attributeGroup>
- </complexType>
- </element>
-
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="XSAttributeGroupAnnotationsTest"
+ xmlns:sv="XSAttributeGroupAnnotationsTest">
+
+ <attributeGroup name="AG">
+ <annotation id="ANNOT1">
+ <appinfo source="None">
+ <!-- No Appinfo -->
+ </appinfo>
+ <documentation>ANNOT1 should be seen</documentation>
+ </annotation>
+ <attribute name="attr" type="string">
+ <annotation id="ANNOT2">
+ <appinfo source="None">
+ <!-- No Appinfo -->
+ </appinfo>
+ <documentation>ANNOT2 should be seen</documentation>
+ </annotation>
+ </attribute>
+ </attributeGroup>
+
+ <element name="root">
+ <complexType>
+ <sequence>
+ <element name="elString" type="string" />
+ </sequence>
+ <attributeGroup ref="sv:AG">
+
+ <!-- THESE ANNOTATIONS ARE LOST -->
+ <annotation id="ANNOT3">
+ <appinfo source="None">
+ <!-- No Appinfo -->
+ </appinfo>
+ <documentation>ANNOT3 will be lost.</documentation>
+ </annotation>
+
+ </attributeGroup>
+ </complexType>
+ </element>
+
</schema>
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/java/trunk/tests/schema/annotations/XSAttributeGroupAnnotationsTest04.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