You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2008/01/04 07:35:27 UTC
svn commit: r608756 - in /webservices/axis2/trunk/java/modules/adb-codegen:
src/org/apache/axis2/schema/SchemaCompiler.java
test-resources/testsuite/restrictions.xsd
test/org/apache/axis2/schema/restriction/ComplexRestrictionTest.java
Author: amilas
Date: Thu Jan 3 22:35:27 2008
New Revision: 608756
URL: http://svn.apache.org/viewvc?rev=608756&view=rev
Log:
fixed the issue AXIS2C-860
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/restriction/ComplexRestrictionTest.java
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=608756&r1=608755&r2=608756&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Thu Jan 3 22:35:27 2008
@@ -1157,15 +1157,7 @@
// process attributes
//process attributes - first look for the explicit attributes
- XmlSchemaObjectCollection attribs = extension.getAttributes();
- Iterator attribIterator = attribs.getIterator();
- while (attribIterator.hasNext()) {
- Object o = attribIterator.next();
- if (o instanceof XmlSchemaAttribute) {
- processAttribute((XmlSchemaAttribute) o, metaInfHolder, parentSchema);
-
- }
- }
+ processAttributes(extension.getAttributes(),metaInfHolder,parentSchema);
//process any attribute
//somehow the xml schema parser does not seem to pickup the any attribute!!
@@ -1216,15 +1208,7 @@
processParticle(restriction.getBaseTypeName(),restriction.getParticle(), metaInfHolder, parentSchema);
//process attributes - first look for the explicit attributes
- XmlSchemaObjectCollection attribs = restriction.getAttributes();
- Iterator attribIterator = attribs.getIterator();
- while (attribIterator.hasNext()) {
- Object o = attribIterator.next();
- if (o instanceof XmlSchemaAttribute) {
- processAttribute((XmlSchemaAttribute) o, metaInfHolder, parentSchema);
-
- }
- }
+ processAttributes(restriction.getAttributes(),metaInfHolder,parentSchema);
//process any attribute
//somehow the xml schema parser does not seem to pickup the any attribute!!
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd?rev=608756&r1=608755&r2=608756&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/restrictions.xsd Thu Jan 3 22:35:27 2008
@@ -189,7 +189,21 @@
</xsd:restriction>
</xsd:simpleType>
-
-
+ <xsd:element name="GetExemplarResponseTypeElement" type="tns:getExemplarResponseType"/>
+ <xsd:complexType name="getExemplarResponseType">
+ <xsd:complexContent>
+ <xsd:restriction base="xsd:anyType">
+ <xsd:sequence>
+ <xsd:element name="exemplar" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attributeGroup ref="tns:ResponseAttributeGroup"/>
+ <xsd:attribute name="supportedMethods" type="xsd:string" use="optional"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:attributeGroup name="ResponseAttributeGroup">
+ <xsd:attribute name="responseCode" type="xsd:integer" use="optional" default="0"/>
+ <xsd:attribute name="responseMessage" type="xsd:string" use="optional"/>
+ </xsd:attributeGroup>
</xsd:schema>
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/restriction/ComplexRestrictionTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/restriction/ComplexRestrictionTest.java?rev=608756&r1=608755&r2=608756&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/restriction/ComplexRestrictionTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/restriction/ComplexRestrictionTest.java Thu Jan 3 22:35:27 2008
@@ -20,9 +20,50 @@
import junit.framework.TestCase;
+import java.io.ByteArrayInputStream;
+import java.math.BigInteger;
+
+import org.tempuri.GetExemplarResponseType;
+import org.tempuri.GetExemplarResponseTypeElement;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.databinding.ADBException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
public class ComplexRestrictionTest extends TestCase {
- public void testComplexRestriction(){
-
+
+ public void testGetExemplarResponseTypeElement(){
+ GetExemplarResponseTypeElement getExemplarResponseTypeElement = new GetExemplarResponseTypeElement();
+ GetExemplarResponseType getExemplarResponseType = new GetExemplarResponseType();
+ getExemplarResponseType.setExemplar("test string1");
+ getExemplarResponseType.setResponseCode(new BigInteger("23"));
+ getExemplarResponseType.setResponseMessage("test string2");
+ getExemplarResponseType.setSupportedMethods("test string3");
+
+ getExemplarResponseTypeElement.setGetExemplarResponseTypeElement(getExemplarResponseType);
+
+ try {
+ OMElement omElement =
+ getExemplarResponseTypeElement.getOMElement(GetExemplarResponseTypeElement.MY_QNAME,
+ OMAbstractFactory.getOMFactory());
+ String omElementString = omElement.toStringWithConsume();
+ System.out.println("OMElement string ==> " + omElementString);
+ XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+ GetExemplarResponseTypeElement result = GetExemplarResponseTypeElement.Factory.parse(xmlReader);
+ GetExemplarResponseType resultType = result.getGetExemplarResponseTypeElement();
+ assertEquals(resultType.getExemplar(),"test string1");
+ assertEquals(resultType.getResponseMessage(),"test string2");
+ assertEquals(resultType.getSupportedMethods(),"test string3");
+ } catch (ADBException e) {
+ fail();
+ } catch (XMLStreamException e) {
+ fail();
+ } catch (Exception e) {
+ fail();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org