You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by bi...@apache.org on 2008/12/17 03:39:54 UTC
svn commit: r727246 [7/8] - in /webservices/commons/trunk/modules/XmlSchema:
./ etc/ etc/eclipse/ src/main/java/org/apache/ws/commons/schema/
src/main/java/org/apache/ws/commons/schema/constants/
src/main/java/org/apache/ws/commons/schema/extensions/ s...
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,14 +19,6 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import org.xml.sax.InputSource;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
@@ -34,6 +26,26 @@
import java.util.HashSet;
import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAny;
+import org.apache.ws.commons.schema.XmlSchemaAnyAttribute;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaContentProcessing;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
/*
* Copyright 2004,2007 The Apache Software Foundation.
* Copyright 2006 International Business Machines Corp.
@@ -51,13 +63,14 @@
* limitations under the License.
*
*/
-public class AnyTest extends TestCase {
+public class AnyTest extends Assert {
/**
* This method will test the any.
*
* @throws Exception Any exception encountered
*/
+ @Test
public void testAny() throws Exception {
/*
@@ -68,15 +81,16 @@
* maxOccurs="10"/> </sequence> </complexType> </element> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "department");
+ QName elementQName = new QName("http://soapinterop.org/types", "department");
InputStream is = new FileInputStream(Resources.asURI("any.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- verifyAccuracy(ELEMENT_QNAME, schemaCol, 5L, 10L);
+ verifyAccuracy(elementQName, schemaCol, 5L, 10L);
}
+ @Test
public void testAnyAttribute() throws Exception {
InputStream is = new FileInputStream(Resources.asURI("anyAttribute.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
@@ -104,6 +118,7 @@
assertNotNull(aa);
}
+ @Test
public void testAnyZeroOccurs() throws Exception {
/*
@@ -114,7 +129,7 @@
* maxOccurs="10"/> </sequence> </complexType> </element> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "department");
+ QName elementQName = new QName("http://soapinterop.org/types", "department");
InputStream is = new FileInputStream(Resources.asURI("anyZero.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
@@ -125,13 +140,13 @@
XmlSchemaCollection schemaCol2 = new XmlSchemaCollection();
schemaCol2.read(new StreamSource(new ByteArrayInputStream(baos.toByteArray())), null);
- verifyAccuracy(ELEMENT_QNAME, schemaCol2, 0, 0);
+ verifyAccuracy(elementQName, schemaCol2, 0, 0);
}
- private void verifyAccuracy(QName ELEMENT_QNAME, XmlSchemaCollection schemaCol, long minCount,
+ private void verifyAccuracy(QName elementQName, XmlSchemaCollection schemaCol, long minCount,
long maxCount) {
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("department", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "department"), elem.getQName());
@@ -145,7 +160,7 @@
XmlSchemaObjectCollection c = xss.getItems();
assertEquals(3, c.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add("id");
s.add("name");
Object o = null;
@@ -153,10 +168,10 @@
o = c.getItem(i);
if (o instanceof XmlSchemaElement) {
String name = ((XmlSchemaElement)o).getName();
- if (name.equals("id")) {
+ if ("id".equals(name)) {
assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"),
((XmlSchemaElement)o).getSchemaTypeName());
- } else if (name.equals("name")) {
+ } else if ("name".equals(name)) {
assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
((XmlSchemaElement)o).getSchemaTypeName());
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AppInfoMarkupTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AppInfoMarkupTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AppInfoMarkupTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AppInfoMarkupTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -27,14 +27,18 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
+
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
-import org.w3c.dom.Document;
-public class AppInfoMarkupTest extends XMLTestCase {
+import org.junit.Test;
+public class AppInfoMarkupTest extends XMLTestCase {
+ @Test
public void testAppInfo() throws Exception {
DocumentBuilder b = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document pureDOMDocument = b.parse(new FileInputStream(Resources.asURI("appInfo.xsd")));
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeGroupTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,15 +19,25 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Iterator;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAttribute;
+import org.apache.ws.commons.schema.XmlSchemaAttributeGroup;
+import org.apache.ws.commons.schema.XmlSchemaAttributeGroupRef;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaObjectTable;
+
/*
* Copyright 2004,2007 The Apache Software Foundation.
* Copyright 2006 International Business Machines Corp.
@@ -62,12 +72,12 @@
* <complexType> <attributeGroup ref="tns:department"/> </complexType> </element> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "member");
+ QName elementQName = new QName("http://soapinterop.org/types", "member");
InputStream is = new FileInputStream(Resources.asURI("attributegroup.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("member", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "member"), elem.getQName());
@@ -99,11 +109,11 @@
for (Iterator j = attributes.getIterator(); j.hasNext();) {
XmlSchemaAttribute obj2 = (XmlSchemaAttribute)j.next();
String name = obj2.getName();
- if (name.equals("id")) {
+ if ("id".equals(name)) {
assertEquals(new QName("http://soapinterop.org/types", "id"), obj2.getQName());
assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"), obj2
.getSchemaTypeName());
- } else if (name.equals("name")) {
+ } else if ("name".equals(name)) {
assertEquals(new QName("http://soapinterop.org/types", "name"), obj2.getQName());
assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), obj2
.getSchemaTypeName());
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeRefTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeRefTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeRefTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AttributeRefTest.java Tue Dec 16 18:39:50 2008
@@ -1,14 +1,36 @@
+/**
+ * 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 tests;
-import junit.framework.TestCase;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.util.Iterator;
-import org.apache.ws.commons.schema.*;
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAttribute;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
/*
* Copyright 2004,2007 The Apache Software Foundation.
@@ -30,13 +52,13 @@
public class AttributeRefTest extends TestCase {
public void testAttRefsWithNS() throws Exception {
- QName TYPE_QNAME = new QName("http://tempuri.org/attribute", "TestAttributeReferenceType");
+ QName typeQName = new QName("http://tempuri.org/attribute", "TestAttributeReferenceType");
InputStream is = new FileInputStream(Resources.asURI("attributref.xsd"));
XmlSchemaCollection schema = new XmlSchemaCollection();
XmlSchema s = schema.read(new StreamSource(is), null);
- XmlSchemaComplexType typeByName = (XmlSchemaComplexType)s.getTypeByName(TYPE_QNAME);
+ XmlSchemaComplexType typeByName = (XmlSchemaComplexType)s.getTypeByName(typeQName);
assertNotNull(typeByName);
XmlSchemaAttribute item = (XmlSchemaAttribute)typeByName.getAttributes().getItem(0);
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,25 +19,27 @@
package tests;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
public class BlockTest extends TestCase {
public void testMixedContent() throws Exception {
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/xsd", "complexElt");
+ QName elementQName = new QName("http://soapinterop.org/xsd", "complexElt");
InputStream is = new FileInputStream(Resources.asURI("block.xsd"));
XmlSchemaCollection schema = new XmlSchemaCollection();
XmlSchema s = schema.read(new StreamSource(is), null);
- XmlSchemaElement elementByName = s.getElementByName(ELEMENT_QNAME);
+ XmlSchemaElement elementByName = s.getElementByName(elementQName);
assertNotNull(elementByName);
String value = elementByName.getBlock().getValue();
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ChoiceTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ChoiceTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ChoiceTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,34 +19,23 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- */
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchemaChoice;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+
public class ChoiceTest extends TestCase {
/**
@@ -70,8 +59,8 @@
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- QName WRONG_QNAME = new QName("http://soapinterop.org/types", "machine");
- XmlSchemaElement elem = schemaCol.getElementByQName(WRONG_QNAME);
+ QName wrongQName = new QName("http://soapinterop.org/types", "machine");
+ XmlSchemaElement elem = schemaCol.getElementByQName(wrongQName);
assertNull(elem);
elem = schemaCol.getElementByQName(computerElementQname);
assertEquals("computer", elem.getName());
@@ -83,7 +72,7 @@
XmlSchemaChoice choice = (XmlSchemaChoice)cType.getParticle();
assertNotNull(choice);
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add("desktop");
s.add("laptop");
XmlSchemaObjectCollection items = choice.getItems();
@@ -91,10 +80,10 @@
while (iterator.hasNext()) {
XmlSchemaElement e = (XmlSchemaElement)iterator.next();
String eName = e.getName();
- if (eName.equals("desktop")) {
+ if ("desktop".equals(eName)) {
assertEquals(new QName("", "desktop"), e.getQName());
assertEquals(e.getName(), "desktop");
- } else if (eName.equals("laptop")) {
+ } else if ("laptop".equals(eName)) {
assertEquals(new QName("", "laptop"), e.getQName());
assertEquals(e.getName(), "laptop");
} else {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/CircularSchemaTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/CircularSchemaTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/CircularSchemaTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/CircularSchemaTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -18,13 +18,15 @@
*/
package tests;
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.xml.sax.InputSource;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.xml.sax.InputSource;
-
-import java.io.File;
-import java.io.FileInputStream;
public class CircularSchemaTest extends TestCase {
public void testCircular() throws Exception {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ComplexContentRestrictionTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ComplexContentRestrictionTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ComplexContentRestrictionTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ComplexContentRestrictionTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,33 +19,24 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- */
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaContentModel;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+
public class ComplexContentRestrictionTest extends TestCase {
/**
@@ -66,12 +57,12 @@
* type="string"/> </sequence> </restriction> </complexContent> </complexType> </schema>
*/
- QName TYPE_QNAME = new QName("http://soapinterop.org/types", "NoAssemblyRequiredProduct");
+ QName typeQName = new QName("http://soapinterop.org/types", "NoAssemblyRequiredProduct");
InputStream is = new FileInputStream(Resources.asURI("deriverestriction.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaComplexType cType = (XmlSchemaComplexType)schemaCol.getTypeByQName(TYPE_QNAME);
+ XmlSchemaComplexType cType = (XmlSchemaComplexType)schemaCol.getTypeByQName(typeQName);
assertNotNull(cType);
XmlSchemaContentModel xscm = cType.getContentModel();
@@ -86,26 +77,29 @@
XmlSchemaObjectCollection col = xsp.getItems();
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add("Name");
s.add("Description");
s.add("Parts");
for (int i = 0; i < col.getCount(); i++) {
XmlSchemaElement xse = (XmlSchemaElement)col.getItem(i);
String name = xse.getName();
- if (name.equals("Name")) {
+ if ("Name".equals(name)) {
assertEquals(new QName("", "Name"), xse.getQName());
- assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), xse.getSchemaTypeName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
+ xse.getSchemaTypeName());
assertTrue(!xse.isAbstract());
assertTrue(!xse.isNillable());
- } else if (name.equals("Description")) {
+ } else if ("Description".equals(name)) {
assertEquals(new QName("", "Description"), xse.getQName());
- assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), xse.getSchemaTypeName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema",
+ "string"), xse.getSchemaTypeName());
assertTrue(!xse.isAbstract());
assertTrue(xse.isNillable());
- } else if (name.equals("Parts")) {
+ } else if ("Parts".equals(name)) {
assertEquals(new QName("", "Parts"), xse.getQName());
- assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), xse.getSchemaTypeName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
+ xse.getSchemaTypeName());
} else {
fail("An invalid name of \"" + name + "\" was found.");
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ConstraintsTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ConstraintsTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ConstraintsTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ConstraintsTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,34 +19,24 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- * @author Brent Ulbricht
- */
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaKey;
+import org.apache.ws.commons.schema.XmlSchemaKeyref;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaUnique;
+import org.apache.ws.commons.schema.XmlSchemaXPath;
+
public class ConstraintsTest extends TestCase {
/**
@@ -77,12 +67,12 @@
* </element> </sequence> </complexType> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "constraintTest");
+ QName elementQName = new QName("http://soapinterop.org/types", "constraintTest");
InputStream is = new FileInputStream(Resources.asURI("constraints.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("constraintTest", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "constraintTest"), elem.getQName());
@@ -90,7 +80,7 @@
XmlSchemaObjectCollection c = elem.getConstraints();
assertEquals(3, c.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaKey.class.getName());
s.add(XmlSchemaKeyref.class.getName());
s.add(XmlSchemaUnique.class.getName());
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefs2Test.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefs2Test.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefs2Test.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefs2Test.java Tue Dec 16 18:39:50 2008
@@ -1,32 +1,57 @@
+/**
+ * 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 tests;
-import junit.framework.TestCase;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
-import java.util.Iterator;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.stream.StreamSource;
-import org.apache.ws.commons.schema.*;
import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
public class ElementRefs2Test extends TestCase {
public void testElementRefs() throws Exception {
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "attTests");
+ QName elementQName = new QName("http://soapinterop.org/types", "attTests");
InputStream is = new FileInputStream(Resources.asURI("elementreferences2.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefsTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefsTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefsTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ElementRefsTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,24 +19,31 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Iterator;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+
public class ElementRefsTest extends TestCase {
public void testElementRefs() throws Exception {
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "attTests");
+ QName elementQName = new QName("http://soapinterop.org/types", "attTests");
InputStream is = new FileInputStream(Resources.asURI("elementreferences.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EncodingTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EncodingTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EncodingTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EncodingTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,19 +19,21 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.w3c.dom.Document;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.HashMap;
-import java.util.Map;
+import org.w3c.dom.Document;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
public class EncodingTest extends TestCase {
@@ -58,7 +60,7 @@
// write it back to a stream - re read it and check the encoding
// we need to explicitly say to have the xml header
- Map options = new HashMap();
+ Map<String, String> options = new HashMap<String, String>();
options.put(OutputKeys.OMIT_XML_DECLARATION, "no");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EnumValueTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EnumValueTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EnumValueTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/EnumValueTest.java Tue Dec 16 18:39:50 2008
@@ -1,12 +1,31 @@
+/**
+ * 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 tests;
-import junit.framework.TestCase;
-
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
/**
* Created by IntelliJ IDEA. User: ajith
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ExternalAttTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ExternalAttTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ExternalAttTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ExternalAttTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,14 +19,17 @@
package tests;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.constants.Constants;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.util.Map;
public class ExternalAttTest extends TestCase {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/FacetsTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -18,17 +18,35 @@
*/
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet;
+import org.apache.ws.commons.schema.XmlSchemaFractionDigitsFacet;
+import org.apache.ws.commons.schema.XmlSchemaLengthFacet;
+import org.apache.ws.commons.schema.XmlSchemaMaxExclusiveFacet;
+import org.apache.ws.commons.schema.XmlSchemaMaxInclusiveFacet;
+import org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet;
+import org.apache.ws.commons.schema.XmlSchemaMinExclusiveFacet;
+import org.apache.ws.commons.schema.XmlSchemaMinInclusiveFacet;
+import org.apache.ws.commons.schema.XmlSchemaMinLengthFacet;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaPatternFacet;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
+import org.apache.ws.commons.schema.XmlSchemaTotalDigitsFacet;
+import org.apache.ws.commons.schema.XmlSchemaWhiteSpaceFacet;
+
public class FacetsTest extends TestCase {
/**
@@ -43,12 +61,12 @@
* value="\d{5}"/> </restriction> </simpleType> <element name="myZipCode" type="tns:zipCode"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myZipCode");
+ QName elementQName = new QName("http://soapinterop.org/types", "myZipCode");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myZipCode", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myZipCode"), elem.getQName());
@@ -65,7 +83,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(2, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaLengthFacet.class.getName());
s.add(XmlSchemaPatternFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
@@ -106,12 +124,12 @@
* </restriction> </simpleType> <element name="myCreditCardNumber" type="tns:creditCardNumber"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myCreditCardNumber");
+ QName elementQName = new QName("http://soapinterop.org/types", "myCreditCardNumber");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myCreditCardNumber", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myCreditCardNumber"), elem.getQName());
@@ -128,7 +146,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(1, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaPatternFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
Object o = i.next();
@@ -161,12 +179,12 @@
* </simpleType> <element name="myAge" type="tns:age"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myAge");
+ QName elementQName = new QName("http://soapinterop.org/types", "myAge");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myAge", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myAge"), elem.getQName());
@@ -183,7 +201,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(1, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaTotalDigitsFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
Object o = i.next();
@@ -217,12 +235,12 @@
* type="tns:distance"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myDistance");
+ QName elementQName = new QName("http://soapinterop.org/types", "myDistance");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myDistance", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myDistance"), elem.getQName());
@@ -239,7 +257,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(2, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaMaxInclusiveFacet.class.getName());
s.add(XmlSchemaMinInclusiveFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
@@ -280,12 +298,12 @@
* value="1"/> </restriction> </simpleType> <element name="myWeight" type="tns:weight"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myWeight");
+ QName elementQName = new QName("http://soapinterop.org/types", "myWeight");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myWeight", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myWeight"), elem.getQName());
@@ -302,7 +320,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(2, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaMaxExclusiveFacet.class.getName());
s.add(XmlSchemaMinExclusiveFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
@@ -343,12 +361,12 @@
* </restriction> </simpleType> <element name="myWhiteSpace" type="tns:noWhiteSpace"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myWhiteSpace");
+ QName elementQName = new QName("http://soapinterop.org/types", "myWhiteSpace");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myWhiteSpace", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myWhiteSpace"), elem.getQName());
@@ -365,7 +383,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(1, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaWhiteSpaceFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
Object o = i.next();
@@ -398,12 +416,12 @@
* value="2"/> </restriction> </simpleType> <element name="myHeight" type="tns:height"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myHeight");
+ QName elementQName = new QName("http://soapinterop.org/types", "myHeight");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myHeight", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myHeight"), elem.getQName());
@@ -420,7 +438,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(2, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaFractionDigitsFacet.class.getName());
s.add(XmlSchemaTotalDigitsFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
@@ -462,12 +480,12 @@
* type="tns:yardLength"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "myYardLength");
+ QName elementQName = new QName("http://soapinterop.org/types", "myYardLength");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("myYardLength", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "myYardLength"), elem.getQName());
@@ -476,7 +494,8 @@
XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)elem.getSchemaType();
XmlSchemaSimpleTypeRestriction r = (XmlSchemaSimpleTypeRestriction)simpleType.getContent();
- assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "nonNegativeInteger"), r.getBaseTypeName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "nonNegativeInteger"),
+ r.getBaseTypeName());
XmlSchemaSimpleType xsst = r.getBaseType();
assertNull(xsst);
@@ -484,7 +503,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(2, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaMinLengthFacet.class.getName());
s.add(XmlSchemaMaxLengthFacet.class.getName());
for (Iterator i = collection.getIterator(); i.hasNext();) {
@@ -526,12 +545,12 @@
* type="tns:layoutComponentType"/>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "layoutComponent");
+ QName elementQName = new QName("http://soapinterop.org/types", "layoutComponent");
InputStream is = new FileInputStream(Resources.asURI("facets.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("layoutComponent", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "layoutComponent"), elem.getQName());
@@ -549,7 +568,7 @@
XmlSchemaObjectCollection collection = r.getFacets();
assertEquals(2, collection.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add("Field");
s.add("Separator");
for (Iterator i = collection.getIterator(); i.hasNext();) {
@@ -558,11 +577,11 @@
assertTrue("Atempted to remove an enumeration with the value of " + "\"" + value
+ "\", but the value was not in the set.", s.remove(value));
String toStr = xsef.toString("xsd", 1);
- if (value.equals("Field")) {
+ if ("Field".equals(value)) {
assertTrue("The toString(String, int) method did not contain "
+ "\"enumeration\", but did contain: " + toStr, toStr
.indexOf("enumeration value=\"Field\"") != -1);
- } else if (value.equals("Separator")) {
+ } else if ("Separator".equals(value)) {
assertTrue("The toString(String, int) method did not contain "
+ "\"enumeration\", but did contain: " + toStr, toStr
.indexOf("enumeration value=\"Separator\"") != -1);
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/GroupTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,34 +19,27 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- */
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaChoice;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaGroup;
+import org.apache.ws.commons.schema.XmlSchemaGroupRef;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaObjectTable;
+
public class GroupTest extends TestCase {
/**
@@ -68,12 +61,12 @@
* </element> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "price");
+ QName elementQName = new QName("http://soapinterop.org/types", "price");
InputStream is = new FileInputStream(Resources.asURI("group.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("price", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "price"), elem.getQName());
@@ -87,7 +80,7 @@
XmlSchemaObjectTable t = schema.getGroups();
assertEquals(1, t.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add("priceGroup");
for (Iterator i = t.getNames(); i.hasNext();) {
String name = ((QName)i.next()).getLocalPart();
@@ -121,13 +114,13 @@
while (iterator.hasNext()) {
XmlSchemaElement e = (XmlSchemaElement)iterator.next();
String eName = e.getName();
- if (eName.equals("fullPrice")) {
+ if ("fullPrice".equals(eName)) {
assertEquals(new QName("", "fullPrice"), e.getQName());
- } else if (eName.equals("salePrice")) {
+ } else if ("salePrice".equals(eName)) {
assertEquals(new QName("", "salePrice"), e.getQName());
- } else if (eName.equals("clearancePrice")) {
+ } else if ("clearancePrice".equals(eName)) {
assertEquals(new QName("", "clearancePrice"), e.getQName());
- } else if (eName.equals("freePrice")) {
+ } else if ("freePrice".equals(eName)) {
assertEquals(new QName("", "freePrice"), e.getQName());
} else {
fail("The name \"" + eName + "\" was found but shouldn't " + "have been found.");
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ImportTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ImportTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ImportTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,14 +19,17 @@
package tests;
+import java.io.File;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.namespace.QName;
-import java.io.File;
public class ImportTest extends TestCase {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/IncludeTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/IncludeTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/IncludeTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/IncludeTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,34 +19,24 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-import org.xml.sax.InputSource;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- */
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+
public class IncludeTest extends TestCase {
/**
@@ -75,7 +65,7 @@
XmlSchemaObjectCollection c = schema.getIncludes();
assertEquals(2, c.getCount());
- Set set = new HashSet();
+ Set<String> set = new HashSet<String>();
set.add(Resources.asURI("include2.xsd"));
set.add(Resources.asURI("include3.xsd"));
for (int i = 0; i < c.getCount(); i++) {
@@ -88,7 +78,8 @@
XmlSchemaElement xse = s.getElementByName(new QName("http://soapinterop.org/types",
"test1include"));
assertEquals("test1include", xse.getName());
- assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), xse.getSchemaTypeName());
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
+ xse.getSchemaTypeName());
} else if (schemaLocation.equals(Resources.asURI("include3.xsd"))) {
XmlSchemaElement xse = s.getElementByName(new QName("http://soapinterop.org/types",
"test2include"));
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ListTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ListTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ListTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/ListTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,31 +19,22 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
+import java.io.FileInputStream;
+import java.io.InputStream;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import java.io.FileInputStream;
-import java.io.InputStream;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- */
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeContent;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
public class ListTest extends TestCase {
/**
@@ -61,12 +52,12 @@
* itemType="xsd:integer"/> </simpleType> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "workDays");
+ QName elementQName = new QName("http://soapinterop.org/types", "workDays");
InputStream is = new FileInputStream(Resources.asURI("list.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
assertNotNull(elem);
assertEquals("workDays", elem.getName());
assertEquals(new QName("http://soapinterop.org/types", "workDays"), elem.getQName());
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MixedContentTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MixedContentTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MixedContentTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MixedContentTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,7 +19,14 @@
package tests;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaComplexContent;
@@ -27,22 +34,17 @@
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaType;
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
public class MixedContentTest extends TestCase {
public void testMixedContent() throws Exception {
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/xsd", "complexElt");
+ QName elementQName = new QName("http://soapinterop.org/xsd", "complexElt");
- QName TYPE_QNAME = new QName("http://soapinterop.org/xsd", "NoAssemblyRequiredProduct");
+ QName typeQName = new QName("http://soapinterop.org/xsd", "NoAssemblyRequiredProduct");
InputStream is = new FileInputStream(Resources.asURI("mixedContent.xsd"));
XmlSchemaCollection schema = new XmlSchemaCollection();
XmlSchema s = schema.read(new StreamSource(is), null);
- XmlSchemaElement elementByName = s.getElementByName(ELEMENT_QNAME);
+ XmlSchemaElement elementByName = s.getElementByName(elementQName);
assertNotNull(elementByName);
XmlSchemaType schemaType = elementByName.getSchemaType();
@@ -50,7 +52,7 @@
assertTrue(schemaType.isMixed());
- XmlSchemaComplexType typeByName = (XmlSchemaComplexType)s.getTypeByName(TYPE_QNAME);
+ XmlSchemaComplexType typeByName = (XmlSchemaComplexType)s.getTypeByName(typeQName);
assertNotNull(typeByName);
assertTrue(((XmlSchemaComplexContent)typeByName.getContentModel()).isMixed());
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/MultipleExternalAttTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,14 +19,17 @@
package tests;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.constants.Constants;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.util.Map;
public class MultipleExternalAttTest extends TestCase {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NamespaceContextTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NamespaceContextTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NamespaceContextTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NamespaceContextTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,19 +19,21 @@
package tests;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.utils.NamespaceMap;
-import org.custommonkey.xmlunit.XMLTestCase;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.xml.sax.InputSource;
-
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
+import org.xml.sax.InputSource;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.custommonkey.xmlunit.XMLUnit;
+
public class NamespaceContextTest extends XMLTestCase {
protected boolean whitespace = true;
@@ -45,7 +47,7 @@
}
public void testNamespaceContext() throws Exception {
- Map namespaceMapFromWSDL = new HashMap();
+ Map<String, Object> namespaceMapFromWSDL = new HashMap<String, Object>();
namespaceMapFromWSDL.put("tns", new URI("http://example.org/getBalance/"));
namespaceMapFromWSDL.put("xsd", new URI("http://www.w3.org/2001/XMLSchema"));
String schema = "\t\t<xsd:schema targetNamespace=\"http://example.org/getBalance/\"\n"
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/NotationTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,19 +19,32 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAnnotation;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaDocumentation;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet;
+import org.apache.ws.commons.schema.XmlSchemaNotation;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaObjectTable;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
+
/*
* Copyright 2004,2007 The Apache Software Foundation.
* Copyright 2006 International Business Machines Corp.
@@ -72,51 +85,24 @@
* value="tns:teamMascot"/> </restriction> </simpleType> </element> </schema>
*/
- QName ELEMENT_QNAME = new QName("http://soapinterop.org/types", "demoNotation");
+ QName elementQName = new QName("http://soapinterop.org/types", "demoNotation");
QName notationName = new QName("http://soapinterop.org/types", "teamLogo");
InputStream is = new FileInputStream(Resources.asURI("notation.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
- XmlSchemaObjectTable notations = schema.getNotations();
- assertNotNull(notations.getItem(notationName));
-
- XmlSchemaElement elem = schemaCol.getElementByQName(ELEMENT_QNAME);
- assertNotNull(elem);
- assertEquals("demoNotation", elem.getName());
- assertEquals(new QName("http://soapinterop.org/types", "demoNotation"), elem.getQName());
-
- XmlSchemaSimpleType type = (XmlSchemaSimpleType)elem.getSchemaType();
- assertNotNull(type);
-
- XmlSchemaSimpleTypeRestriction xsstc = (XmlSchemaSimpleTypeRestriction)type.getContent();
- assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "NOTATION"), xsstc.getBaseTypeName());
-
- XmlSchemaObjectCollection xsoc = xsstc.getFacets();
- assertEquals(2, xsoc.getCount());
- Set s = new HashSet();
- s.add("tns:teamLogo");
- s.add("tns:teamMascot");
- for (int i = 0; i < xsoc.getCount(); i++) {
- XmlSchemaEnumerationFacet xsef = (XmlSchemaEnumerationFacet)xsoc.getItem(i);
- String value = (String)xsef.getValue();
- if (!(value.equals("tns:teamLogo") || value.equals("tns:teamMascot"))) {
- fail("An unexpected value of \"" + value + "\" was found.");
- }
- assertTrue(s.remove(value));
- }
- assertTrue("The set should have been empty, but instead contained: " + s + ".", s.isEmpty());
+ testSimpleRestrictions(elementQName, notationName, schemaCol, schema);
XmlSchemaObjectTable xsot = schema.getNotations();
assertEquals(2, xsot.getCount());
- s.clear();
+ Set<String> s = new HashSet<String>();
s.add("teamMascot");
s.add("teamLogo");
for (Iterator i = xsot.getNames(); i.hasNext();) {
String name = ((QName)i.next()).getLocalPart();
- if (!(name.equals("teamLogo") || name.equals("teamMascot"))) {
+ if (!("teamLogo".equals(name) || "teamMascot".equals(name))) {
fail("An unexpected name of \"" + name + "\" was found.");
}
assertTrue(s.remove(name));
@@ -136,7 +122,7 @@
for (int k = 0; k < col.getCount(); k++) {
xsd = (XmlSchemaDocumentation)col.getItem(k);
}
- if (name.equals("teamMascot")) {
+ if ("teamMascot".equals(name)) {
assertEquals("http://www.team.com/graphics/teamMascot", xsn.getPublic());
assertEquals("com/team/graphics/teamMascot", xsn.getSystem());
assertEquals("notation.teamMascot", xsn.getId());
@@ -148,7 +134,7 @@
assertEquals("Location of the corporate mascot.", n.getNodeValue());
}
}
- } else if (name.equals("teamLogo")) {
+ } else if ("teamLogo".equals(name)) {
assertEquals("http://www.team.com/graphics/teamLogo", xsn.getPublic());
assertEquals("com/team/graphics/teamLogo", xsn.getSystem());
assertEquals("notation.teamLogo", xsn.getId());
@@ -169,4 +155,36 @@
}
+ private void testSimpleRestrictions(QName elementQName, QName notationName, XmlSchemaCollection schemaCol,
+ XmlSchema schema) {
+ XmlSchemaObjectTable notations = schema.getNotations();
+ assertNotNull(notations.getItem(notationName));
+
+ XmlSchemaElement elem = schemaCol.getElementByQName(elementQName);
+ assertNotNull(elem);
+ assertEquals("demoNotation", elem.getName());
+ assertEquals(new QName("http://soapinterop.org/types", "demoNotation"), elem.getQName());
+
+ XmlSchemaSimpleType type = (XmlSchemaSimpleType)elem.getSchemaType();
+ assertNotNull(type);
+
+ XmlSchemaSimpleTypeRestriction xsstc = (XmlSchemaSimpleTypeRestriction)type.getContent();
+ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "NOTATION"), xsstc.getBaseTypeName());
+
+ XmlSchemaObjectCollection xsoc = xsstc.getFacets();
+ assertEquals(2, xsoc.getCount());
+ Set<String> s = new HashSet<String>();
+ s.add("tns:teamLogo");
+ s.add("tns:teamMascot");
+ for (int i = 0; i < xsoc.getCount(); i++) {
+ XmlSchemaEnumerationFacet xsef = (XmlSchemaEnumerationFacet)xsoc.getItem(i);
+ String value = (String)xsef.getValue();
+ if (!("tns:teamLogo".equals(value) || "tns:teamMascot".equals(value))) {
+ fail("An unexpected value of \"" + value + "\" was found.");
+ }
+ assertTrue(s.remove(value));
+ }
+ assertTrue("The set should have been empty, but instead contained: " + s + ".", s.isEmpty());
+ }
+
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,13 +19,15 @@
package tests;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+
import junit.framework.TestCase;
+
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.namespace.QName;
public class RecursiveImportTest extends TestCase {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RedefineTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,35 +19,36 @@
package tests;
-import junit.framework.TestCase;
-import org.apache.ws.commons.schema.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- * @author Brent Ulbricht
- */
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAttribute;
+import org.apache.ws.commons.schema.XmlSchemaAttributeGroup;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaContentModel;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaGroup;
+import org.apache.ws.commons.schema.XmlSchemaGroupRef;
+import org.apache.ws.commons.schema.XmlSchemaMaxInclusiveFacet;
+import org.apache.ws.commons.schema.XmlSchemaMinInclusiveFacet;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaObjectTable;
+import org.apache.ws.commons.schema.XmlSchemaRedefine;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
+
public class RedefineTest extends TestCase {
/**
@@ -181,7 +182,7 @@
xsoc = xsstr.getFacets();
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaMinInclusiveFacet.class.getName());
s.add(XmlSchemaMaxInclusiveFacet.class.getName());
for (Iterator i = xsoc.getIterator(); i.hasNext();) {
@@ -245,7 +246,7 @@
xsoc = xss.getItems();
assertEquals(2, xsoc.getCount());
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add(XmlSchemaGroupRef.class.getName());
s.add(XmlSchemaElement.class.getName());
for (Iterator i = xsoc.getIterator(); i.hasNext();) {
@@ -308,7 +309,7 @@
assertEquals("AttribGroup", xsag.getName().getLocalPart());
xsoc = xsag.getAttributes();
- Set s = new HashSet();
+ Set<String> s = new HashSet<String>();
s.add("type");
s.add("units");
for (Iterator i = xsoc.getIterator(); i.hasNext();) {
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/Resources.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/Resources.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/Resources.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/Resources.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -19,11 +19,14 @@
package tests;
-public class Resources {
+public final class Resources {
/**
* Location of the test resources.
*/
public static final String TEST_RESOURCES = "src/test/test-resources";
+
+ private Resources() {
+ }
/**
* Returns a files location as a string.
Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SequenceTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SequenceTest.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SequenceTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SequenceTest.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* 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
@@ -32,23 +32,6 @@
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaSequence;
-/*
- * Copyright 2004,2007 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- *
- */
public class SequenceTest extends TestCase {
/**
@@ -72,8 +55,8 @@
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.read(new StreamSource(is), null);
- QName WRONG_QNAME = new QName("http://soapinterop.org/types", "machine");
- XmlSchemaElement elem = schemaCol.getElementByQName(WRONG_QNAME);
+ QName wrongQName = new QName("http://soapinterop.org/types", "machine");
+ XmlSchemaElement elem = schemaCol.getElementByQName(wrongQName);
assertNull(elem);
elem = schemaCol.getElementByQName(computerElementQname);
assertEquals("computer", elem.getName());