jochen      2005/08/04 14:33:15

  Modified:    src/xs/org/apache/ws/jaxme/xs/junit JiraTest.java
               src/jaxme/org/apache/ws/jaxme/junit JiraTest.java
               src/xs/org/apache/ws/jaxme/xs/impl XSTypeImpl.java
               ant      js.xml
               .        status.xml
  Added:       src/js/org/apache/ws/jaxme/js/junit AntlrTest.java
  Removed:     src/jaxme/org/apache/ws/jaxme/junit AntlrTest.java
  Log:
  If a complex type was created by referencing a group, then
  the referencing particles maxOccurs and minOccurs values haven't
  been inherited.
  PR: JAXME-63
  
  Revision  Changes    Path
  1.5       +34 -0     
ws-jaxme/src/xs/org/apache/ws/jaxme/xs/junit/JiraTest.java
  
  Index: JiraTest.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/junit/JiraTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JiraTest.java     4 Dec 2004 23:22:33 -0000       1.4
  +++ JiraTest.java     4 Aug 2005 21:33:15 -0000       1.5
  @@ -13,6 +13,7 @@
   import org.apache.ws.jaxme.xs.XSElement;
   import org.apache.ws.jaxme.xs.XSEnumeration;
   import org.apache.ws.jaxme.xs.XSParser;
  +import org.apache.ws.jaxme.xs.XSParticle;
   import org.apache.ws.jaxme.xs.XSSchema;
   import org.apache.ws.jaxme.xs.XSSimpleContentType;
   import org.apache.ws.jaxme.xs.XSSimpleType;
  @@ -170,4 +171,37 @@
           assertEquals(XSID.getInstance(), idAttr.getType());
           assertFalse(idRef.isOptional());
       }
  +
  +     /** Test for <a 
href="http://issues.apache.org/jira/browse/JAXME-63";>JAXME-63</a>.
  +      */
  +     public void testJAXME63() throws Exception {
  +             final String xml =
  +                     "<xs:schema\n"
  +                     + "    xmlns:xs='http://www.w3.org/2001/XMLSchema'\n"
  +                     + "    elementFormDefault='qualified'>\n"
  +                     + "  <xs:group name='params'>\n"
  +                     + "    <xs:choice>\n"
  +                     + "      <xs:element name='string' type='xs:string'/>\n"
  +                     + "      <xs:element name='int' type='xs:int'/>\n"
  +                     + "      <xs:element name='boolean' 
type='xs:boolean'/>\n"
  +                     + "    </xs:choice>\n"
  +                     + "  </xs:group>\n"
  +                     + "  <xs:element name='call'>\n"
  +                     + "    <xs:complexType>\n"
  +                     + "      <xs:group ref='params' 
maxOccurs='unbounded'/>\n"
  +                     + "    </xs:complexType>\n"
  +                     + "  </xs:element>\n"
  +                     + "</xs:schema>";
  +        XSSchema schema = parse(xml, "jaxme63.xsd");
  +        XSElement[] elements = schema.getElements();
  +        assertEquals(1, elements.length);
  +        XSElement call = elements[0];
  +        assertEquals(new XsQName((String) null, "call"), call.getName());
  +        XSComplexType type = assertComplexType(call.getType());
  +        XSParticle particle = assertComplexContent(type);
  +        assertTrue(particle.isGroup());
  +        assertChoice(particle.getGroup());
  +        assertEquals(1, particle.getMinOccurs());
  +        assertEquals(-1, particle.getMaxOccurs());
  +     }
   }
  
  
  
  1.10      +35 -1     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/junit/JiraTest.java
  
  Index: JiraTest.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/junit/JiraTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JiraTest.java     30 Jul 2005 21:05:15 -0000      1.9
  +++ JiraTest.java     4 Aug 2005 21:33:15 -0000       1.10
  @@ -26,6 +26,7 @@
   import org.apache.ws.jaxme.test.misc.types.impl.RowImpl;
   import org.apache.ws.jaxme.test.misc.xsimport.a.Outer;
   import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
   
   
   /** Some excerpts from Jira bug reports.
  @@ -187,7 +188,6 @@
                        xml += (char) ('0' + j);
                }
                xml += "'/>";
  -             System.out.println("Parsing " + xml);
                InputSource isource = new InputSource(new StringReader(xml));
                isource.setSystemId("testJAXME62-a-" + i + ".xsd");
                EventDetector ed = new EventDetector();
  @@ -196,4 +196,38 @@
                u.unmarshal(isource);
                assertEquals(pSuccess, ed.isSuccess());
        }
  +
  +     /** Test for <a 
href="http://issues.apache.org/jira/browse/JAXME-63";>JAXME-63</a>.
  +      */
  +     public void testJAXME63() throws Exception {
  +             final String xml =
  +                     "<xs:schema\n"
  +                     + "    xmlns:xs='http://www.w3.org/2001/XMLSchema'\n"
  +                     + "    elementFormDefault='qualified'>\n"
  +                     + "  <xs:group name='params'>\n"
  +                     + "    <xs:choice>\n"
  +                     + "      <xs:element name='string' type='xs:string'/>\n"
  +                     + "      <xs:element name='int' type='xs:int'/>\n"
  +                     + "      <xs:element name='boolean' 
type='xs:boolean'/>\n"
  +                     + "    </xs:choice>\n"
  +                     + "  </xs:group>\n"
  +                     + "  <xs:element name='call'>\n"
  +                     + "    <xs:complexType>\n"
  +                     + "      <xs:group ref='params' 
maxOccurs='unbounded'/>\n"
  +                     + "    </xs:complexType>\n"
  +                     + "  </xs:element>\n"
  +                     + "</xs:schema>";
  +             Generator g = new GeneratorImpl();
  +             g.setProperty("jaxme.package.name", 
"org.apache.ws.jaxme.test.jira.jaxme63");
  +             SchemaReader sr = new JAXBSchemaReader();
  +             g.setSchemaReader(sr);
  +             sr.setGenerator(g);
  +             SchemaSG schema = g.getSchemaReader().parse(new InputSource(new 
StringReader(xml)));
  +             try {
  +                     schema.generate();
  +                     fail("Expected exception");
  +             } catch (SAXException e) {
  +                     assertTrue(e.getMessage().indexOf("Model groups with 
maxOccurs > 1 are not yet supported.") != -1);
  +             }
  +     }
   }
  
  
  
  1.1                  
ws-jaxme/src/js/org/apache/ws/jaxme/js/junit/AntlrTest.java
  
  Index: AntlrTest.java
  ===================================================================
  /*
   * Copyright 2003, 2004  The Apache Software Foundation
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   * http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
  
   */
  package org.apache.ws.jaxme.js.junit;
  
  import junit.framework.TestCase;
  
  /**
   * Test for JavaParser.
   */
  public class AntlrTest extends TestCase {
  
        /**
         * Tests the JavaParser.
         */
        public void test() throws Throwable {
                final String path = System.getProperty("js.src")
                        + 
"/org/apache/ws/jaxme/sqls/impl/SQLGeneratorImpl.java";
                org.apache.ws.jaxme.js.util.JavaParser.main(new String[]{path});
        }
        
  }
  
  
  
  1.19      +5 -2      
ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java
  
  Index: XSTypeImpl.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XSTypeImpl.java   19 May 2005 20:30:33 -0000      1.18
  +++ XSTypeImpl.java   4 Aug 2005 21:33:15 -0000       1.19
  @@ -455,10 +455,13 @@
     public class XSGroupComplexTypeImpl extends XSBasicComplexTypeImpl {
       private final XSGroup group;
   
  -    public XSGroupComplexTypeImpl(XSType pOwner, XsTComplexType pType, 
XSGroup pGroup) throws SAXException {
  +    public XSGroupComplexTypeImpl(XSType pOwner, XsTComplexType pType, 
XSGroup pGroup,
  +                                                       XsTGroupRef pRef) 
throws SAXException {
         super(pOwner, pType);
         group = pGroup;
         XSParticleImpl particle = new XSParticleImpl(group);
  +      particle.setMinOccurs(pRef.getMinOccurs());
  +      particle.setMaxOccurs(pRef.getMaxOccurs());
         if (group.getParticles().length == 0) {
           setParticle(XsComplexContentType.EMPTY, particle);
         } else {
  @@ -711,7 +714,7 @@
                 throw new LocSAXException("Unknown group: " + myName, 
getLocator());
               }
               group.validate();
  -            myComplexType = new XSGroupComplexTypeImpl(this, 
myXsTComplexType, group);
  +            myComplexType = new XSGroupComplexTypeImpl(this, 
myXsTComplexType, group, groupRef);
             } else {
               throw new IllegalStateException("Invalid particle: " + 
particle.getClass().getName());
             }
  
  
  
  1.8       +1 -0      ws-jaxme/ant/js.xml
  
  Index: js.xml
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/ant/js.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- js.xml    14 Jul 2005 18:32:17 -0000      1.7
  +++ js.xml    4 Aug 2005 21:33:15 -0000       1.8
  @@ -180,6 +180,7 @@
                   <sysproperty key="jdbc.url" value="${jdbc.url}"/>
                   <sysproperty key="jdbc.user" value="${jdbc.user}"/>
                   <sysproperty key="jdbc.password" value="${jdbc.password}"/>
  +             <sysproperty key="js.src" value="${src.js}"/>
               </properties>
           </runtests>
       </target>
  
  
  
  1.69      +5 -0      ws-jaxme/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/status.xml,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- status.xml        30 Jul 2005 21:12:10 -0000      1.68
  +++ status.xml        4 Aug 2005 21:33:15 -0000       1.69
  @@ -64,6 +64,11 @@
           is now trapped and converted to a proper ValidationEvent.
           (JAXME-62)
         </action>
  +      <action dev="JW" type="fix" context="xs">
  +        If a complex type was created by referencing a group, then
  +        the referencing particles maxOccurs and minOccurs values haven't
  +        been inherited. (JAXME-63)
  +      </action>
        </release>
        <release version="0.5beta" date="2005-Jul-13">
          <action dev="JW" type="enhancement" context="generator">
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to