Author: dkulp
Date: Tue Jan 21 16:59:18 2014
New Revision: 1560095

URL: http://svn.apache.org/r1560095
Log:
[XMLSCHEMA-30] This commit fixes the XMLSCHEMA-30 bug.

equals/hashCode methods pairs have been added in following classes:
     - XmlSchemaNamedImpl
     - XmlSchemaNamedWithFormImpl
     - XmlSchemaType
     - XmlSchemaElement
     - XmlSchemaGroup

 NamedItemsEqualityTest unit-test has been created.

Added:
    
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/UtilObjects.java
   (with props)
    webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/
    
webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/NamedItemsEqualityTest.java
   (with props)
    webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-30/
    
webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-30/test.xsd
Modified:
    webservices/xmlschema/trunk/pom.xml
    webservices/xmlschema/trunk/xmlschema-core/pom.xml
    
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java
    
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java
    
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
    
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedImpl.java
    
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedWithFormImpl.java

Modified: webservices/xmlschema/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/pom.xml?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- webservices/xmlschema/trunk/pom.xml (original)
+++ webservices/xmlschema/trunk/pom.xml Tue Jan 21 16:59:18 2014
@@ -559,6 +559,12 @@
                 <version>1.2</version>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava-testlib</artifactId>
+                <version>15.0</version>
+                <scope>test</scope>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 </project>

Modified: webservices/xmlschema/trunk/xmlschema-core/pom.xml
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/pom.xml?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/pom.xml (original)
+++ webservices/xmlschema/trunk/xmlschema-core/pom.xml Tue Jan 21 16:59:18 2014
@@ -132,5 +132,10 @@
             <artifactId>xmlunit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava-testlib</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

Modified: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java
 (original)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java
 Tue Jan 21 16:59:18 2014
@@ -20,16 +20,13 @@
 package org.apache.ws.commons.schema;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
 import javax.xml.namespace.QName;
 
-import org.apache.ws.commons.schema.utils.CollectionFactory;
-import org.apache.ws.commons.schema.utils.XmlSchemaNamedWithForm;
-import org.apache.ws.commons.schema.utils.XmlSchemaNamedWithFormImpl;
-import org.apache.ws.commons.schema.utils.XmlSchemaRef;
-import org.apache.ws.commons.schema.utils.XmlSchemaRefBase;
+import org.apache.ws.commons.schema.utils.*;
 
 /**
  * Class for elements, representing xs:element.
@@ -104,6 +101,49 @@ public class XmlSchemaElement extends Xm
         }
     }
 
+    @Override
+    public boolean equals(Object what) {
+        final boolean parentCheck =  super.equals(what);
+        if(!parentCheck){
+            return false;
+        }
+
+        if (!(what instanceof XmlSchemaElement)) {
+            return false;
+        }
+
+        XmlSchemaElement xse = (XmlSchemaElement)what;
+
+        final boolean isAbstactElementEq = (this.abstractElement == 
xse.abstractElement);
+        final boolean isNillableEq = (this.nillable == xse.nillable);
+        final boolean isBlockEq = UtilObjects.equals(this.block, xse.block);
+        final boolean isConstraintsEq = UtilObjects.equals(this.constraints, 
xse.constraints);
+        final boolean isDefaultValueEq = UtilObjects.equals(this.defaultValue, 
xse.defaultValue);
+        final boolean isFixedValueEq = UtilObjects.equals(this.fixedValue, 
xse.fixedValue);
+        final boolean isFinalDerivationEq = 
UtilObjects.equals(this.finalDerivation, xse.finalDerivation);
+        final boolean isRefEq = UtilObjects.equals(this.ref, xse.ref);
+        final boolean isSchemaTypeEq = UtilObjects.equals(this.schemaType, 
xse.schemaType);
+        final boolean isSchemaTypeNameEq = 
UtilObjects.equals(this.schemaTypeName, xse.schemaTypeName);
+        final boolean isSubstitutionGroupEq = 
UtilObjects.equals(this.substitutionGroup, xse.substitutionGroup);
+        final boolean isNamedDelegateEq = 
UtilObjects.equals(this.namedDelegate, xse.namedDelegate);
+
+        return (isAbstactElementEq && isNillableEq && isBlockEq && 
isConstraintsEq && isDefaultValueEq && isFixedValueEq &&
+                isFinalDerivationEq && isRefEq && isSchemaTypeEq && 
isSchemaTypeNameEq && isSubstitutionGroupEq && isNamedDelegateEq);
+
+    }
+
+    @Override
+    public int hashCode() {
+        Object[] hashObjects =
+                new Object[]{block, constraints, defaultValue, fixedValue, 
finalDerivation, ref, schemaType,
+                                                                        
schemaTypeName, substitutionGroup, namedDelegate};
+        int hash = Arrays.hashCode(hashObjects);
+        hash = hash + (abstractElement ? 1 : 11);
+        hash = hash + (nillable ? 3 : 13);
+        hash = hash ^ super.hashCode();
+        return hash;
+    }
+
     /**
      * Returns a collection of constraints on the element.
      */

Modified: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java
 (original)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaGroup.java
 Tue Jan 21 16:59:18 2014
@@ -23,9 +23,12 @@ package org.apache.ws.commons.schema;
 import javax.xml.namespace.QName;
 
 import org.apache.ws.commons.schema.utils.CollectionFactory;
+import org.apache.ws.commons.schema.utils.UtilObjects;
 import org.apache.ws.commons.schema.utils.XmlSchemaNamed;
 import org.apache.ws.commons.schema.utils.XmlSchemaNamedImpl;
 
+import java.util.Arrays;
+
 /**
  * Class that defines groups at the schema level that are referenced from the 
complex types. Groups a set of
  * element declarations so that they can be incorporated as a group into 
complex type definitions. Represents
@@ -48,6 +51,31 @@ public class XmlSchemaGroup extends XmlS
         });
     }
 
+    @Override
+    public boolean equals(Object what) {
+        final boolean parentCheck =  super.equals(what);
+        if(!parentCheck){
+            return false;
+        }
+
+        if (!(what instanceof XmlSchemaGroup)) {
+            return false;
+        }
+
+        XmlSchemaGroup xsg = (XmlSchemaGroup)what;
+
+        boolean isParticleEq = UtilObjects.equals(this.particle, xsg.particle);
+        boolean isNamedDelegateEq = UtilObjects.equals(this.namedDelegate, 
xsg.namedDelegate);
+
+        return (isParticleEq && isNamedDelegateEq);
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = Arrays.hashCode( new Object[]{particle, namedDelegate});
+        hash = hash ^ super.hashCode();
+        return hash;
+    }
 
     public XmlSchemaGroupParticle getParticle() {
         return particle;

Modified: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
 (original)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
 Tue Jan 21 16:59:18 2014
@@ -22,9 +22,12 @@ package org.apache.ws.commons.schema;
 import javax.xml.namespace.QName;
 
 import org.apache.ws.commons.schema.utils.CollectionFactory;
+import org.apache.ws.commons.schema.utils.UtilObjects;
 import org.apache.ws.commons.schema.utils.XmlSchemaNamed;
 import org.apache.ws.commons.schema.utils.XmlSchemaNamedImpl;
 
+import java.util.Arrays;
+
 
 /**
  * The base class for all simple types and complex types.
@@ -56,6 +59,36 @@ public abstract class XmlSchemaType exte
         }
     }
 
+    @Override
+    public boolean equals(Object what) {
+        final boolean parentCheck =  super.equals(what);
+        if(!parentCheck){
+            return false;
+        }
+
+        if (!(what instanceof XmlSchemaType)) {
+            return false;
+        }
+
+        XmlSchemaType xst = (XmlSchemaType)what;
+
+        final boolean isIsMixedEq = (this.isMixed == xst.isMixed);
+        final boolean isDeriveByEq = UtilObjects.equals(this.deriveBy, 
xst.deriveBy);
+        final boolean isFinalDerivationEq = 
UtilObjects.equals(this.finalDerivation, xst.finalDerivation);
+        final boolean isFinalResolvedEq = 
UtilObjects.equals(this.finalResolved, xst.finalResolved);
+        final boolean isNamedDelegateEq = 
UtilObjects.equals(this.namedDelegate, xst.namedDelegate);
+
+        return (isIsMixedEq && isDeriveByEq && isFinalDerivationEq && 
isFinalResolvedEq && isNamedDelegateEq);
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = Arrays.hashCode( new Object[]{deriveBy, finalDerivation, 
finalResolved, namedDelegate} );
+        hash = hash + (isMixed ? 29 : 83);
+        hash = hash ^ super.hashCode();
+        return hash;
+    }
+
     public XmlSchemaDerivationMethod getDeriveBy() {
         return deriveBy;
     }

Added: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/UtilObjects.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/UtilObjects.java?rev=1560095&view=auto
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/UtilObjects.java
 (added)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/UtilObjects.java
 Tue Jan 21 16:59:18 2014
@@ -0,0 +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 org.apache.ws.commons.schema.utils;
+
+/**
+ * This class contains a few convenient methods
+ */
+public class UtilObjects {
+
+    public static boolean equals(Object a, Object b) {
+        return (a == b) || (a != null && a.equals(b));
+
+    }
+
+}

Propchange: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/UtilObjects.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedImpl.java?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedImpl.java
 (original)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedImpl.java
 Tue Jan 21 16:59:18 2014
@@ -24,6 +24,8 @@ import javax.xml.namespace.QName;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaException;
 
+import java.util.Arrays;
+
 /**
  * Common class of all of the named objects in the XML Schema model.
  * Because 'being named' is not part of the XML Schema logical
@@ -57,7 +59,36 @@ public class XmlSchemaNamedImpl implemen
         this.parentSchema = parent;
         this.topLevel = topLevel;
     }
-    
+
+    @Override
+    public boolean equals(Object what) {
+        if (what == this) {
+            return true;
+        }
+
+        if (!(what instanceof XmlSchemaNamedImpl)) {
+            return false;
+        }
+
+        XmlSchemaNamedImpl xsn = (XmlSchemaNamedImpl)what;
+
+        final boolean isTopLevelEq = (this.topLevel==xsn.topLevel);
+        boolean isParentSchemaEq = UtilObjects.equals(this.parentSchema, 
xsn.parentSchema);
+        boolean isRefTwinEq = UtilObjects.equals(this.refTwin, xsn.refTwin);
+        boolean isQNameEq = UtilObjects.equals(this.qname, xsn.qname);
+
+        return (isTopLevelEq && isParentSchemaEq && isRefTwinEq && isQNameEq);
+    }
+
+    @Override
+    public int hashCode() {
+        Object[] hashObjects = new Object[]{parentSchema, refTwin, qname};
+        int hash = Arrays.hashCode(hashObjects);
+        hash = hash + (topLevel ? 39 : 107);
+        hash = hash ^ super.hashCode();
+        return hash;
+    }
+
     /**
      * If the named object also implements ref=, it should pass the reference 
object
      * here for some error checking.

Modified: 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedWithFormImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedWithFormImpl.java?rev=1560095&r1=1560094&r2=1560095&view=diff
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedWithFormImpl.java
 (original)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/XmlSchemaNamedWithFormImpl.java
 Tue Jan 21 16:59:18 2014
@@ -25,6 +25,8 @@ import org.apache.ws.commons.schema.XmlS
 import org.apache.ws.commons.schema.XmlSchemaException;
 import org.apache.ws.commons.schema.XmlSchemaForm;
 
+import java.util.Arrays;
+
 /**
  *
  */
@@ -44,6 +46,34 @@ public class XmlSchemaNamedWithFormImpl 
         this.element = element;
     }
 
+    @Override
+    public boolean equals(Object what) {
+        final boolean parentCheck =  super.equals(what);
+        if(!parentCheck){
+            return false;
+        }
+
+        if (!(what instanceof XmlSchemaNamedWithFormImpl)) {
+            return false;
+        }
+
+        XmlSchemaNamedWithFormImpl xsn = (XmlSchemaNamedWithFormImpl)what;
+
+        final boolean isElementEq = (this.element == xsn.element);
+        boolean isFormEq = UtilObjects.equals(this.form, xsn.form);
+        boolean isWireNameEq = UtilObjects.equals(this.wireName, xsn.wireName);
+
+        return (isElementEq && isFormEq && isWireNameEq);
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = Arrays.hashCode( new Object[]{form, wireName} );
+        hash = hash + (element ? 47 : 13);
+        hash = hash ^ super.hashCode();
+        return hash;
+    }
+
     /**
      * Return the <strong>effective</strong> 'form' for this item. If the item
      * has an explicit form declaration, this returns that declared form. If 
not,

Added: 
webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/NamedItemsEqualityTest.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/NamedItemsEqualityTest.java?rev=1560095&view=auto
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/NamedItemsEqualityTest.java
 (added)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/NamedItemsEqualityTest.java
 Tue Jan 21 16:59:18 2014
@@ -0,0 +1,119 @@
+/**
+ * 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.xmlschema30;
+
+import com.google.common.testing.EqualsTester;
+import org.apache.ws.commons.schema.*;
+import org.apache.ws.commons.schema.constants.Constants;
+import org.apache.ws.commons.schema.utils.XmlSchemaNamedImpl;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import tests.Resources;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.stream.StreamSource;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+/**
+ * This test checks implementations of <strong>equals</strong> and 
<strong>hashCode</strong> methods on the following
+ * classes:
+ * <ul>
+ *     <li>{@link org.apache.ws.commons.schema.utils.XmlSchemaNamedImpl 
XmlSchemaNamedImpl}</li>
+ *     <li>{@link 
org.apache.ws.commons.schema.utils.XmlSchemaNamedWithFormImpl 
XmlSchemaNamedWithFormImpl}</li>
+ *     <li>{@link org.apache.ws.commons.schema.XmlSchemaType 
XmlSchemaType}</li>
+ *     <li>{@link org.apache.ws.commons.schema.XmlSchemaGroup 
XmlSchemaGroup}</li>
+ *     <li>{@link org.apache.ws.commons.schema.XmlSchemaElement 
XmlSchemaElement}</li>
+ * </ul>
+ */
+public class NamedItemsEqualityTest {
+
+    static private final String CUSTOM_SCHEMA_NS = "http://example.com/test";;
+    static private XmlSchema BASE_SCHEMA;
+    static private XmlSchema CUSTOM_SCHEMA;
+
+    @BeforeClass
+    static public void setUp() throws FileNotFoundException {
+        InputStream is = new 
FileInputStream(Resources.asURI("XMLSCHEMA-30/test.xsd"));
+        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        schemaCol.read(new StreamSource(is));
+        BASE_SCHEMA = 
schemaCol.schemaForNamespace(Constants.URI_2001_SCHEMA_XSD);
+        CUSTOM_SCHEMA = schemaCol.schemaForNamespace(CUSTOM_SCHEMA_NS);
+    }
+
+    @Test
+    public void testXmlSchemaTypes() {
+        XmlSchemaType stringSimpleType = BASE_SCHEMA.getTypeByName( 
Constants.XSD_STRING );
+        XmlSchemaType decimalSimpleType = BASE_SCHEMA.getTypeByName( 
Constants.XSD_DECIMAL );
+
+        XmlSchemaType customSimpleType = 
CUSTOM_SCHEMA.getTypeByName("customSimpleType");
+        XmlSchemaType customComplexType = 
CUSTOM_SCHEMA.getTypeByName("customComplexTypeType");
+
+        new EqualsTester()
+                .addEqualityGroup(
+                    stringSimpleType,
+                    stringSimpleType)
+                .addEqualityGroup(
+                    decimalSimpleType,
+                    decimalSimpleType)
+                .addEqualityGroup(
+                    customSimpleType,
+                    customSimpleType)
+                .addEqualityGroup(
+                    customComplexType,
+                    customComplexType)
+                .testEquals();
+
+    }
+
+    @Test
+    public void testXmlSchemaElements() {
+        XmlSchemaElement customSimpleElem = 
CUSTOM_SCHEMA.getElementByName("customTopSimpleElement");
+        XmlSchemaElement customComplexElement = 
CUSTOM_SCHEMA.getElementByName("customTopComplexElement");
+
+        new EqualsTester()
+                .addEqualityGroup(
+                    customSimpleElem,
+                    customSimpleElem)
+                .addEqualityGroup(
+                    customComplexElement,
+                    customComplexElement)
+                .testEquals();
+    }
+
+    @Test
+    public void testXmlSchemaGroup() {
+        final QName grp1QName = new QName(CUSTOM_SCHEMA_NS, "customGroup1");
+        final QName grp2QName = new QName(CUSTOM_SCHEMA_NS, "customGroup2");
+        XmlSchemaGroup grp1 = CUSTOM_SCHEMA.getGroupByName(grp1QName);
+        XmlSchemaGroup grp2 = CUSTOM_SCHEMA.getGroupByName(grp2QName);
+
+        new EqualsTester()
+                .addEqualityGroup(
+                        grp1,
+                        grp1)
+                .addEqualityGroup(
+                        grp2,
+                        grp2)
+                .testEquals();
+    }
+
+}

Propchange: 
webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/xmlschema30/NamedItemsEqualityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-30/test.xsd
URL: 
http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-30/test.xsd?rev=1560095&view=auto
==============================================================================
--- 
webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-30/test.xsd
 (added)
+++ 
webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-30/test.xsd
 Tue Jan 21 16:59:18 2014
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema targetNamespace="http://example.com/test"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema";
+           xmlns:ec="http://example.com/test";>
+
+    <xs:simpleType name="customSimpleType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="TEST1"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:complexType name="customComplexTypeType">
+        <xs:sequence>
+            <xs:element name="testElem" type="ec:customSimpleType"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:element name="customTopSimpleElement" type="ec:customSimpleType"/>
+    <xs:element name="customTopComplexElement" 
type="ec:customComplexTypeType"/>
+
+    <xs:group name="customGroup1">
+        <xs:sequence/>
+    </xs:group>
+
+    <xs:group name="customGroup2">
+        <xs:sequence/>
+    </xs:group>
+
+</xs:schema>
\ No newline at end of file


Reply via email to