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 di...@apache.org on 2008/04/16 18:35:23 UTC
svn commit: r648743 - in
/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate:
./ derived/ other/ simple/
Author: dims
Date: Wed Apr 16 09:35:16 2008
New Revision: 648743
URL: http://svn.apache.org/viewvc?rev=648743&view=rev
Log:
Find the factory class properly, don't rely on the fact that it will always be at index 0
Added:
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java
webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java
Added: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java?rev=648743&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java Wed Apr 16 09:35:16 2008
@@ -0,0 +1,14 @@
+package org.apache.axis2.schema.populate;
+
+public class Util {
+ public static Class getFactory(Class clazz) {
+ Class[] declaredClasse = clazz.getDeclaredClasses();
+ for (int i = 0; i < declaredClasse.length; i++) {
+ Class aClass = declaredClasse[i];
+ if(aClass != null && aClass.getCanonicalName().endsWith("Factory")){
+ return aClass;
+ }
+ }
+ throw new RuntimeException("Factory inner class not found");
+ }
+}
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java Wed Apr 16 09:35:16 2008
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import org.custommonkey.xmlunit.XMLTestCase;
import javax.xml.stream.XMLOutputFactory;
@@ -45,14 +46,7 @@
protected Object process(String testString,String className) throws Exception{
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(testString.getBytes()));
Class clazz = Class.forName(className);
- Class[] declaredClasse = clazz.getDeclaredClasses();
- Class innerClazz = null;
- for (int i = 0; i < declaredClasse.length; i++) {
- Class aClass = declaredClasse[i];
- if(aClass != null && aClass.getCanonicalName().endsWith("Factory")){
- innerClazz = aClass;
- }
- }
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
assertNotNull(obj);
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -40,7 +41,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org1.soapinterop.types.TempElt");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.io.ByteArrayInputStream;
@@ -36,7 +37,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.xsd2.MyObject");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -53,7 +54,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.xsd.Myobject");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -43,7 +44,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org2.soapinterop.xsd.Myobject");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -38,7 +39,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.types.MyElement");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -103,7 +104,7 @@
boolean personPresent) throws XMLStreamException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IntrospectionException {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.test1.Root");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -87,7 +88,7 @@
XMLStreamReader reader =
StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.test.Root");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -80,7 +81,7 @@
private void populateAndAssert(String s,int count) throws XMLStreamException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IntrospectionException {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.recursion1.StringListResponseElement");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -39,7 +40,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.types.MyParticleAllElement");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java Wed Apr 16 09:35:16 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -51,7 +52,7 @@
) throws XMLStreamException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IntrospectionException {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.recursion.E");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java?rev=648743&r1=648742&r2=648743&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java Wed Apr 16 09:35:16 2008
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import org.custommonkey.xmlunit.XMLTestCase;
import javax.xml.stream.XMLOutputFactory;
@@ -53,9 +54,7 @@
protected Object process(String testString,String className) throws Exception{
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(testString.getBytes()));
Class clazz = Class.forName(className);
- Class[] declaredClasse = clazz.getDeclaredClasses();
- //ideally this should be 1
- Class innerClazz = declaredClasse[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
assertNotNull(obj);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org