You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/01/01 20:55:25 UTC

svn commit: r607899 - in /incubator/cxf/trunk/rt/databinding/aegis/src: main/java/org/apache/cxf/aegis/ main/java/org/apache/cxf/aegis/databinding/ main/java/org/apache/cxf/aegis/type/ test/java/org/apache/cxf/aegis/inheritance/ test/java/org/apache/cx...

Author: bimargulies
Date: Tue Jan  1 11:55:25 2008
New Revision: 607899

URL: http://svn.apache.org/viewvc?rev=607899&view=rev
Log:
Perhaps complete the standalone reader department. Modify some existing test stuff to use a .aegis.xml file to make a better test case for the standalone reader.

Added:
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml   (with props)
Modified:
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/oldconfig/Pre21ConfigCompatTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/StandaloneReadTest.java

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java Tue Jan  1 11:55:25 2008
@@ -48,6 +48,22 @@
  * This class has no API that maps from a Class or QName to a Type or visa versa. Our goal is to allow
  * Aegis-sans-CXF, but the marshal/unmarshal-level APIs aren't sorted out yet.
  * 
+ * At the level of the data binding, the 'root elements' are defined by the WSDL message parts.
+ * Additional classes that participate are termed 'override' classes.
+ * 
+ * Aegis, unlike JAXB, has no concept of a 'root element'. So, an application that 
+ * uses Aegis without a web service has to either depend on xsi:type (at least for 
+ * root elements) or have its own mapping from elements to classes, and pass the 
+ * resulting Class objects to the readers.
+ * 
+ * At this level, the initial set of classes are just the initial set of classes.
+ * If the application leaves this list empty, and reads, then no .aegis.xml files 
+ * are used unless the application feeds in a Class<T> for the root of a 
+ * particular item read. Specifically, if the application just leaves it to Aegis to
+ * map an xsi:type spec to a class, Aegis can't know that some arbitrary class in
+ * some arbitrary package is mapped to a particular schema type by QName in a
+ * mapping XML file. 
+ * 
  */
 public class AegisContext {
     // perhaps this should be SoapConstants.XSD? Or perhaps the code that looks for that should look for this?
@@ -57,12 +73,12 @@
     private String mappingNamespaceURI = DEFAULT_ENCODING_STYLE_URI;
 
     private TypeMappingRegistry typeMappingRegistry;
-    private Set<String> overrideTypes;
-    private Set<Class<?>> overrideClasses;
-    private Set<QName> overrideQNames;
+    private Set<String> rootClassNames;
+    private Set<Class<?>> rootClasses;
+    private Set<QName> rootTypeQNames;
     // this type mapping is the front of the chain of delegating type mappings.
     private TypeMapping typeMapping;
-    private Set<Type> additionalTypes;
+    private Set<Type> rootTypes;
     private Map<Class<?>, String> beanImplementationMap;
     private Configuration configuration;
     
@@ -71,8 +87,8 @@
      */
     public AegisContext() {
         beanImplementationMap = new HashMap<Class<?>, String>();
-        overrideClasses = new HashSet<Class<?>>();
-        overrideQNames = new HashSet<QName>();
+        rootClasses = new HashSet<Class<?>>();
+        rootTypeQNames = new HashSet<QName>();
     }
 
     /**
@@ -90,7 +106,7 @@
         // The use of the XSD URI in the mapping is, MAGIC.
         typeMapping  = typeMappingRegistry.createTypeMapping(SOAPConstants.XSD, true);
         typeMappingRegistry.register(mappingNamespaceURI, typeMapping);
-        processOverrideTypes();
+        processRootTypes();
     }
     
     
@@ -121,13 +137,13 @@
     }
     
     /**
-     * If a class was provided as part of the 'override' list, retrieve it's Type by
+     * If a class was provided as part of the 'root' list, retrieve it's Type by
      * Class.
      * @param clazz
      * @return
      */
-    public Type getOverrideType(Class clazz) {
-        if (overrideClasses.contains(clazz)) {
+    public Type getRootType(Class clazz) {
+        if (rootClasses.contains(clazz)) {
             return typeMapping.getType(clazz);
         } else {
             return null;
@@ -135,13 +151,13 @@
     }
     
     /**
-     * If a class was provided as part of the override list, retrieve it's Type by schema
+     * If a class was provided as part of the root list, retrieve it's Type by schema
      * type QName.
      * @param schemaTypeName
      * @return
      */
-    public Type getOverrideType(QName schemaTypeName) {
-        if (overrideQNames.contains(schemaTypeName)) {
+    public Type getRootType(QName schemaTypeName) {
+        if (rootTypeQNames.contains(schemaTypeName)) {
             return typeMapping.getType(schemaTypeName);
         } else {
             return null;
@@ -153,12 +169,15 @@
      * @param tm      type manager for this binding
      * @param classes list of class names
      */
-    private void processOverrideTypes() {
-        additionalTypes = new HashSet<Type>();
-        overrideClasses = new HashSet<Class<?>>();
-        overrideQNames = new HashSet<QName>();
-        if (this.overrideTypes != null) {
-            for (String typeName : overrideTypes) {
+    private void processRootTypes() {
+        rootTypes = new HashSet<Type>();
+        // app may have already supplied classes.
+        if (rootClasses == null) {
+            rootClasses = new HashSet<Class<?>>();
+        }
+        rootTypeQNames = new HashSet<QName>();
+        if (this.rootClassNames != null) {
+            for (String typeName : rootClassNames) {
                 Class c = null;
                 try {
                     c = ClassLoaderUtils.loadClass(typeName, TypeUtil.class);
@@ -166,34 +185,48 @@
                     throw new DatabindingException("Could not find override type class: " + typeName, e);
                 }
                 
-                overrideClasses.add(c);
-                
-                Type t = typeMapping.getType(c);
-                if (t == null) {
-                    t = typeMapping.getTypeCreator().createType(c);
-                    typeMapping.register(t);
-                }
-                overrideQNames.add(t.getSchemaType());
-                if (t instanceof BeanType) {
-                    BeanType bt = (BeanType)t;
-                    bt.getTypeInfo().setExtension(true);
-                    additionalTypes.add(bt);
-                }
+                rootClasses.add(c);
+            }
+        }
+         
+        for (Class<?> c : rootClasses) {
+            Type t = typeMapping.getType(c);
+            if (t == null) {
+                t = typeMapping.getTypeCreator().createType(c);
+                typeMapping.register(t);
+            }
+            rootTypeQNames.add(t.getSchemaType());
+            if (t instanceof BeanType) {
+                BeanType bt = (BeanType)t;
+                bt.getTypeInfo().setExtension(true);
+                rootTypes.add(bt);
             }
         }
     }
 
-    public Set<String> getOverrideTypes() {
-        return overrideTypes;
+    /**
+     * Retrieve the set of root class names. Note that if the application
+     * specifies the root classes by Class instead of by name, this will
+     * return null.
+     * @return
+     */
+    public Set<String> getRootClassNames() {
+        return rootClassNames;
     }
     
-    public void setOverrideTypes(Set<String> typeNames) {
-        overrideTypes = typeNames;
+    /**
+     * Set the root class names. This function is a convenience for Spring
+     * configuration. It sets the same underlying 
+     * collection as {@link #setRootClasses(Set)}.
+     * 
+     * @param classNames
+     */
+    public void setRootClassNames(Set<String> classNames) {
+        rootClassNames = classNames;
     }
 
     /** 
      * Return the type mapping configuration associated with this context.
-     * The configuration is retrieved from the type mapping registry.
      * @return Returns the configuration.
      */
     public Configuration getConfiguration() {
@@ -206,7 +239,8 @@
     }
 
     /**
-     * Set the configuration for this databinding object.
+     * Set the configuration object. The configuration specifies default
+     * type mapping behaviors.
      * @param configuration The configuration to set.
      */
     public void setConfiguration(Configuration newConfiguration) {
@@ -224,24 +258,47 @@
         return readXsiTypes;
     }
 
+    /**
+     * Controls whether Aegis writes xsi:type attributes on all elements.
+     * False by default.
+     * @param flag
+     */
     public void setWriteXsiTypes(boolean flag) {
         this.writeXsiTypes = flag;
     }
 
+    /**
+     * Controls the use of xsi:type attributes when reading objects. By default,
+     * xsi:type reading is enabled. When disabled, Aegis will only map for objects
+     * in the type mapping. 
+     * @param flag
+     */
     public void setReadXsiTypes(boolean flag) {
         this.readXsiTypes = flag;
     }
 
+    /**
+     * Return the type mapping object used by this context.
+     * @return
+     */
     public TypeMapping getTypeMapping() {
         return typeMapping;
     }
 
+    /**
+     * Set the type mapping object used by this context.
+     * @param typeMapping
+     */
     public void setTypeMapping(TypeMapping typeMapping) {
         this.typeMapping = typeMapping;
     }
 
-    public Set<Type> getAdditionalTypes() {
-        return additionalTypes;
+    /**
+     * Retrieve the Aegis type objects for the root classes.
+     * @return the set of type objects.
+     */
+    public Set<Type> getRootTypes() {
+        return rootTypes;
     }
     
     public Map<Class<?>, String> getBeanImplementationMap() {
@@ -254,6 +311,14 @@
 
     public void setMappingNamespaceURI(String uri) {
         this.mappingNamespaceURI = uri;
+    }
+
+    public Set<Class<?>> getRootClasses() {
+        return rootClasses;
+    }
+
+    public void setRootClasses(Set<Class<?>> rootClasses) {
+        this.rootClasses = rootClasses;
     }
 
 }

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java Tue Jan  1 11:55:25 2008
@@ -116,7 +116,7 @@
             if (aegisContext == null) {
                 aegisContext = new AegisContext();
                 if (overrideTypes != null) {
-                    aegisContext.setOverrideTypes(overrideTypes);
+                    aegisContext.setRootClassNames(overrideTypes);
                 }
                 if (configuration != null) {
                     aegisContext.setConfiguration(configuration);
@@ -221,7 +221,7 @@
             }
 
             if (overrideTypes != null) {
-                aegisContext.setOverrideTypes(overrideTypes);
+                aegisContext.setRootClassNames(overrideTypes);
             }
             if (configuration != null) {
                 aegisContext.setConfiguration(configuration);
@@ -249,7 +249,7 @@
             }
         }
 
-        Collection<Type> additional = aegisContext.getAdditionalTypes();
+        Collection<Type> additional = aegisContext.getRootTypes();
 
         if (additional != null) {
             for (Type t : additional) {

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeUtil.java Tue Jan  1 11:55:25 2008
@@ -60,7 +60,7 @@
                     improvedType = tm.getType(overrideName);
                 }
                 if (improvedType == null) {
-                    improvedType = context.getOverrideType(overrideName);
+                    improvedType = context.getRootType(overrideName);
                 }
                 if (improvedType != null) {
                     return improvedType;
@@ -115,7 +115,7 @@
             Type type = tm.getType(schemaTypeName);
             
             if (type == null) {
-                type = context.getOverrideType(schemaTypeName);
+                type = context.getRootType(schemaTypeName);
             }
             
             if (type != null) {
@@ -132,7 +132,7 @@
     
     public static Type getWriteType(AegisContext globalContext, Object value, Type type) {
         if (value != null && type != null && type.getTypeClass() != value.getClass()) {
-            Type overrideType = globalContext.getOverrideType(value.getClass());
+            Type overrideType = globalContext.getRootType(value.getClass());
             if (overrideType != null) {
                 return overrideType;
             }

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/ExceptionInheritanceTest.java Tue Jan  1 11:55:25 2008
@@ -51,7 +51,7 @@
         Set<String> l = new HashSet<String>();
         l.add(SimpleBean.class.getName());
         l.add(WS1ExtendedException.class.getName());
-        globalContext.setOverrideTypes(l);
+        globalContext.setRootClassNames(l);
         AegisDatabinding binding = new AegisDatabinding();
         binding.setAegisContext(globalContext);
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/inheritance/InheritancePOJOTest.java Tue Jan  1 11:55:25 2008
@@ -53,7 +53,7 @@
 
         Set<String> l = new HashSet<String>();
         l.add(Employee.class.getName());
-        globalContext.setOverrideTypes(l);
+        globalContext.setRootClassNames(l);
         AegisDatabinding binding = new AegisDatabinding();
         binding.setAegisContext(globalContext);
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java Tue Jan  1 11:55:25 2008
@@ -49,10 +49,11 @@
         Node response = invoke("BeanService", "bean11.xml");
 
         addNamespace("sb", "http://services.aegis.cxf.apache.org");
+        addNamespace("beanz", "urn:beanz");
         assertValid("/s:Envelope/s:Body/sb:getSimpleBeanResponse", response);
         assertValid("//sb:getSimpleBeanResponse/sb:return", response);
-        assertValid("//sb:getSimpleBeanResponse/sb:return/sb:howdy[text()=\"howdy\"]", response);
-        assertValid("//sb:getSimpleBeanResponse/sb:return/sb:bleh[text()=\"bleh\"]", response);
+        assertValid("//sb:getSimpleBeanResponse/sb:return/beanz:howdy[text()=\"howdy\"]", response);
+        assertValid("//sb:getSimpleBeanResponse/sb:return/beanz:bleh[text()=\"bleh\"]", response);
     }
 
     @Test
@@ -70,28 +71,28 @@
         assertValid("//xsd:complexType[@name='getSubmitBean']/xsd:sequence"
                     + "/xsd:element[@name='bleh'][@type='xsd:string'][@minOccurs='0']", doc);
         assertValid("//xsd:complexType[@name='getSubmitBean']/xsd:sequence"
-                    + "/xsd:element[@name='bean'][@type='tns:SimpleBean'][@minOccurs='0']", doc);
+                    + "/xsd:element[@name='bean'][@type='ns0:SimpleBean'][@minOccurs='0']", doc);
 
         assertValid("/wsdl:definitions/wsdl:types"
                     + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']", doc);
         assertValid("/wsdl:definitions/wsdl:types"
-                    + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
+                    + "/xsd:schema[@targetNamespace='urn:beanz']"
                     + "/xsd:complexType[@name=\"SimpleBean\"]", doc);
         assertValid(
                     "/wsdl:definitions/wsdl:types"
-                        + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
+                        + "/xsd:schema[@targetNamespace='urn:beanz']"
                         + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
                         + "[@name=\"bleh\"][@minOccurs='0']",
                     doc);
         assertValid(
                     "/wsdl:definitions/wsdl:types"
-                        + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
+                        + "/xsd:schema[@targetNamespace='urn:beanz']"
                         + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
                         + "[@name=\"howdy\"][@minOccurs='0']",
                     doc);
         assertValid(
                     "/wsdl:definitions/wsdl:types"
-                        + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
+                        + "/xsd:schema[@targetNamespace='urn:beanz']"
                         + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
                         + "[@type=\"xsd:string\"]",
                     doc);

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/oldconfig/Pre21ConfigCompatTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/oldconfig/Pre21ConfigCompatTest.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/oldconfig/Pre21ConfigCompatTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/oldconfig/Pre21ConfigCompatTest.java Tue Jan  1 11:55:25 2008
@@ -66,7 +66,7 @@
         AegisContext context = db.getAegisContext();
         assertTrue(context.isWriteXsiTypes());
         assertFalse(context.isReadXsiTypes());
-        Set<String> classes = context.getOverrideTypes();
+        Set<String> classes = context.getRootClassNames();
         assertTrue(classes.contains(SimpleBean.class.getName()));
         assertEquals(MyHello.class.getName(), context.getBeanImplementationMap().get(Hello.class)); 
     }

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.aegis.xml Tue Jan  1 11:55:25 2008
@@ -17,8 +17,8 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<mappings>
-    <mapping name="SimpleBean">
+<mappings xmlns:stalk='urn:beanz'>
+    <mapping name="stalk:SimpleBean">
     	<property name='numbers' nillable='false' minOccurs='2' maxOccurs='50' />
     </mapping>
 </mappings>

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/StandaloneReadTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/StandaloneReadTest.java?rev=607899&r1=607898&r2=607899&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/StandaloneReadTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/StandaloneReadTest.java Tue Jan  1 11:55:25 2008
@@ -19,13 +19,18 @@
 
 package org.apache.cxf.aegis.standalone;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.aegis.AegisContext;
 import org.apache.cxf.aegis.AegisXMLStreamDataReader;
+import org.apache.cxf.aegis.services.SimpleBean;
 import org.apache.cxf.test.TestUtilities;
 import org.junit.Before;
 import org.junit.Test;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -38,16 +43,34 @@
     @Before
     public void before() {
         testUtilities = new TestUtilities(getClass());
-        context = new AegisContext();
-        context.initialize();
     }
     
     @Test
     public void testBasicTypeRead() throws Exception {
+        context = new AegisContext();
+        context.initialize();
         XMLStreamReader streamReader = testUtilities.getResourceAsXMLStreamReader("stringElement.xml");
         AegisXMLStreamDataReader reader = 
             context.createReader(AegisXMLStreamDataReader.class, XMLStreamReader.class);
         Object something = reader.read(streamReader);
         assertTrue("ball-of-yarn".equals(something));
+    }
+    
+    // test using a .aegis.xml
+    @Test
+    public void testSimpleBeanRead() throws Exception {
+        context = new AegisContext();
+        Set<Class<?>> rootClasses = new HashSet<Class<?>>();
+        rootClasses.add(SimpleBean.class);
+        context.setRootClasses(rootClasses);
+        context.initialize();
+        XMLStreamReader streamReader = 
+            testUtilities.getResourceAsXMLStreamReader("simpleBean1.xml");
+        AegisXMLStreamDataReader reader = 
+            context.createReader(AegisXMLStreamDataReader.class, XMLStreamReader.class);
+        Object something = reader.read(streamReader);
+        assertTrue(something instanceof SimpleBean);
+        SimpleBean simpleBean = (SimpleBean) something;
+        assertEquals("howdy", simpleBean.getHowdy());
     }
 }

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml?rev=607899&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml Tue Jan  1 11:55:25 2008
@@ -0,0 +1,25 @@
+<!--
+  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.
+-->
+<!--  namespace goes with SimpleBean.aegis.xml -->
+<b:bean xmlns:b="urn:beanz" 
+        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+        xsi:type='b:SimpleBean'>
+  <b:bleh>bleh</b:bleh>
+  <b:howdy>howdy</b:howdy>
+</b:bean>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/standalone/simpleBean1.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml